In this article, I will show how to combine MP4 files, which I got from a digital camera, to a single MP4 file without re-encoding using FFMPEG on Windows 10.
Note: The MP4 files must have exactly the same codec and codec parameters in order to combine using this method.
Watch on YouTube
Step-by-step
- In this example, I want to combine MP4 files in the C:\Users\Linglom.com\Desktop\2016Y03M29D12H folder.
- Download FFMPEG:
- Open web browser to https://ffmpeg.zeranoe.com.
- Select Builds tab at top menu.
- Select download FFMPEG Static.
- When the download finishes, extract the file and open bin folder. You will see ffmpeg.exe which is the file that I will use to combine MP4 files. In this example, I will copy the file to my MP4 folder.
- Then, right-click Windows icon at bottom left and select Command Prompt.
Note: You can also press Windows + R keyboard shortcut and type cmd.exe to open command prompt window.
- On Command Prompt window, change path to the folder where you keep MP4 files.
- Next, you have to create a text file which has a list of MP4 files that you want to combine by type this command and press Enter.
(for %i in (*.mp4) do @echo file '%i') > mylist.txt
You will get mylist.txt in the folder. This file has a list of all MP4 files on this folder.
- Then, type this command to begin combine the files using FFMPEG.
ffmpeg -f concat -i mylist.txt -c copy output.mp4
The process should be fast because it’s just concatenate the files, not re-encoding. If there is no error message, you will get output.mp4 as a result in the folder.
Fantastic, I love your clear and exact step by step instructions. The video was to blurry to see what is actually being typed. I tried joining with HJSplit then AVIdemux and both had problems. I even tried ffmpeg with different concat instructions and syntax, but yours worked PERFECTLY. Thank You very much.
Merci pour ce tutoriel qui fonctionne parfaitement.
Après de multiples essais infructueux j’ai obtenu le résultat que je cherchais depuis longtemps.
Thank you
this worked for combining the video, but I lost the audio. is there a way to do it without losing audio?
CAN ANYONE HELP PLEASE???
I am trying to combine 90 small mp4 files.
I got all the steps right and obtained the text file in the folder.
However,when I run the command ” ffmpeg -f concat -i mylist.txt -c copy output.mp4 ” to combine the files, I get the below error message (note :1Border crossing into Israel – Allenby bridge.mp4 is the name of my first file)
[concat @ 0000021481a7a280] Unsafe file name ‘1Border crossing into Israel – Allenby bridge.mp4’
mylist.txt: Operation not permitted
Please I am not at all a tech savvy guy and for me to get here itself was a big achievement but I just want to accomplish this task.
Any help is much appreaciated
Success!!!!! I did it!!!
I guessed to remove the spaces in the file names.
However, one last question….some mp4 vids have been shot in Portrait mode while others in Landscape mode. When I stitched the files together,the output file retains the entire movie in the mode of the first clip, so some videos play inverted.
Is there anyway to retain the orientation of the screen during the combine????
I haven’t tried combining videos with different parameters. But I think this post may helps.
https://stackoverflow.com/questions/15335073/can-i-set-rotation-field-for-a-video-stream-with-ffmpeg
If it doesn’t help, you could try manually rotate some videos so that they have the same alignment as you want and combine them later.
I keep getting output.mp4: Permission denied
1386072. This may result in incorrect timestamps in the output file.
[mp4 @ 000001d83d1e18c0] Non-monotonous DTS in output stream 0:0; previous: 281386072, current: 95137231; changing to 281386073. This may result in incorrect timestamps in the output file.
[mp4 @ 000001d83d1e18c0] Non-monotonous DTS in output stream 0:0; previous: 281386073, current: 95138232; changing to 281386074. This may result in incorrect timestamps in the output file.
[mp4 @ 000001d83d1e18c0] Non-monotonous DTS in output stream 0:0; previous: 281386074, current: 95139233; changing to 281386075. This may result in incorrect timestamps in the output file.
[mp4 @ 000001d83d1e18c0] Non-monotonous DTS in output stream 0:0; previous: 281386075, current: 95140234; changing to 281386076. This may result in incorrect timestamps in the output file.
frame=95045 fps=6259 q=-1.0 Lsize= 598068kB time=01:06:04.20 bitrate=1235.9kbits/s speed= 261x
video:527705kB audio:67566kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.469713%
Whats this error ?Can somebody help me out here ?
To complicated, just use a basic batch script w/ wild cards lol If you did that you couldn’t have ALL these screen shots and make money w/ adds. Total waste of time.
It worked however caption/subtitle was removed from the video stream. Why?
Thanks, Perfect and exactly what I was looking for. Awesome job making simple instructions
@ Ralph Colbeck
FFMPEG just copies video and audio by default, just insert -map 0 before the -c copy and it maps all streams (subtitle, closed captions, etc) usethis line ffmpeg -f concat -i mylist.txt -map 0 -c copy output.mp4