[FFmpeg-user] question about joining multiple video files
rhodri at kynesim.co.uk
Mon Jun 11 15:46:38 CEST 2012
On Sun, 10 Jun 2012 19:32:32 +0100, Alex Yelluas <ayelluas at gmail.com>
> Hello fellow ffmpeg users,
> I've been trying to figure out how to join multiple files, and finally
> found a solution that works, but it's not very clear to me.
[snip description of converting via transport streams.
> Why do i need to create the mpegts files?
> What specifically does mpegts provide that makes this possible?
> Why doesn't it work directly work from mp4? (i tried and it didn't work,
> files don't get concatenated, only the 1st file is present in the
Basically, concatenation is one of the things transport streams
were designed to make easy, while MP4s were designed to make
other things easy.
MP4 was designed as a file format, to make life straightforward
for video players. It contains information about how long the
movie is, and what file offsets to look up other information
at. This header information is in a single structured lump at
the start of the file, the logically useful place for it.
MPEG-2 Transport Streams were designed as a stream format, to
make life straightforward for set-top boxes. While it contains
some of the same information about what format the audio and
video streams are in as MP4, the header is relatively light
weight and is intended to be repeated at intervals in the
stream so STBs turning on can get their bearings quickly. There
is no length information -- a stream could be coming from a
security camera that is on indefinitely, for example -- but
a lot of timing info can be attached to the A/V packets.
When you concatenate a pair of transport streams, players
reading the stream know they have to expect new (repeated)
headers every now and then, which automatically sorts out
the start of the second movie. Concatenating a pair of
MP4s leaves you with a mass of data "beyond the end" of
the first movie that the player has no idea what to do
with, because a new header there isn't a legal part of
the file format.
More information about the ffmpeg-user