Results 1 to 5 of 5
I downloaded mp4 files from a TV show that have been segmented and I want to copy/concatenate them so that they are contiguous and continuous. I know how to do ...
- 05-16-2011 #1Just Joined!
- Join Date
- May 2011
- Posts
- 2
concatenate mp4 file
I downloaded mp4 files from a TV show that have been segmented and I want to copy/concatenate them so that they are contiguous and continuous. I know how to do this in DOS, and I have tried and failed to do this with cmdline Linux using "cat" i.e.
cat file1 file2 >> file3
the copy worked (file3 file size was the sum of all the files I was copying) but the displaying of the mp4 file terminated at the end of file1.
- 05-16-2011 #2
Indeed. The two files each have their own header information. I don't know exactly what the MP4 file format is, but I suspect that it contains a header with information on the length of the file. So file3 still had file1's header, which claimed to be as long as file1, so only file1's information was read.
I found this page:
Concatenate Video Files Using FFMPEG » Ulyssesonline
which describes the correct command to use:
Code:cat file1 file2 | ffmpeg -f mp4 -i - -vcodec copy -acodec copy file3
DISTRO=Arch
Registered Linux User #388732
- 05-16-2011 #3Just Joined!
- Join Date
- May 2011
- Posts
- 2
I installed ffmpeg and am working with the command. The output file was created, but still only processed the first file in the concat list.
I'm going to rtf the utility page and see if i can see what i'm doing wrong.
Thanks for your help in pointing me in the right direction!
- 05-17-2011 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
I wouldn't use cat to concatenate 2 mp4 files, but would use ffmpeg with two input parameters. It will happily transcode both and give you one resulting sum of the parts. So, try this:
Or you can just transcode them, such as generating DVD-compatible mpeg2 files with this:Code:ffmpeg -i file1.mp4 -i file2.mp4 -vcodec copy -sameq file3.mp4
Code:ffmpeg -i file1.mp4 -i file2.mp4 -target ntsc-dvd -sameq file3.mpg
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 05-18-2011 #5Just Joined!
- Join Date
- May 2011
- Posts
- 3
Nice one. I think that are concentrated in mp4 files. Thanks for your information.


Reply With Quote