I need to concatenate a number of video files with different framerates to play them with OMXPlayer on a Raspberry PI (the concatenation is also done on the PI).

Both the originals and the concatenation are mp4/h264 and the originals are also created by some software of mine.

Using ffmpegs copy muxer doesn't work when the files have different time bases.

So I was thinking that I produce the original videos with an explicit timebase of 120 (120 is divisible by both 25 and 30, the only frame rates I care about).

The test

ffmpeg.exe -i .\ballon.mp4 -enc_time_base 1:120 .\ballon-120.mp4

seems promising: ffmpeg says it produces a 30fps video (the original was 30fps) with a timebase of 120 in the output.

However, it also says that it "duplicates frames" a lot and the following command tells me I have 4 times as many frames as I actually should have:

ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_frames -of default=nokey=1:noprint_wrappers=1 .\ballon.mp4

ffprobe also thinks the frame rate is now 120 and indeed OMXPlayer complains about the framerate being too high and plays the video somewhat slow.

What I want is to change the timebase, not the frame rate or the number of frames. How do I do that?

2 Answers 2


Use the private MP4 muxer option

ffmpeg.exe -i .\ballon.mp4 -c copy -video_track_timescale 120 .\ballon-120.mp4

With your command, you were re-encoding the video and supplying a time base to the encoder, which ffmpeg uses for frame duplication/drop decisons.

  • Awesome! I found another way also (see my own answer), but yours is better as it doesn't have to be done at encoding time. Annoying that it isn't documented.
    – John
    Jun 28, 2018 at 15:56
  • @John Run ffmpeg -h full and look for the option.
    – slhck
    Jun 28, 2018 at 15:59

The key was using the vsync option like this:

ffmpeg.exe -i .\ballon.mp4 -enc_time_base 1:120 -vsync vfr .\ballon-120.mp4

  • 1
    I don't recommend this. Encoder time base is used by some encoders, like x264, to modulate rate-control. Even with the same set of frames, the encode will produce a different bitrate. Significant issue for longer videos.
    – Gyan
    Jun 28, 2018 at 16:36
  • @Gyan Interesting. Do you habe resources to recommend on why it does that? Just curious.
    – John
    Jun 28, 2018 at 16:51
  • 1
    Codecs like x264.. take human perception into account. A longer a frame is shown, the greater bits it is rationed. The encoder timebase is used to infer frame durations.
    – Gyan
    Jun 29, 2018 at 17:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.