[FFmpeg-user] filter_complex vs vf with one filter

Hans Carlson forbyta at gmx.com
Sat Nov 18 07:15:31 EET 2017


What's the difference between "-filter_complex" and "-vf" when only one 
filter is used?  Specially, when the "scale" filter is used.

I assumed the results would be the same, but discovered the "-vf" version 
creates an mpeg2 file almost 80M larger for my ~600M input test file.

   $ ls -lGg TEST.mkv TEST-fc.mpg TEST-vf.mpg
   -rw-r--r--. 1 620992404 Nov 17 20:58 TEST.mkv
   -rw-r--r--. 1 578318336 Nov 17 21:02 TEST-fc.mpg
   -rw-r--r--. 1 660838400 Nov 17 21:06 TEST-vf.mpg

But the video specs appear to be the same for both output files:

   $ for i in TEST-fc.mpg TEST-vf.mpg; do ffmpeg -i $i 2>&1 | egrep 'Input|Stream'; done
   Input #0, mpeg, from 'TEST-fc.mpg':
       Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, progressive), 1711x720 [SAR 1:1 DAR 1711:720], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
   Input #0, mpeg, from 'TEST-vf.mpg':
       Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, progressive), 1711x720 [SAR 1:1 DAR 1711:720], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc

The TEST.mkv input file is only 10 mins of the video stream from the 
original 2hr file.  The difference in size for the original (~9G) file is 
about 1G (7.4G for "-filter_complex" vs 8.4G for "-vf).

Here's complete output for both 10 min TEST output files:

   $ ffmpeg -i TEST.mkv -codec:v mpeg2video -b:v 16384k -bufsize 4096k -maxrate 30000k -filter_complex 'scale=-1:720' -f vob TEST-fc.mpg
   ffmpeg version N-89089-g80bb81a Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 4.9.2 (GCC) 20150212 (Red Hat 4.9.2-6)
     configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libcdio --enable-libbluray --enable-openssl --disable-ffplay --disable-ffserver
     libavutil      56.  0.100 / 56.  0.100
     libavcodec     58.  3.102 / 58.  3.102
     libavformat    58.  2.100 / 58.  2.100
     libavdevice    58.  0.100 / 58.  0.100
     libavfilter     7.  0.101 /  7.  0.101
     libswscale      5.  0.101 /  5.  0.101
     libswresample   3.  0.101 /  3.  0.101
     libpostproc    55.  0.100 / 55.  0.100
   Input #0, matroska,webm, from 'TEST.mkv':
     Metadata:
       ENCODER         : Lavf58.2.100
     Duration: 00:10:00.23, start: 0.000000, bitrate: 8276 kb/s
       Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x808, SAR 1:1 DAR 240:101, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
       Metadata:
         DURATION        : 00:10:00.225000000
   Stream mapping:
     Stream #0:0 (h264) -> scale
     scale -> Stream #0:0 (mpeg2video)
   Press [q] to stop, [?] for help
   Output #0, vob, to 'TEST-fc.mpg':
     Metadata:
       encoder         : Lavf58.2.100
       Stream #0:0: Video: mpeg2video (Main), yuv420p, 1711x720 [SAR 172800:172811 DAR 240:101], q=2-31, 16384 kb/s, 23.98 fps, 90k tbn, 23.98 tbc (default)
       Metadata:
         encoder         : Lavc58.3.102 mpeg2video
       Side data:
         cpb: bitrate max/min/avg: 30000000/0/16384000 buffer size: 4096000 vbv_delay: -1
   frame=14391 fps= 74 q=2.0 Lsize=  564764kB time=00:10:00.14 bitrate=7709.1kbits/s dup=3 drop=0 speed=3.08x
   video:557904kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.229569%

   $ ffmpeg -i TEST.mkv -codec:v mpeg2video -b:v 16384k -bufsize 4096k -maxrate 30000k -vf 'scale=-1:720' -f vob TEST-vf.mpg
   ffmpeg version N-89089-g80bb81a Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 4.9.2 (GCC) 20150212 (Red Hat 4.9.2-6)
     configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libcdio --enable-libbluray --enable-openssl --disable-ffplay --disable-ffserver
     libavutil      56.  0.100 / 56.  0.100
     libavcodec     58.  3.102 / 58.  3.102
     libavformat    58.  2.100 / 58.  2.100
     libavdevice    58.  0.100 / 58.  0.100
     libavfilter     7.  0.101 /  7.  0.101
     libswscale      5.  0.101 /  5.  0.101
     libswresample   3.  0.101 /  3.  0.101
     libpostproc    55.  0.100 / 55.  0.100
   Input #0, matroska,webm, from 'TEST.mkv':
     Metadata:
       ENCODER         : Lavf58.2.100
     Duration: 00:10:00.23, start: 0.000000, bitrate: 8276 kb/s
       Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x808, SAR 1:1 DAR 240:101, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
       Metadata:
         DURATION        : 00:10:00.225000000
   Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> mpeg2video (native))
   Press [q] to stop, [?] for help
   Output #0, vob, to 'TEST-vf.mpg':
     Metadata:
       encoder         : Lavf58.2.100
       Stream #0:0: Video: mpeg2video (Main), yuv420p, 1711x720 [SAR 172800:172811 DAR 240:101], q=2-31, 16384 kb/s, 23.98 fps, 90k tbn, 23.98 tbc (default)
       Metadata:
         DURATION        : 00:10:00.225000000
         encoder         : Lavc58.3.102 mpeg2video
       Side data:
         cpb: bitrate max/min/avg: 30000000/0/16384000 buffer size: 4096000 vbv_delay: -1
   frame=14391 fps= 68 q=2.0 Lsize=  645350kB time=00:10:00.14 bitrate=8809.1kbits/s dup=3 drop=0 speed=2.83x
   video:637531kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.226453%


More information about the ffmpeg-user mailing list