[FFmpeg-trac] #1079(undetermined:closed): Crop Keep_Aspect option not working

FFmpeg trac at avcodec.org
Fri Mar 16 08:20:44 CET 2012

#1079: Crop Keep_Aspect option not working
             Reporter:  ramitbhalla  |                    Owner:
                 Type:  defect       |                   Status:  closed
             Priority:  normal       |                Component:
              Version:  unspecified  |  undetermined
             Keywords:               |               Resolution:  invalid
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
Changes (by cehoyos):

 * status:  new => closed
 * resolution:   => invalid


 Please always provide output for current git head, nearly 1000 changes
 have been made since the version you are using.

 The [http://www.ffmpeg.org/ffmpeg.html#crop documentation] says

  The keep_aspect parameter is optional, if specified and set to a non-zero
 value will force the output display aspect ratio to be the same of the
 input, by changing the output sample aspect ratio.

 (which is quite the opposite of what you write above).

 The scale filter (that you put after the crop filter) also changes the
 SAR, if you want a SAR of "1", add the setsar filter:
 -vf crop=1904:1072:6:6:1,scale=720:400,setsar=1

 For future reports: Please try to provide a minimal testcase, i.e. a
 command line that is as short as possible but allows to reproduce the
 problem. Add -an for video problems, -vn for audio problems:
 In your case:
 ffmpeg -i Test6.ts -an -vf crop=1904:1072:6:6:1,scale=720:400 -vcodec
 libxvid out.avi

 Additionally, please try to avoid using third party libraries since this
 makes reproducing problems more difficult. Please note that some
 developers believe that the internal mpeg4 encoder can produce better
 output than libxvid and for your specific case, using the internal encoder
 at least does not fail encoding.

 Finally, please use the button "Code block" for the command line and the
 complete, uncut console output to make the output more readable:
 $ ffmpeg -i out.mpg -vf crop=1904:1072:6:6,scale=720:400,setsar=1 -f null
 ffmpeg version N-38811-ga04a97b Copyright (c) 2000-2012 the FFmpeg
   built on Mar 15 2012 14:40:16 with gcc 4.3.2
   configuration: --cc=/usr/local/gcc-4.3.2/bin/gcc --enable-gpl --enable-
   libavutil      51. 42.100 / 51. 42.100
   libavcodec     54. 10.100 / 54. 10.100
   libavformat    54.  2.100 / 54.  2.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 64.101 /  2. 64.101
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0.  7.100 /  0.  7.100
   libpostproc    52.  0.100 / 52.  0.100
 [mpeg @ 0x8eb8aa0] Format mpeg detected only with low score of 25,
 misdetection possible!
 [NULL @ 0x8ebee00] start time is not set in estimate_timings_from_pts
 Input #0, mpeg, from 'out.mpg':
   Duration: N/A, bitrate: N/A
     Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 1920x1080 [SAR
 1:1 DAR 16:9], 104857 kb/s, 25 tbr, 90k tbn, 50 tbc
 [buffer @ 0x8ebf2a0] w:1920 h:1080 pixfmt:yuv420p tb:1/1000000 sar:1/1
 [setsar @ 0x8ec08e0] a:1/1
 [crop @ 0x8ec0920] w:1920 h:1080 -> w:1904 h:1072
 [scale @ 0x8edd160] w:1904 h:1072 fmt:yuv420p -> w:720 h:400 fmt:yuv420p
 Output #0, null, to 'pipe:':
     encoder         : Lavf54.2.100
     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x400
 [SAR 1:1 DAR 9:5], q=2-31, 200 kb/s, 90k tbn, 25 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (mpeg2video -> rawvideo)
 Press [q] to stop, [?] for help
 frame=   25 fps=0.0 q=0.0 Lsize=       0kB time=00:00:01.00 bitrate=
 0.0kbits/s dup=24 drop=0
 video:0kB audio:0kB global headers:0kB muxing overhead nan%
 Output file is empty, nothing was encoded (check -ss / -t / -frames
 parameters if used)

Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1079#comment:2>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list