Changing aspect ratio flag without re-encoding
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
Hi, On Fri, Apr 9, 2010 at 12:12 PM, mi.lists.ffmpeg wrote:
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?
ffmpeg cannot change the aspect ratio unless you re-encode. Regards, V?ctor
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?
ffmpeg cannot change the aspect ratio unless you re-encode.
OK, Thanks. On Windows, there are a few tools which can do that (DVD Patcher, Restream). If someone is aware of a Linux tool that can do it, that would be nice.
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
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.
Yes, it seems ffmpeg can't change these flags withut re-encoding. Unfortunately, MP4Box can change the PAR for mp4 files, but not for MPEG2 files. And anyway, I believe I don't want to change the PAR which is right at 16:15 for PAL, but only the DAR, which I didn't find in the MP4Box documentation. (That is, if DAR is indeed a separate field, not just a display of the results of pixel size with PAR). Thanks.
mi.lists.ffmpeg at alma.ch wrote:
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.
Yes, it seems ffmpeg can't change these flags withut re-encoding.
Unfortunately, MP4Box can change the PAR for mp4 files, but not for MPEG2 files. And anyway, I believe I don't want to change the PAR which is right at 16:15 for PAL,
As long as it is 4:3, otherwise it is 64:45. Standard 4:3 PAL is 704x576-720x576 which displays as 768x576 so the PAR is 768/704-768/720. The amount of pixels is the same be it 4:3 or 16:9, only the pixels are wider, not displayed at 768x576 but at 1024x576-1048x576. And you only change the 'label' the pixels itself aren't changed, so it's easy to revert if ain't what it should be. > but only the DAR, which I didn't find in the
MP4Box documentation. (That is, if DAR is indeed a separate field, not just a display of the results of pixel size with PAR).
Thanks. _______________________________________________ ffmpeg-user mailing list ffmpeg-user at mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
mi.lists.ffmpeg at alma.ch wrote:
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
_______________________________________________ ffmpeg-user mailing list ffmpeg-user at mplayerhq.hu https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user mkvextract/mmg the gui version can change these parameters, and can load mpeg-2 streams
I just managed to change the PAR(Pixel Aspect Ratio) of a file using the following command - ffmpeg -i web1.webm -vf "setsar=2:1" web1.webm Is that what u wanted ?? -- View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Changing-aspect-ratio-flag-without-... Sent from the FFmpeg-users mailing list archive at Nabble.com.
participants (5)
-
belcampo@zonnet.nl -
ifti24 -
mi.lists.ffmpeg@alma.ch -
oberman@es.net -
victorpaesa@googlemail.com