Revision 2bc05d35

View differences:

Changelog
37 37
- R10k video decoder
38 38
- ocv_smooth filter
39 39
- frei0r wrapper filter
40
- change crop filter syntax to width:height:x:y
40 41

  
41 42

  
42 43
version 0.6:
doc/ffmpeg-doc.texi
226 226

  
227 227
@item -aspect @var{aspect}
228 228
Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
229
@item -croptop @var{size} (deprecated - use -vf crop=x:y:width:height instead)
229
@item -croptop @var{size} (deprecated - use the crop filter instead)
230 230
Set top crop band size (in pixels).
231
@item -cropbottom @var{size} (deprecated - use -vf crop=x:y:width:height instead)
231
@item -cropbottom @var{size} (deprecated - use the crop filter instead)
232 232
Set bottom crop band size (in pixels).
233
@item -cropleft @var{size} (deprecated - use -vf crop=x:y:width:height instead)
233
@item -cropleft @var{size} (deprecated - use the crop filter instead)
234 234
Set left crop band size (in pixels).
235
@item -cropright @var{size} (deprecated - use -vf crop=x:y:width:height instead)
235
@item -cropright @var{size} (deprecated - use the crop filter instead)
236 236
Set right crop band size (in pixels).
237 237
@item -padtop @var{size}
238 238
@item -padbottom @var{size}
doc/filters.texi
26 26

  
27 27
@section crop
28 28

  
29
Crop the input video to @var{x}:@var{y}:@var{width}:@var{height}.
29
Crop the input video to @var{width}:@var{height}:@var{x}:@var{y}.
30 30

  
31 31
@example
32
./ffmpeg -i in.avi -vf "crop=0:0:0:240" out.avi
32
./ffmpeg -i in.avi -vf "crop=0:240:0:0" out.avi
33 33
@end example
34 34

  
35
@var{x} and @var{y} specify the position of the top-left corner of the
36
output (non-cropped) area.
37

  
38
The default value of @var{x} and @var{y} is 0.
39

  
40 35
The @var{width} and @var{height} parameters specify the width and height
41 36
of the output (non-cropped) area.
42 37

  
43 38
A value of 0 is interpreted as the maximum possible size contained in
44 39
the area delimited by the top-left corner at position x:y.
45 40

  
41
@var{x} and @var{y} specify the position of the top-left corner of the
42
output (non-cropped) area.
43

  
44
The default value of @var{x} and @var{y} is 0.
45

  
46 46
For example the parameters:
47 47

  
48 48
@example
49
"crop=100:100:0:0"
49
"crop=0:0:100:100"
50 50
@end example
51 51

  
52 52
will delimit the rectangle with the top-left corner placed at position
ffmpeg.c
432 432
    last_filter = ist->input_video_filter;
433 433

  
434 434
    if (ost->video_crop) {
435
        snprintf(args, 255, "%d:%d:%d:%d", ost->leftBand, ost->topBand,
436
                 codec->width,
437
                 codec->height);
435
        snprintf(args, 255, "%d:%d:%d:%d",
436
                 codec->width, codec->height,
437
                 ost->leftBand, ost->topBand);
438 438
        if ((ret = avfilter_open(&filter, avfilter_get_by_name("crop"), NULL)) < 0)
439 439
            return ret;
440 440
        if ((ret = avfilter_init_filter(filter, args, NULL)) < 0)
libavfilter/avfilter.h
25 25
#include "libavutil/avutil.h"
26 26

  
27 27
#define LIBAVFILTER_VERSION_MAJOR  1
28
#define LIBAVFILTER_VERSION_MINOR 40
28
#define LIBAVFILTER_VERSION_MINOR 41
29 29
#define LIBAVFILTER_VERSION_MICRO  0
30 30

  
31 31
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
libavfilter/vf_crop.c
73 73
    CropContext *crop = ctx->priv;
74 74

  
75 75
    if (args)
76
        sscanf(args, "%d:%d:%d:%d", &crop->x, &crop->y, &crop->w, &crop->h);
76
        sscanf(args, "%d:%d:%d:%d", &crop->w, &crop->h, &crop->x, &crop->y);
77 77

  
78 78
    return 0;
79 79
}
......
96 96
    crop->x &= ~((1 << crop->hsub) - 1);
97 97
    crop->y &= ~((1 << crop->vsub) - 1);
98 98

  
99
    av_log(link->dst, AV_LOG_INFO, "x:%d y:%d w:%d h:%d\n",
100
           crop->x, crop->y, crop->w, crop->h);
99
    av_log(link->dst, AV_LOG_INFO, "w:%d h:%d x:%d y:%d\n",
100
           crop->w, crop->h, crop->x, crop->y);
101 101

  
102 102
    if (crop->x <  0 || crop->y <  0                    ||
103 103
        crop->w <= 0 || crop->h <= 0                    ||
......
172 172

  
173 173
AVFilter avfilter_vf_crop = {
174 174
    .name      = "crop",
175
    .description = NULL_IF_CONFIG_SMALL("Crop the input video to x:y:width:height."),
175
    .description = NULL_IF_CONFIG_SMALL("Crop the input video to width:height:x:y."),
176 176

  
177 177
    .priv_size = sizeof(CropContext),
178 178

  
tests/lavfi-regression.sh
22 22
    fi
23 23
}
24 24

  
25
do_lavfi "crop"               "crop=100:100"
26
do_lavfi "crop_scale"         "crop=100:100,scale=400:-1"
27
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"
28
do_lavfi "crop_vflip"         "crop=100:100,vflip"
25
do_lavfi "crop"               "crop=0:0:100:100"
26
do_lavfi "crop_scale"         "crop=0:0:100:100,scale=400:-1"
27
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"
28
do_lavfi "crop_vflip"         "crop=0:0:100:100,vflip"
29 29
do_lavfi "null"               "null"
30 30
do_lavfi "scale200"           "scale=200:200"
31 31
do_lavfi "scale500"           "scale=500:500"
32 32
do_lavfi "vflip"              "vflip"
33
do_lavfi "vflip_crop"         "vflip,crop=100:100"
33
do_lavfi "vflip_crop"         "vflip,crop=0:0:100:100"
34 34
do_lavfi "vflip_vflip"        "vflip,vflip"
35 35

  
36 36
do_lavfi_pixfmts(){

Also available in: Unified diff