How to set FPS using ffmpeg

2

I'm trying to save my CCTV stream into segments of 300 seconds with a FPS of 7. Here's my command:

ffmpeg -r 7 -i rtsp://192.168.1.100/...stream=0.sdp -acodec aac -strict -2 -vcodec copy -f segment -segment_time 300 -segment_format mp4 "mon1-%03d.mp4"

The output file doesn't seem to respect the '-r 7' command (for FPS = 7). Does anyone know how to set the FPS of the output?

John M.

Posted 2017-06-03T10:56:26.663

Reputation: 143

Answers

2

When you put an argument before -i, it will be applied to the following input only.

Move the -r argument somewhere between the input and output file.

In your case, the frame rate is not changed, since you only copy the video bitstream. When changing the frame rate, you have to re-encode the video, since dropping frames means that inter-frame predictions will no longer be valid.

slhck

Posted 2017-06-03T10:56:26.663

Reputation: 182 472

I've tried putting it in front of the filename, but the output fps is still 20. – John M. – 2017-06-03T12:55:46.397

@slhck - with containers that have timestamps, input r does not alter PTS intervals in copy mode. Works with raw bitstreams. – Gyan – 2017-06-03T13:04:39.663

@Mulvya Didn't see the copy in the OP's question, of course you're right. – slhck – 2017-06-03T20:25:55.060

@John It seems you have to re-encode the video, as you can't just arbitrarily change the FPS. Remove the copy option and set some quality parameter for the output (e.g. -crf 23). – slhck – 2017-06-03T20:29:29.797