summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog1
-rw-r--r--doc/ffmpeg-doc.texi8
-rw-r--r--doc/filters.texi16
-rw-r--r--ffmpeg.c6
-rw-r--r--libavfilter/avfilter.h2
-rw-r--r--libavfilter/vf_crop.c8
-rwxr-xr-xtests/lavfi-regression.sh10
7 files changed, 26 insertions, 25 deletions
diff --git a/Changelog b/Changelog
index 2a8dcaa056..c29d15ac7d 100644
--- a/Changelog
+++ b/Changelog
@@ -37,6 +37,7 @@ version <next>:
- R10k video decoder
- ocv_smooth filter
- frei0r wrapper filter
+- change crop filter syntax to width:height:x:y
version 0.6:
diff --git a/doc/ffmpeg-doc.texi b/doc/ffmpeg-doc.texi
index d9c5c14242..e43e87ea0a 100644
--- a/doc/ffmpeg-doc.texi
+++ b/doc/ffmpeg-doc.texi
@@ -226,13 +226,13 @@ The following abbreviations are recognized:
@item -aspect @var{aspect}
Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
-@item -croptop @var{size} (deprecated - use -vf crop=x:y:width:height instead)
+@item -croptop @var{size} (deprecated - use the crop filter instead)
Set top crop band size (in pixels).
-@item -cropbottom @var{size} (deprecated - use -vf crop=x:y:width:height instead)
+@item -cropbottom @var{size} (deprecated - use the crop filter instead)
Set bottom crop band size (in pixels).
-@item -cropleft @var{size} (deprecated - use -vf crop=x:y:width:height instead)
+@item -cropleft @var{size} (deprecated - use the crop filter instead)
Set left crop band size (in pixels).
-@item -cropright @var{size} (deprecated - use -vf crop=x:y:width:height instead)
+@item -cropright @var{size} (deprecated - use the crop filter instead)
Set right crop band size (in pixels).
@item -padtop @var{size}
@item -padbottom @var{size}
diff --git a/doc/filters.texi b/doc/filters.texi
index 2309c56ac6..f934082d9a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -26,27 +26,27 @@ Below is a description of the currently available video filters.
@section crop
-Crop the input video to @var{x}:@var{y}:@var{width}:@var{height}.
+Crop the input video to @var{width}:@var{height}:@var{x}:@var{y}.
@example
-./ffmpeg -i in.avi -vf "crop=0:0:0:240" out.avi
+./ffmpeg -i in.avi -vf "crop=0:240:0:0" out.avi
@end example
-@var{x} and @var{y} specify the position of the top-left corner of the
-output (non-cropped) area.
-
-The default value of @var{x} and @var{y} is 0.
-
The @var{width} and @var{height} parameters specify the width and height
of the output (non-cropped) area.
A value of 0 is interpreted as the maximum possible size contained in
the area delimited by the top-left corner at position x:y.
+@var{x} and @var{y} specify the position of the top-left corner of the
+output (non-cropped) area.
+
+The default value of @var{x} and @var{y} is 0.
+
For example the parameters:
@example
-"crop=100:100:0:0"
+"crop=0:0:100:100"
@end example
will delimit the rectangle with the top-left corner placed at position
diff --git a/ffmpeg.c b/ffmpeg.c
index 7fdf57b3d5..df9a99bca1 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -432,9 +432,9 @@ static int configure_filters(AVInputStream *ist, AVOutputStream *ost)
last_filter = ist->input_video_filter;
if (ost->video_crop) {
- snprintf(args, 255, "%d:%d:%d:%d", ost->leftBand, ost->topBand,
- codec->width,
- codec->height);
+ snprintf(args, 255, "%d:%d:%d:%d",
+ codec->width, codec->height,
+ ost->leftBand, ost->topBand);
if ((ret = avfilter_open(&filter, avfilter_get_by_name("crop"), NULL)) < 0)
return ret;
if ((ret = avfilter_init_filter(filter, args, NULL)) < 0)
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 32f75bdc57..6fe6fa16ff 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -25,7 +25,7 @@
#include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 1
-#define LIBAVFILTER_VERSION_MINOR 40
+#define LIBAVFILTER_VERSION_MINOR 41
#define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index 4f8a382fa2..dfbc223483 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -73,7 +73,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
CropContext *crop = ctx->priv;
if (args)
- sscanf(args, "%d:%d:%d:%d", &crop->x, &crop->y, &crop->w, &crop->h);
+ sscanf(args, "%d:%d:%d:%d", &crop->w, &crop->h, &crop->x, &crop->y);
return 0;
}
@@ -96,8 +96,8 @@ static int config_input(AVFilterLink *link)
crop->x &= ~((1 << crop->hsub) - 1);
crop->y &= ~((1 << crop->vsub) - 1);
- av_log(link->dst, AV_LOG_INFO, "x:%d y:%d w:%d h:%d\n",
- crop->x, crop->y, crop->w, crop->h);
+ av_log(link->dst, AV_LOG_INFO, "w:%d h:%d x:%d y:%d\n",
+ crop->w, crop->h, crop->x, crop->y);
if (crop->x < 0 || crop->y < 0 ||
crop->w <= 0 || crop->h <= 0 ||
@@ -172,7 +172,7 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
AVFilter avfilter_vf_crop = {
.name = "crop",
- .description = NULL_IF_CONFIG_SMALL("Crop the input video to x:y:width:height."),
+ .description = NULL_IF_CONFIG_SMALL("Crop the input video to width:height:x:y."),
.priv_size = sizeof(CropContext),
diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh
index 511e0aec25..112dda880a 100755
--- a/tests/lavfi-regression.sh
+++ b/tests/lavfi-regression.sh
@@ -22,15 +22,15 @@ do_lavfi() {
fi
}
-do_lavfi "crop" "crop=100:100"
-do_lavfi "crop_scale" "crop=100:100,scale=400:-1"
-do_lavfi "crop_scale_vflip" "null,null,crop=200:200,crop=20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=100:100,vflip,scale=200:200,null,vflip,crop=100:100,null"
-do_lavfi "crop_vflip" "crop=100:100,vflip"
+do_lavfi "crop" "crop=0:0:100:100"
+do_lavfi "crop_scale" "crop=0:0:100:100,scale=400:-1"
+do_lavfi "crop_scale_vflip" "null,null,crop=0:0:200:200,crop=0:0:20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=0:0:100:100,vflip,scale=200:200,null,vflip,crop=0:0:100:100,null"
+do_lavfi "crop_vflip" "crop=0:0:100:100,vflip"
do_lavfi "null" "null"
do_lavfi "scale200" "scale=200:200"
do_lavfi "scale500" "scale=500:500"
do_lavfi "vflip" "vflip"
-do_lavfi "vflip_crop" "vflip,crop=100:100"
+do_lavfi "vflip_crop" "vflip,crop=0:0:100:100"
do_lavfi "vflip_vflip" "vflip,vflip"
do_lavfi_pixfmts(){