[FFmpeg-user] What is my problem with concat?

Tom Horsley horsley1953 at gmail.com
Tue May 7 20:27:43 CEST 2013


I've been working out how to do frame accurate (or
near enough) editing out of commercials from .mpg
files I download from my TiVo (which have no doubt
gone through all kinds of nonsense with cable
companies inserting commercials and wot not).

I finally found that using -ss after the input
file to seek by reading from the beginning of
the file to the commercial-free segment I want
to encode was the only reliable way to get each
segment to start where I want and have audio
properly in sync. (The process of finding the
timestamps is a different adventure :-).

I then do this to concatenate the individual
segments:

ffmpeg -f concat -i files.concat -c copy out.avi

That has been working flawlessly until a show I
recorded last night. If I play the individual segments
they are all properly synced, but after I concatenate
them, the audio goes out of sync at some point in the
resulting files.

If I do an ffprobe -show_streams on the individual
avi files, I see things like this:

video streams duration: 479.412267,483.683200,etc.
audio streams duration: 479.496000,483.720000,etc.

That seems like enough extra audio to get out
of sync if it is just cramming the video streams
and audio streams together.

Is that what is likely happening? Is there some way
to fix it?

Should I generate some uncompressed audio stream
that can be cut easily at any timestamp and re-encode
for compression only after everything is together in
one piece?

If anyone is interested in vast details about
the scripts I'm using you can find them at:

http://home.comcast.net/~tomhorsley/game/ffmpeg.html


More information about the ffmpeg-user mailing list