Date: Fri, 09 Apr 2010 12:12:54 +0200 From: mi.lists.ffmpeg at alma.ch Sender: ffmpeg-user-bounces at mplayerhq.hu
I tried to use FFmpeg to change the aspect ratio flag in an MPEG file, but it didn't. Am I doing it wrong, or is it not possible without re-encoding?
Here, the Output part correctly shows "DAR 16:9", but the resulting file is still "DAR 4:3" :
$ ffmpeg -i INPUT.m2v -aspect 16:9 -vcodec copy OUTPUT.m2v
FFmpeg version SVN-r18021, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libx264 --enable-libxvid
libavutil 50. 0. 0 / 50. 0. 0
libavcodec 52.21. 0 / 52.21. 0
libavformat 52.31. 1 / 52.31. 1 libavdevice 52. 1. 0 / 52. 1. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Mar 18 2009 14:40:53, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1) Input #0, mpegvideo, from 'INPUT.m2v': Duration: 00:00:11.33, bitrate: 8000 kb/s Stream #0.0: Video: mpeg2video, yuv420p, 720x576 [PAR 16:15 DAR 4:3], 8000 kb/s, 25 tbr, 1200k tbn, 50 tbc Output #0, mpeg2video, to 'OUTPUT.m2v': Stream #0.0: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9], q=2-31, 8000 kb/s, 90k tbn, 25 tbc Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop encoding frame= 282 fps= 0 q=-1.0 Lsize= 11072kB time=11.28 bitrate=8041.3kbits/s video:11072kB audio:0kB global headers:0kB muxing overhead 0.000000%
Looking at the result:
$ ffmpeg -i OUTPUT.m2v FFmpeg version SVN-r18021, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --enable-gpl --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libx264 --enable-libxvid libavutil 50. 0. 0 / 50. 0. 0 libavcodec 52.21. 0 / 52.21. 0 libavformat 52.31. 1 / 52.31. 1 libavdevice 52. 1. 0 / 52. 1. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Mar 18 2009 14:40:53, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (25/1) Input #0, mpegvideo, from 'OUTPUT.m2v': Duration: 00:00:11.33, bitrate: 8000 kb/s Stream #0.0: Video: mpeg2video, yuv420p, 720x576 [PAR 16:15 DAR 4:3], 8000 kb/s, 25 tbr, 1200k tbn, 50 tbc
Just a guess, since I'm not sure exactly what your goal is. Aspect ratio is not anywhere near as simple as it looks. If you want to learn a lot about it, read the wikipedia article on Aspect ratio and, more important, pixel aspect ratio. If you have a file that should be wide-screen (16:9), but displays at 4:3 with "skinny" people, try adjusting the PAR, but, without re-coding and losing quality, ffmpeg won't do this. If you want to adjust either DAR or PAR, you should be able to use mp4box. mp4box -add INFILE -par 1=RATIO OUTFILE will allow you to adjust the PAR. Please note that pixels in standard video are NOT 1:1. They are 12:11. The proper PAR for 16:9 is 16:11, as indicated in the output above. -- R. Kevin Oberman, Network Engineer Energy Sciences Network (ESnet) Ernest O. Lawrence Berkeley National Laboratory (Berkeley Lab) E-mail: oberman at es.net Phone: +1 510 486-8634 Key fingerprint:059B 2DDF 031C 9BA3 14A4 EADA 927D EBB3 987B 3751