How to concatenate two videos using FFmpeg?
Вставка
- Опубліковано 5 жов 2024
- In this video I explained with example how to concatinate or merge multiple videos into one video with avalable options like using existing encoding or re-encoding.
Watch the full video and feel free to put your query / feedback about the video. More helpful contents are on the way
ffmpeg concatenate videos,ffmpeg concatenate mp4,ffmpeg concatenate mov files,ffmpeg concatenate videos side by side,ffmpeg concatenate images to video,ffmpeg concatenate video files,ffmpeg concatenate avi,ffmpeg merge audio and video,ffmpeg concatenate different codecs,ffmpeg concatenate mp3,ffmpeg concatenate mkv,ffmpeg concatenate mp3 files,ffmpeg concatenate two videos,ffmpeg merge two videos,ffmpeg concatenate without re encoding,ffmpeg concatenate 2 videos
I've never used ffmpeg before, but this tutorial is brilliant. Nice and easy to follow compared to other videos that are unnecessarily complicated!
thank you so much ♥️
Thank you so much! great tutorial, exactly what I needed to know.
thank you so much for saying that
Hi, congratulations for the simplicity in describing the process of concatenating even different videos.
A question...
I have two 360° videos in mov format can I use the ffmpeg command or do I necessarily have to convert them to Mp4?
There are converters that when they convert from mov to mp4 make the video no longer 360.
thanks
Yes, you can
@@mzmnbd Can you write me the command line?
@@MicheleAlbano sorry about that. could you try using chat gpt?
I already follow ffmpeg -f concat -i drone-shots.txt -c copy output.mp4 but the result, sound of output video very slow, it not keep same with original sound.
i understand. can you check what is the codec and bitrate for audio in each file? if they are not same, then instead of copying codec, reencode the video, this should resolve the issue
Great video thank you!
Glad you liked it!
I get “non-monotonic dts” and even without -c the video doesn’t play correctly
Thanks for your comment! The 'non-monotonic dts' error can occur due to timestamp issues. Try adding '-fflags +genpts' before the input files in your ffmpeg command to fix it. Let me know if that helps!
how about doing this on google drive video files and merge it please make tutorial using google colab on it
nice question, but I have no idea on this, let me know if you find anything.
if i have 3 video files with the same codec, arguments, and extra arguments does it keep them in the output file
When concatenating multiple video files using FFmpeg, the codec, resolution, and other parameters of the input files must be consistent for the output file to be playable. If the input files all have the same codec and resolution, and you are using the same arguments and extra arguments for all the input files, then it is likely that the output file will be playable.
To concatenate multiple video files using FFmpeg, you can use the concat filter. The basic syntax is as follows:
ffmpeg -i file1.mp4 -i file2.mp4 -i file3.mp4 -filter_complex "[0:v][0:a][1:v][1:a][2:v][2:a]concat=n=3:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" output.mp4
This command will take 3 video files file1.mp4, file2.mp4 and file3.mp4 and concatenate them in to a single output file output.mp4.
In this command, n=3 specifies the number of input files to be concatenated, v=1 specifies that the video streams should be concatenated and a=1 specifies that the audio streams should be concatenated.
It's important to note that, if the input video files have different codecs, resolutions, or other parameters, FFmpeg will not be able to concatenate them directly. You would have to re-encode the input files to match the codec, resolution, and other parameters of one of the input files.
Also, when concatenating video files, it is important to ensure that the video and audio streams are correctly aligned so that the final output file is in sync.
Dada, What's the meaning of " -f" in this command ffmpeg -f concat -i drone-shots.txt -c copy output.mp4???
-f means flag, which is to concatenate in this scenario
thanks for being a regular watcher of my videos
How to use ffmpeg in server (cloud computing)
you can wrap it with other programming language or just run the command with a server side programming language
but i got output too much length 26:57:29
input file1 00:21:30
input file2 00:03:20 how to solve this error
It seems like the output duration is longer than expected. This might happen due to incorrect input durations or incorrect concatenation settings. Make sure the durations of your input files are accurately specified in the ffmpeg command. You can also try explicitly setting the output duration using the '-t' option followed by the desired duration. Let me know if you need further clarification!
brother.. how remove bg music, but keep voice in video music? code ffmpeg plase?
use splitter. ai
if make code ffmpeg brother?@@mzmnbd
thx
you are welcome