James Darnley
2013-11-27 22:05:44 UTC
Does the force_original_aspect_ratio option of the scale filter work as
described in the online docs?
set it will be scaled to fit within the size you set." Is that reading
wrong? I've been trying to get it to work when encoding a random set of
files, some smaller and some larger, than what I want but all are
resized to fit.
In my example below we can clearly see that a video of 704x576 is
resized up to 880x720 when I requested 1280x720 with
force_original_aspect_ratio=decrease
described in the online docs?
One useful instance of this option is that when you know a specific
devices maximum allowed resolution, you can use this to limit the
output video to that, while retaining the aspect ratio. For example,
device A allows 1280x720 playback, and your video is 1920x800. Using
this option (set it to decrease) and specifying 1280x720 to the
command line makes the output 1280x533.
I read that to be "If and only if the video is larger than the size youdevices maximum allowed resolution, you can use this to limit the
output video to that, while retaining the aspect ratio. For example,
device A allows 1280x720 playback, and your video is 1920x800. Using
this option (set it to decrease) and specifying 1280x720 to the
command line makes the output 1280x533.
set it will be scaled to fit within the size you set." Is that reading
wrong? I've been trying to get it to work when encoding a random set of
files, some smaller and some larger, than what I want but all are
resized to fit.
In my example below we can clearly see that a video of 704x576 is
resized up to 880x720 when I requested 1280x720 with
force_original_aspect_ratio=decrease
ffmpeg -loglevel verbose -y -i "Q:\test clips\crew_4cif.y4m" -vcodec mpeg2video -q 4 -vframes 1 -vf "scale=1280:720:force_original_aspect_ratio=decrease" temp.vob
ffmpeg version N-58485-ga12b4bd Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 26 2013 22:07:02 with gcc 4.8.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.101 / 55. 5.101
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Duration: N/A, bitrate: N/A
117 DAR 1408:1053, 60 fps, 60 tbr, 60 tbn, 60 tbc
:1/60 fr:60/1 sar:128/117 sws_param:flags=2
h:720 fmt:yuv420p sar:128/117 flags:0x4
encoder : Lavf55.21.102
Stream #0:0: Video: mpeg2video, yuv420p, 880x720 [SAR 128:117 DAR 1408:1053]
, q=2-31, 200 kb/s, 90k tbn, 60 tbc
Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
frame= 1 fps=0.0 q=4.0 Lsize= 50kB time=00:00:00.01 bitrate=24575.5kbits
/s
video:46kB audio:0kB subtitle:0 global headers:0kB muxing overhead 9.096333%
ffmpeg -loglevel verbose -y -i "Q:\test clips\crew_4cif.y4m" -vcodec mpeg2video -q 4 -vframes 1 -vf "scale=1280:720:force_original_aspect_ratio=1" temp.vob
ffmpeg version N-58485-ga12b4bd Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 26 2013 22:07:02 with gcc 4.8.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.101 / 55. 5.101
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Duration: N/A, bitrate: N/A
117 DAR 1408:1053, 60 fps, 60 tbr, 60 tbn, 60 tbc
:1/60 fr:60/1 sar:128/117 sws_param:flags=2
h:720 fmt:yuv420p sar:128/117 flags:0x4
encoder : Lavf55.21.102
Stream #0:0: Video: mpeg2video, yuv420p, 880x720 [SAR 128:117 DAR 1408:1053]
, q=2-31, 200 kb/s, 90k tbn, 60 tbc
Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
frame= 1 fps=0.0 q=4.0 Lsize= 50kB time=00:00:00.01 bitrate=24575.5kbits
/s
video:46kB audio:0kB subtitle:0 global headers:0kB muxing overhead 9.096333%
ffmpeg version N-58485-ga12b4bd Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 26 2013 22:07:02 with gcc 4.8.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.101 / 55. 5.101
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Duration: N/A, bitrate: N/A
117 DAR 1408:1053, 60 fps, 60 tbr, 60 tbn, 60 tbc
:1/60 fr:60/1 sar:128/117 sws_param:flags=2
h:720 fmt:yuv420p sar:128/117 flags:0x4
encoder : Lavf55.21.102
Stream #0:0: Video: mpeg2video, yuv420p, 880x720 [SAR 128:117 DAR 1408:1053]
, q=2-31, 200 kb/s, 90k tbn, 60 tbc
Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
frame= 1 fps=0.0 q=4.0 Lsize= 50kB time=00:00:00.01 bitrate=24575.5kbits
/s
video:46kB audio:0kB subtitle:0 global headers:0kB muxing overhead 9.096333%
ffmpeg -loglevel verbose -y -i "Q:\test clips\crew_4cif.y4m" -vcodec mpeg2video -q 4 -vframes 1 -vf "scale=1280:720:force_original_aspect_ratio=1" temp.vob
ffmpeg version N-58485-ga12b4bd Copyright (c) 2000-2013 the FFmpeg developers
built on Nov 26 2013 22:07:02 with gcc 4.8.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.101 / 55. 5.101
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Duration: N/A, bitrate: N/A
117 DAR 1408:1053, 60 fps, 60 tbr, 60 tbn, 60 tbc
:1/60 fr:60/1 sar:128/117 sws_param:flags=2
h:720 fmt:yuv420p sar:128/117 flags:0x4
encoder : Lavf55.21.102
Stream #0:0: Video: mpeg2video, yuv420p, 880x720 [SAR 128:117 DAR 1408:1053]
, q=2-31, 200 kb/s, 90k tbn, 60 tbc
Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
frame= 1 fps=0.0 q=4.0 Lsize= 50kB time=00:00:00.01 bitrate=24575.5kbits
/s
video:46kB audio:0kB subtitle:0 global headers:0kB muxing overhead 9.096333%