[FFmpeg-user] How can I join video files?

Peter B. pb at das-werkstatt.com
Thu Feb 16 09:32:24 CET 2012

Zitat von John Saturday <stozher at gmail.com>:

> Hello, please add this example to FAQ "How can I join video files?"
> <http://ffmpeg.org/faq.html#How-can-I-join-video-files_003f>.
> Concatenate two MKV, MP4 files with H264 video stream:
> ffmpeg -i file-01.mkv -f mpegts -c copy -bsf:v h264_mp4toannexb  
> file-01.mpeg.ts
> ffmpeg -i file-02.mkv -f mpegts -c copy -bsf:v h264_mp4toannexb  
> file-02.mpeg.ts
> ffmpeg -isync -i "concat:file-01.mpeg.ts|file-02.mpeg.ts" -f matroska
> -c copy output.mkv

If I read this example correctly, it is necessary to transcode the  
to-be-joined files to an MPEG transport stream, and  
"concat:file-01.mpeg.ts|file-02.mpeg.ts" is equivalent to:

"cat file-01.mpeg.ts file-01.mpeg.ts > full_length.mpeg.ts"


If so, does this mean that FFmpeg is not able to concat arbitrary  
input formats?
Is this now somehow possible with FFmpeg?

I'm asking, because in our video-archive system, we're joining  
hundreds of files (cut in minutes) each day: FFv1 AVIs as source. For  
archiving purposes. Therefore, losing a single bit (e.g. using MPEG as  
intermediate step) is not an option.

I'm currently using mencoder for that. And it's doing a great job:  
frame *and* audio-sample precise.


More information about the ffmpeg-user mailing list