[FFmpeg-user] What is the (technical) difference between -r and the fps filter?

Werner Robitza werner.robitza at gmail.com
Fri Apr 19 08:58:00 CEST 2013


One can extract thumbnails with

ffmpeg -i input -vf fps="fps=1/60" out%03d.png

or

ffmpeg -i input -r 1/60 out%03d.png

It looks like they'd do the same, but when trying it on a video I got
different frame counts, the latter being incorrect (see output later).

So, what is the difference between those two? I remember reading that the
-r option is applied after the video filters, but what'd cause it to create
a different number of output frames?

---------

  % ffmpeg -y -i input.mp4 -vf fps=fps=1/60 img%03d.png
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr  2 2013 20:38:39 with Apple LLVM version 4.2
(clang-425.0.24) (based on LLVM 3.2svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2 --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-nonfree
--enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc
--host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac
--enable-libmp3lame --enable-libxvid --enable-libtheora --enable-libvorbis
--enable-libvpx --enable-libvo-aacenc --enable-libass --enable-libfdk-aac
--enable-libopus --enable-frei0r --enable-libopenjpeg
--extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5 '
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-01-08 11:16:19
    encoder         : Lavf53.24.0
  Duration: 00:03:31.58, start: 0.000000, bitrate: 2359 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 2229 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
      creation_time   : 2012-01-08 11:16:19
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 125 kb/s
    Metadata:
      creation_time   : 2012-01-08 11:16:19
      handler_name    : SoundHandler
Output #0, image2, to 'img%03d.png':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.63.104
    Stream #0:0(eng): Video: png, rgb24, 1280x720 [SAR 1:1 DAR 16:9],
q=2-31, 200 kb/s, 90k tbn, 0.02 tbc
    Metadata:
      creation_time   : 2012-01-08 11:16:19
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> png)
Press [q] to stop, [?] for help
frame=    5 fps=0.8 q=0.0 Lsize=N/A time=00:05:00.00 bitrate=N/A
video:2310kB audio:0kB subtitle:0 global headers:0kB muxing overhead
-100.000930%


  % ffmpeg -y -i input.mp4 -r 1/60 rimg%03d.png
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr  2 2013 20:38:39 with Apple LLVM version 4.2
(clang-425.0.24) (based on LLVM 3.2svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2 --enable-shared
--enable-pthreads --enable-gpl --enable-version3 --enable-nonfree
--enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc
--host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac
--enable-libmp3lame --enable-libxvid --enable-libtheora --enable-libvorbis
--enable-libvpx --enable-libvo-aacenc --enable-libass --enable-libfdk-aac
--enable-libopus --enable-frei0r --enable-libopenjpeg
--extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5 '
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-01-08 11:16:19
    encoder         : Lavf53.24.0
  Duration: 00:03:31.58, start: 0.000000, bitrate: 2359 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1280x720 [SAR 1:1 DAR 16:9], 2229 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
      creation_time   : 2012-01-08 11:16:19
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 125 kb/s
    Metadata:
      creation_time   : 2012-01-08 11:16:19
      handler_name    : SoundHandler
Output #0, image2, to 'rimg%03d.png':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.63.104
    Stream #0:0(eng): Video: png, rgb24, 1280x720 [SAR 1:1 DAR 16:9],
q=2-31, 200 kb/s, 90k tbn, 0.02 tbc
    Metadata:
      creation_time   : 2012-01-08 11:16:19
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> png)
Press [q] to stop, [?] for help
frame=    7 fps=0.8 q=0.0 Lsize=N/A time=00:07:00.00 bitrate=N/A dup=0
drop=5280
video:2398kB audio:0kB subtitle:0 global headers:0kB muxing overhead
-100.000896%


More information about the ffmpeg-user mailing list