define the input FPS of a stream using ffmpeg-python

17 views Asked by At

Im creating an HLS playlist using ffmpeg, reading my input from an RTSP stream.

When probing the RTSP stream, i get an FPS which is not the true FPS, and i want to "tell" ffmpeg the actual real FPS.

In the command line, im using the -r flag, which works fine:

ffmpeg -rtsp_transport tcp -r 18 -i rtsp://localhost:554/test -b:v 100KB -vf format=yuvj420p  -c:a copy -hls_time 2 -hls_list_size 10 -hls_flags delete_segments -start_number 1 output.m3u8

I noticed that flag must come before the input param. If i use the -r after, it simply doesnt work.

In ffmpeg-python, i dont see any option to do so. And using it as a flag to the .input() function, does not work.

How can i use the -r flag with ffmpeg-python?

1

There are 1 answers

0
kesh On

Per documentation

Any supplied kwargs are passed to ffmpeg verbatim (e.g. t=20, f='mp4', acodec='pcm', etc.).

So, .input(r=18) should do the trick