[FFmpeg-user] Use segment muxer and concat: protocol

Andrey Utkin andrey.krieger.utkin at gmail.com
Sun Feb 12 09:22:01 CET 2012


Hi.
I'm not a top dev of ffmpeg, but i have the answer for you that it is
not going to work.
I'm also trying to merge different mp4 video pieces together, on API
level, and didn't succeed yet.
I questioned my trouble on maillists recently:
http://ffmpeg.org/pipermail/libav-user/2012-February/001273.html
http://lists.libav.org/pipermail/libav-api/2012-February/000388.html

The fact is that 'concat' protocol joins data on protocol level, in
case of local files that's almost what concatenation in command line
with 'cat' command will happen. It works for e.g. mp3, but not for
mp4.
You (and me) need to join files on _packet_ or _frame_ level.
It is possible then to try copying AVPackets from all files to the
resulting file using libavformat API, but big chances are that this
will fail, especially if files are from different origins. (Although i
desperately need this to be sufficient in my case).
Decoding and re-encoding with copying AVFrames from all files to
resulting file, using avformat & avcodec API will surely succeed. I
don't see such tool existing in ffmpeg kit yet, but it'll be not
difficult to implement. It would be cleaner than advising to re-encode
to mpeg1, concatenate files, and re-encode again to desired format
(this ugly way is recommended by FAQ currently).

-- 
Andrey Utkin


More information about the ffmpeg-user mailing list