[FFmpeg-user] Change aspect ratio of MPEG-PS without re-encoding?
Peter B.
pb at das-werkstatt.com
Thu Aug 9 15:13:40 CEST 2012
Hi,
I'd like to redefine the aspect ratio of a DVD-conform MPEG, using the
following command:
//------------------------
$ ffmpeg -i video_in.mpg -acodec copy -vcodec copy -aspect 16:9 video_out.mpg
//------------------------
As the output shows, the "-aspect 16:9" option seems to be ignored:
//------------------------
ffmpeg version N-43292-g7febc5a Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 7 2012 13:58:57 with gcc 4.4.5 (Debian 4.4.5-8)
configuration: --prefix=/usr/local --enable-gpl --enable-nonfree
--enable-postproc --enable-swscale --enable-avfilter --enable-pthreads
--enable-bzlib --enable-libmp3lame --enable-libvorbis --enable-libxvid
--enable-zlib --enable-libopenjpeg --enable-decoder=png
--enable-encoder=png --enable-libschroedinger
libavutil 51. 66.101 / 51. 66.101
libavcodec 54. 50.100 / 54. 50.100
libavformat 54. 22.101 / 54. 22.101
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 5.102 / 3. 5.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[mpeg @ 0x9861500] max_analyze_duration 5000000 reached at 5000000
Input #0, mpeg, from 'video_in.mpg':
Duration: 00:02:06.61, start: 0.220000, bitrate: 3255 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576
[SAR 16:15 DAR 4:3], 3900 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, stereo, s16, 224 kb/s
Output #0, mpeg, to 'video_out.mpg':
Metadata:
encoder : Lavf54.22.101
Stream #0:0: Video: mpeg2video, yuv420p, 720x576 [SAR 16:15 DAR
4:3], q=2-31, 3900 kb/s, 25 fps, 90k tbn, 25 tbc
Stream #0:1: Audio: mp2, 44100 Hz, stereo, 224 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 3166 fps=0.0 q=-1.0 Lsize= 49966kB time=00:02:06.60
bitrate=3233.2kbits/s
video:46248kB audio:3463kB subtitle:0 global headers:0kB muxing
overhead 0.512266%
//------------------------
From my experience with x264 [1], I've tried to use "-vf
setsar/setdar" instead, hoping that it would change the data inside
the stream:
//------------------------
$ ffmpeg -i video_in.mpg -acodec copy -vcodec copy -vf "setdar=16:9"
../client/flash/script_devel/12-00255_b03-aspect.mpg
//------------------------
ffmpeg version N-43292-g7febc5a Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 7 2012 13:58:57 with gcc 4.4.5 (Debian 4.4.5-8)
configuration: --prefix=/usr/local --enable-gpl --enable-nonfree
--enable-postproc --enable-swscale --enable-avfilter --enable-pthreads
--enable-bzlib --enable-libmp3lame --enable-libvorbis --enable-libxvid
--enable-zlib --enable-libopenjpeg --enable-decoder=png
--enable-encoder=png --enable-libschroedinger
libavutil 51. 66.101 / 51. 66.101
libavcodec 54. 50.100 / 54. 50.100
libavformat 54. 22.101 / 54. 22.101
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 5.102 / 3. 5.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[mpeg @ 0xaf7f500] max_analyze_duration 5000000 reached at 5000000
Input #0, mpeg, from 'video_in.mpg':
Duration: 00:02:06.61, start: 0.220000, bitrate: 3255 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576
[SAR 16:15 DAR 4:3], 3900 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, stereo, s16, 224 kb/s
Output #0, mpeg, to 'video_out.mpg':
Metadata:
encoder : Lavf54.22.101
Stream #0:0: Video: mpeg2video, yuv420p, 720x576 [SAR 16:15 DAR
4:3], q=2-31, 3900 kb/s, 25 fps, 90k tbn, 25 tbc
Stream #0:1: Audio: mp2, 44100 Hz, stereo, 224 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 3166 fps=560 q=-1.0 Lsize= 49966kB time=00:02:06.60
bitrate=3233.2kbits/s
video:46248kB audio:3463kB subtitle:0 global headers:0kB muxing
overhead 0.512266%
//------------------------
Again, it was ignored :(
When re-encoding the video with the same commandline as before, it
works as expected:
//------------------------
ffmpeg -i video_in.mpg -acodec copy -vcodec mpeg2video -aspect 16:9
video_out.mpg
//------------------------
ffmpeg version N-43292-g7febc5a Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 7 2012 13:58:57 with gcc 4.4.5 (Debian 4.4.5-8)
configuration: --prefix=/usr/local --enable-gpl --enable-nonfree
--enable-postproc --enable-swscale --enable-avfilter --enable-pthreads
--enable-bzlib --enable-libmp3lame --enable-libvorbis --enable-libxvid
--enable-zlib --enable-libopenjpeg --enable-decoder=png
--enable-encoder=png --enable-libschroedinger
libavutil 51. 66.101 / 51. 66.101
libavcodec 54. 50.100 / 54. 50.100
libavformat 54. 22.101 / 54. 22.101
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 5.102 / 3. 5.102
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[mpeg @ 0xa445500] max_analyze_duration 5000000 reached at 5000000
Input #0, mpeg, from 'video_in.mpg':
Duration: 00:02:06.61, start: 0.220000, bitrate: 3255 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576
[SAR 16:15 DAR 4:3], 3900 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, stereo, s16, 224 kb/s
VBV buffer size not set, muxing may fail
Output #0, mpeg, to 'video_out.mpg':
Metadata:
encoder : Lavf54.22.101
Stream #0:0: Video: mpeg2video, yuv420p, 720x576 [SAR 64:45 DAR
16:9], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream #0:1: Audio: mp2, 44100 Hz, stereo, 224 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video -> mpeg2video)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 3166 fps=250 q=31.0 Lsize= 10234kB time=00:02:06.60 bitrate=
662.2kbits/s
video:6672kB audio:3463kB subtitle:0 global headers:0kB muxing
overhead 0.975276%
//------------------------
Could anyone please tell me if it's possible to change the aspect
ratio of an MPEG *without* re-encoding it?
Thank you very much,
Pb
== References:
[1] http://ffmpeg.org/pipermail/ffmpeg-user/2012-April/006201.html
[2] http://howto-pages.org/ffmpeg/#basicvideo
More information about the ffmpeg-user
mailing list