[FFmpeg-user] concatenating mp4 (non-h464) using mpegts

Konrad Karl kk_konrad at gmx.at
Fri Apr 6 16:32:13 CEST 2012

On Fri, Apr 06, 2012 at 11:38:05AM +0000, Carl Eugen Hoyos wrote:
> Konrad Karl <kk_konrad <at> gmx.at> writes:
> > > Stream copying ASP into a transport stream is not supported, 
> > > this is a very old feature request.
> > > (And yes, it is a bug imo that FFmpeg does not show an error message 
> > > if you try something unsupported.)
> > 
> > Thanks for clarifying. Is this technically difficult or not allowed
> > by some spec?
> It seems highly unlikely that it is not allowed, given that 
> ffmpeg -i input -vcodec mpeg4 -an out.ts 
> works fine afair.

OK, it took me a few seconds to realize that this will reencode...

Concatenating mp4 files seems to be a minefield. My clips
really have different video and audio track lengths. The
values displayed by MP4Box (now recompiled and working also for
 > 2GB files) seem to be quite accurate. I am getting the same
values when I extract video only or audio only and then look
with ffmpeg -i.

Because MP4Box seems to just blindly concatenate the video
and audio without taking the different lengths into account
the resulting video has quite severe A/V desync at the end.
(sum_of_audio_lengths = sum_of_video_lengths + about 0.8 sec)

The only method which works for me so far is ffmpeg remuxing into mkv
then using mkvmerge and finally ffmpeg remuxing into mp4 again.


> > So what procedure would you recommend?

actually I was looking for a more convenient procedure to
cat my movies w/o losing A/V sync and w/o re-encoding.

> Assuming you mean the missing feature, not the bug:
> Send a patch?

I feel I am too close to the beginning of my learning curve regarding mpeg
and I guess I will have to google a lot before even beginning to think how
to implement such a patch. The problem space seems to be interesting, though...

> (I will probably create an entry on trac myself, if I forget, 
> please remind me in a few days.)

Will remind you.

Thanks, Carl Eugen,


> Carl Eugen

More information about the ffmpeg-user mailing list