Skip to content
DeveloperMemos

Changing Video Frame Rate with FFmpeg

FFmpeg, Video Editing, Frame Rate1 min read

FFmpeg is a powerful command-line tool that can manipulate various aspects of video and audio files. One common task is altering the frame rate (FPS) of a video.

Understanding Frame Rate

Frame rate determines the smoothness of a video. A higher frame rate means more frames per second, resulting in a smoother playback. Common frame rates include 24 fps for films, 25 fps for PAL video, and 30 fps for NTSC video.

Basic FFmpeg Command

The fundamental command to change the frame rate using FFmpeg is:

1ffmpeg -i input.mp4 -r new_fps output.mp4
  • -i input.mp4: Specifies the input video file.
  • -r new_fps: Sets the desired output frame rate. Replace new_fps with the target frame rate.
  • output.mp4: Specifies the output video file.

Example:

To convert a 60 fps video to 30 fps:

1ffmpeg -i input_60fps.mp4 -r 30 output_30fps.mp4

More Advanced Usage

While the basic command works for simple frame rate changes, you might need more control in specific scenarios.

Using the fps Filter

For finer control over frame rate conversion, use the fps filter:

1ffmpeg -i input.mp4 -filter:v fps=new_fps output.mp4

Preserving Video Quality

To maintain video quality during frame rate conversion, consider using the -crf option for constant rate factor encoding:

1ffmpeg -i input.mp4 -r new_fps -c:v libx264 -crf 23 output.mp4

The -crf value ranges from 0 (lossless) to 51 (highest compression). A value of 23 is often a good starting point for balancing quality and file size.

Handling Audio

To ensure audio synchronization, you can copy the audio stream without re-encoding:

1ffmpeg -i input.mp4 -c:a copy -r new_fps output.mp4