How can I use ffmpeg to concatenate a video and a timelapse?

I build one project recently and want to concatenate two input videos and timelapse into one. Can someone help me to perform this task?

1 Like

To concatenate a video and a timelapse using ffmpeg, you can use the concat demuxer. Here’s an example of how you can do it:

  1. Create a text file called list.txt that contains the paths to your video and timelapse, one file per line. The order of the files in this list determines the order in which they will be concatenated. For example:

file '/path/to/video.mp4'
file '/path/to/timelapse.mp4'

  1. Use the ffmpeg command to concatenate the files, using the concat demuxer and the list.txt file you created.

ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4This will create a new file called output.mp4 that contains the concatenated video and timelapse.

You can also, merge multiple videos into one using fluent-FFmpeg.

1 Like

Thanks !

What if the video and timelapse have different codecs or resolutions?

1 Like

Then, you may need to use different options in the ffmpeg command to ensure that the output file plays correctly.
For example, you can use the -vcodec and -acodec options to specify the video and audio codecs, and the -s option to specify the resolution.

Follow if you have missed the keyframe to add.

1 Like