[FFmpeg-user] scale video filter and force_original_aspect_ratio option

James Darnley james.darnley at gmail.com
Wed Nov 27 23:05:44 CET 2013


Does the force_original_aspect_ratio option of the scale filter work as
described in the online docs?

> One useful instance of this option is that when you know a specific
> device’s 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 you
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

command:
> 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
> Input #0, yuv4mpegpipe, from 'Q:\test clips\crew_4cif.y4m':
>   Duration: N/A, bitrate: N/A
>     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 704x576, SAR 128:
> 117 DAR 1408:1053, 60 fps, 60 tbr, 60 tbn, 60 tbc
> [Parsed_scale_0 @ 000000000502fa60] w:1280 h:720 flags:'0x4' interl:0
> [graph 0 input from stream 0:0 @ 0000000002568100] w:704 h:576 pixfmt:yuv420p tb
> :1/60 fr:60/1 sar:128/117 sws_param:flags=2
> [Parsed_scale_0 @ 000000000502fa60] w:704 h:576 fmt:yuv420p sar:128/117 -> w:880
>  h:720 fmt:yuv420p sar:128/117 flags:0x4
> [svcd @ 000000000502d960] VBV buffer size not set, muxing may fail
> Output #0, svcd, to 'temp.vob':
>   Metadata:
>     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 mapping:
>   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%

And with a value of 1 instead of string "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=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
> Input #0, yuv4mpegpipe, from 'Q:\test clips\crew_4cif.y4m':
>   Duration: N/A, bitrate: N/A
>     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 704x576, SAR 128:
> 117 DAR 1408:1053, 60 fps, 60 tbr, 60 tbn, 60 tbc
> [Parsed_scale_0 @ 000000000502ec40] w:1280 h:720 flags:'0x4' interl:0
> [graph 0 input from stream 0:0 @ 000000000502f040] w:704 h:576 pixfmt:yuv420p tb
> :1/60 fr:60/1 sar:128/117 sws_param:flags=2
> [Parsed_scale_0 @ 000000000502ec40] w:704 h:576 fmt:yuv420p sar:128/117 -> w:880
>  h:720 fmt:yuv420p sar:128/117 flags:0x4
> [svcd @ 0000000000300a20] VBV buffer size not set, muxing may fail
> Output #0, svcd, to 'temp.vob':
>   Metadata:
>     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 mapping:
>   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%

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 683 bytes
Desc: OpenPGP digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20131127/f29a881f/attachment.asc>


More information about the ffmpeg-user mailing list