How to set FPS using ffmpeg

13,729

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.

Share:
13,729

Related videos on Youtube

John M.
Author by

John M.

Updated on September 18, 2022

Comments

  • John M.
    John M. almost 2 years

    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.
    John M. about 7 years
    I've tried putting it in front of the filename, but the output fps is still 20.
  • Gyan
    Gyan about 7 years
    @slhck - with containers that have timestamps, input r does not alter PTS intervals in copy mode. Works with raw bitstreams.
  • slhck
    slhck about 7 years
    @Mulvya Didn't see the copy in the OP's question, of course you're right.
  • slhck
    slhck about 7 years
    @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).