200k views
3 votes
How to concatenate two or more videos with different framerates in FFMpeg?

1 Answer

5 votes

Final answer:

To concatenate videos with different framerates using FFmpeg, you must first re-encode them to a common framerate and then use the FFmpeg concat demuxer to combine them into one file.

Step-by-step explanation:

To concatenate two or more videos with different framerates using FFmpeg, you must first normalize their framerates. This can be done by re-encoding the videos to have the same framerate. Here's how to do it step by step:

  1. First, re-encode each video to the desired common framerate using the -r option to set the framerate. For example: ffmpeg -i input1.mp4 -r 30 output1_30fps.mp4.
  2. After you have all your videos at the same framerate, create a text file listing all the video files you want to concatenate. This file should have content in the form of file 'output1_30fps.mp4' on separate lines for each video.
  3. Use the FFmpeg concat demuxer to concatenate the videos listed in your text file. The command looks like: ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_final.mp4, where mylist.txt is the text file with the video file paths.

By following these steps, FFmpeg will concatenate the videos seamlessly because they now share a common framerate, preventing any playback issues that might arise from differing framerates.

User Jullie
by
7.8k points