Timeline for How to concatenate two MP4 files using FFmpeg?
Current License: CC BY-SA 4.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 3, 2021 at 13:46 | comment | added | Josh | This did not keep the audio when I tried this command | |
S Jun 11, 2020 at 11:22 | history | suggested | Erman Kadir Kahraman | CC BY-SA 4.0 |
edit for code readability
|
Jun 11, 2020 at 3:29 | review | Suggested edits | |||
S Jun 11, 2020 at 11:22 | |||||
May 5, 2020 at 11:22 | comment | added | Donn Felker |
I had to add the protocol white list for file and pipe on OSX. Here's what worked for me: ls file1.mp4 file2.mp4 | perl -ne 'print "file $_"' | ffmpeg -f concat -safe 0 -protocol_whitelist "file,pipe" -i - -c copy output.mp4
|
|
Dec 5, 2018 at 17:21 | history | edited | Cœur | CC BY-SA 4.0 |
dog's bollocks are proscribed
|
Dec 2, 2018 at 11:11 | comment | added | phils |
A lot of perl and such being bandied about, when you can just do this: printf "file '%s'\n" Movie_Part_*.mp4
|
|
Oct 5, 2017 at 17:08 | comment | added | Bensge |
I had to add this parameter to ffmpeg to make it work: -protocol_whitelist file,tcp,http,pipe
|
|
Jan 26, 2017 at 1:33 | comment | added | smg |
I did something like this to handle movies with spaces in their paths: echo -e "file '/home/some dir/video_1.mkv'\nfile '/home/some dir/video_2.mkv'" | ffmpeg -f concat -i - -c copy 'output.mkv'
|
|
Dec 30, 2016 at 23:41 | comment | added | Evan |
In Windows CMD I used this: ls *mp4 | sed "s/\(*mp4\)/file \1/" | ffmpeg -f concat -i - -c:v copy output.mp4
|
|
Dec 2, 2016 at 14:14 | comment | added | erik |
On Linux I used this oneliner: ffmpeg -safe 0 -f concat -i <(find . -type f -name '*' -printf "file '$PWD/%p'\n" | sort) -c copy output.mkv (mkv accepts more codecs than mp4, but you could also try it with mp4). The -safe 0 is for recent ffmpeg versions complaining about Unsafe file name, and the -type f is for only listing files. I added | sort to sort the files alphabetically; because find reads them in order as saved on filesystem. Works also for files with whitespaces.
|
|
Jan 25, 2016 at 18:54 | comment | added | Nate Beaty |
You can also just do ls * | perl -ne 'print "file $_"' | ffmpeg -f concat -i - -c copy Movie_Joined.mp4 if your files are well-named and in order. Worked great for me on OS X, exactly what I wanted.
|
|
Jan 28, 2015 at 15:35 | comment | added | Thomas Bachem |
With proper escaping for files containing whitespace:ls Movie_Part_1.mp4 Movie_Part_2.mp4 | perl -ne '$_ =~ s/\n$//; print "file '"'"'$_'"'"'\n"' | ffmpeg -f concat -i - -c copy Movie_Joined.mp4
|
|
Mar 27, 2014 at 12:44 | history | answered | cnd | CC BY-SA 3.0 |