[FFmpeg-devel] ffmpeg -s breaks aspect ration (regression)

Jean Delvare khali at linux-fr.org
Tue Aug 16 17:52:59 CEST 2011


Hi Michael,

Thanks for your answer.

On Mon, 1 Aug 2011 11:42:13 +0200, Michael Niedermayer wrote:
> Hi
> 
> On Wed, Jul 20, 2011 at 04:44:56PM +0200, Jean Delvare wrote:
> > Last time I updated ffmpeg, I hit a problem where option -s breaks the
> > aspect ratio. I bisected the repository and found that this regression
> > was introduced by:
> > 
> > commit 7a11c82fb760619d0e17ca234381b50d6c675cc0
> > Author: Michael Niedermayer <michaelni at gmx.at>
> > Date:   Mon Jan 31 20:48:35 2011 +0100
> > 
> >     vsrc_buffer: add sample_aspect_ratio fields to arguments.
> >     
> >     This fixes aspect handling in ffmpeg.
> >     
> >     This is based on a patch by Baptiste.
> >     
> >     Signed-off-by: Anton Khirnov <anton at khirnov.net>
> > 
> > My input video looks like:
> > 
> > Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 64:45 DAR 16:9], 9500 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
> > 
> > I am passing -s 640x360 to ffmpeg to get square pixels, before the bug
> > I would get:
> > 
> > Stream #0.0(und): Video: mpeg4, yuv420p, 640x360 [PAR 1:1 DAR 16:9], 640 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
> > 
> > and the video would look OK. Since the commit above, I get:
> > 
> > Stream #0.0(und): Video: mpeg4, yuv420p, 640x360 [PAR 1:1 DAR 16:9], 743 kb/s, PAR 91:64 DAR 91:36, 25 fps, 25 tbr, 25 tbn, 25 tbc
> 
> This bug seems to have been fixed as i cannot reproduce this anymore

Really? I still can, with the latest ffmpeg straight from git. See by
yourself:

khali at endymion:~/recordings> ffmpeg -i safari_3_reasm.mpg -s 640x360 -b 640k -vcodec mpeg4 -t 0:01:00 -an test7.avi
ffmpeg version N-31916-g86ca51a, Copyright (c) 2000-2011 the FFmpeg developers
  built on Aug 16 2011 17:41:46 with gcc 4.5.0 20100604 [gcc-4_5-branch revision 160292]
  configuration: --prefix=/opt/ffmpeg --enable-shared --enable-libmp3lame --enable-libxvid --enable-postproc --enable-gpl --enable-x11grab --enable-avfilter --enable-version3 --enable-libx264 --enable-pthreads --enable-libvorbis --enable-libtheora --disable-doc
  libavutil    51. 12. 0 / 51. 12. 0
  libavcodec   53. 10. 0 / 53. 10. 0
  libavformat  53.  7. 0 / 53.  7. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 31. 1 /  2. 31. 1
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[mpeg @ 0x623420] max_analyze_duration 5000000 reached at 5016000

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (50/2)
Input #0, mpeg, from 'safari_3_reasm.mpg':
  Duration: 00:18:18.57, start: 0.242378, bitrate: 5599 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 9500 kb/s, 27.68 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
[buffer @ 0x624720] w:720 h:576 pixfmt:yuv420p tb:1/1000000 sar:64/45 sws_param:
[scale @ 0x621960] w:720 h:576 fmt:yuv420p -> w:640 h:360 fmt:yuv420p flags:0x4
[mpeg4 @ 0x624d80] removing common factors from framerate
Output #0, avi, to 'test7.avi':
  Metadata:
    ISFT            : Lavf53.7.0
    Stream #0.0: Video: mpeg4, yuv420p, 640x360 [SAR 64:45 DAR 1024:405], q=2-31, 640 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame= 1491 fps=178 q=5.0 Lsize=    4713kB time=00:01:00.08 bitrate= 642.6kbits/s dup=0 drop=10    
video:4671kB audio:0kB global headers:0kB muxing overhead 0.890051%
khali at endymion:~/recordings> ffmpeg -i  test7.avi
ffmpeg version N-31916-g86ca51a, Copyright (c) 2000-2011 the FFmpeg developers
  built on Aug 16 2011 17:41:46 with gcc 4.5.0 20100604 [gcc-4_5-branch revision 160292]
  configuration: --prefix=/opt/ffmpeg --enable-shared --enable-libmp3lame --enable-libxvid --enable-postproc --enable-gpl --enable-x11grab --enable-avfilter --enable-version3 --enable-libx264 --enable-pthreads --enable-libvorbis --enable-libtheora --disable-doc
  libavutil    51. 12. 0 / 51. 12. 0
  libavcodec   53. 10. 0 / 53. 10. 0
  libavformat  53.  7. 0 / 53.  7. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 31. 1 /  2. 31. 1
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, avi, from 'test7.avi':
  Metadata:
    encoder         : Lavf53.7.0
  Duration: 00:01:00.08, start: 0.000000, bitrate: 642 kb/s
    Stream #0.0: Video: mpeg4 (Simple Profile), yuv420p, 640x360 [SAR 1:1 DAR 16:9], SAR 64:45 DAR 1024:405, 25 tbr, 25 tbn, 25 tbc
                                                                                     ^^^^^^^^^^^^^^^^^^^^^^
At least one output file must be specified
khali at endymion:~/recordings>

And test7.avi is badly displayed by totem. I can send you a sample
input file if you want, but I suspect any DVD or DVB source will
exhibit the same problem. As before the issue goes away if I pass
-aspect 16:9, but I believe I shouldn't have to do so as this is the
DAR of the input as well.

-- 
Jean Delvare


More information about the ffmpeg-devel mailing list