Short answer: to change the frame rate of a video with FFmpeg without changing its speed, re-encode through a rate filter such as fps=12, then measure the output. On FFmpeg 9.0.2, ffmpeg -r 12 -c copy exited 0 on a 24 fps fixture but left the stored stream at 24 fps and 289 frames. Re-encoding with output -r 12 and re-encoding with -filter:v fps=12 both stayed near 12 seconds, but they did not pick the same first frame or the same frame count. Changing speed is a different job: setpts=0.5*PTS with -c:a copy shortened the video stream to about 6.08 seconds and left the audio at 12.064 seconds.

This write-up is a developer checklist, not a product tutorial. The commands and numbers below were measured with pytest on grey-hoodie-v2.mp4 (md5 a50e13313b71a76dbd179dcdc2c2b6bf): H.264, 720×1280, 24 fps, 289 video frames, AAC stereo at 32 kHz, audio duration 12.064 seconds. Five tests passed in 1.51 seconds via uv run --with pytest. If your build, container, or input differs, measure again before you ship the file.

Do not trust stream-copy to change the frame rate

A common autocomplete suggestion is "ffmpeg change frame rate without re encoding." I ran that idea as an output option on the fixture:

ffmpeg -i input.mp4 -r 12 -c copy output.mp4 

FFmpeg 9.0.2 exited 0. The muxer log even printed 12 fps, 24 tbr on the output mapping. The file that landed on disk still probed as 24 fps, still had 289 frames, still matched the source first-frame RGB24 md5, and was the same size as the input. Stream-copy cannot resample timestamps the way a rate filter can, and on this fixture the -r 12 you passed with -c copy did not change the stored frame rate.

Side-by-side first frames of the 24 fps source and the stream-copied output after ffmpeg -r 12 -c copy; both still probe as 24 fps with 289 frames and the same first-frame md5

If you need a lossless remux, skip -r and copy the streams as they are. If you need a new frame rate, plan for a video re-encode.

fps=12 keeps the duration, and it is not the same as output -r 12

These two re-encodes both target 12 fps and keep the clip near its original length — they change frame rate without changing speed:

ffmpeg -i input.mp4 -filter:v fps=12 -c:v libx264 -preset veryfast -crf 23 -c:a copy fps12.mp4 ffmpeg -i input.mp4 -r 12 -c:v libx264 -preset veryfast -crf 23 -c:a copy r12.mp4 

On this fixture, FFmpeg 9.0.2 measured:

  • fps=12: 12 fps, 145 frames, video duration 12.083 seconds, audio still 12.064 seconds.
  • output -r 12: 12 fps, 146 frames, video duration 12.167 seconds, audio still 12.064 seconds.

The first-frame RGB24 md5 values were different from each other and from the source. Do not assume the two commands pick the same frames, and do not assume the video duration will match the audio to the millisecond after a re-encode.

First frames from fps=12 versus output -r 12 after the same libx264 re-encode; frame counts were 145 and 146, and the first-frame rasters did not match

Changing speed is a different measurement

If the goal is a faster or slower clip, a frame-rate conversion that keeps duration will not do that work. I used setpts=0.5*PTS and copied the audio:

ffmpeg -i input.mp4 -filter:v setpts=0.5*PTS -c:v libx264 -preset veryfast -crf 23 -c:a copy faster.mp4 

The video stream duration became 6.083 seconds with 146 frames. The audio stream stayed at 12.064 seconds, and the container duration followed the longer audio stream. That is a desync, not a frame-rate conversion. If you intend to change speed, you still need a matching audio filter such as atempo, and you should measure both stream durations after the run.

Prove the output before you publish it

The pytest file in this run checks five facts on the fixture: the source identity, that -r 12 -c copy stays at 24 fps, that fps=12 keeps a ~12.08 second duration at 12 fps, that output -r 12 does not match the fps=12 first frame or frame count, and that setpts=0.5*PTS with -c:a copy leaves the audio at 12.064 seconds. Run the same measurements on your file:

ffprobe -v error -show_entries stream=codec_type,avg_frame_rate,nb_frames,duration -of json output.mp4 

Then compare the first-frame RGB24 md5 if you need to know whether two rate commands actually selected the same picture.

Optional, and unrelated to the measurements above: if you later want a photo-to-video walk-in on a separate tool, Voor's Storm II sync dance page is one generator route. This article does not quote a model or a credit number for that page. After you have a clip, change its frame rate with a measured FFmpeg command only if you have re-checked the output on your own build.