How to merge video files with ffmpeg
Hi,
I am trying to merge some video files together. All videos share the same attributes i.e video resolution, bitrates and etc... I did this with mencoder and it did quite well. I want to know if ffmpeg is capable of doing it as well. I've tried these codes thus far Code:
cat *.mp4 | ffmpeg -i - -vcodec copy -acodec copy -y out.mp4 Code:
cat *.mp4 | ffmpeg -i pipe:0 -vcodec copy -acodec copy -y out.mp4 Thanks for any help or suggestions PS: I am using ffmpeg version 0.7.8 |
As far as I know the syntax in your first example is correct, as I've had to do this once before in the past. However, I'm in the same predicament as you because now its doing the same thing to me. I've resorted to avidemux as it appends files flawlessly, depending on the codec and container.
Sorry that really doesn't answer your question :confused:, but I'm really curious about the answer as well. |
Or you can add them like this for an example:
Code:
# cat orig1.mpg orig2.mpg | ffmpeg -f mpeg -i - -vcodec copy -acodec copy merged.mpg |
@ strungoutfan78
I know what you mean. Ffmpeg is always changing and it sometimes break thigs that worked before. @ Satyaveer Arya The code you gave me works surprisingly with mpg files. Don't know why it wouldn't work with mp4 files :scratch: I think I stick with mencoder when merging files and use ffmpeg for other tasks. These two programs are powerful yet they seem to have some limitations when doing certain tasks. Thanks to both of you for the replies. |
What other way you tried to merge the mp4 files?
|
I found something interesting at Stack Overflow (link) after doing a quick Google search. Maybe give it a try and see what happens, as I have no videos to merge at the moment. Pay careful attention to the "newaudio" and "newvideo" portion.
Quick disclaimer: The link is about a year old, so no guarantees it's current. Quote:
|
Quote:
To test the code you gave me I converted two mp4 files to mpg files and then use ffmpeg to merge the mpgs files together and it work. The only bad thing is I have to convert the mp4 files to mpg files before using the ffmpeg command to merge them. With mencoder I don't have to do that. They are both great commands and I use them both exclusively when working with media files, but each have their ways of doing things that don't work the same way. |
@ strungoutfan78
Didn't work |
Well, I tried to edit my last post rather than add a new one, but LQ is being obstinate right now, so here it goes.
Again, I know this only provides a workaround rather than a solution, but have you tried using MP4Box? Should be available in the repos, at least it's in the Debian repos. It's written specifically for handling mp4 files in a similar fashion to what you may be familiar with using mencoder or ffmpeg. The syntax gets a little clunky, but it works. |
@ strungoutfan78
I heard of MP4Box but don't use it as much. I use mostly ffmpeg and mecoder and to some degree HandBrake. Anyway, I've already merge the mp4 files with mencoder and it did a good job. Have a good night all |
GrepAwkSed,
MP4Box is also good to merge two mp4 files directly but for that first you have to install GPAC. You can download the GPAC from here: http://gpac.wp.mines-telecom.fr/downloads/ And check this link also: http://www.molotovbliss.com/combine-...box-and-ffmpeg Good Luck! |
Quote:
|
Good to know that the things worked out for you. Have a nice day! :)
|
All times are GMT -5. The time now is 03:59 AM. |