[Libav-user] How the ffmpeg command line utility's '-r' flag works?

Carl Eugen Hoyos ceffmpeg at gmail.com
Sun Mar 4 10:50:12 EET 2018

2018-03-01 16:30 GMT+01:00, Ramil Safin <ramilsafnab1996 at gmail.com>:
> I have a usb camera '/dev/videoX' and I've implemented decoding process.
> Supported camera framerates are 15 and 30.
> However, I need to reduce its framerate in order to stream video data
> (RTP/RTSP) from multiple usb cameras (I have 4 cameras) using H.264 codec
> and keep quality as good as possible.
> Also it is essential to be in real-time (small delays). I've been searching
> on how to reduce the framerate of the output stream, for example to 5 fps.

There is an "fps" filter in libavfilter.

> And I know that in order to reduce the framerate in CLI (ffmpeg)  '-r' flag
> is used.
> And my question is how '-r' functionality is implemented?

> Is it filter (AVFilter) or some kind of algorithm?

No, "-r" does not translate to a call to the fps filter, the code
is in ftools, possibly write_packet() in ffmpeg.c

Carl Eugen

More information about the Libav-user mailing list