[MPlayer-dev-eng] Total duration of a MPEG2 TS Stream

Guillaume POIRIER poirierg at gmail.com
Thu Mar 2 11:24:09 CET 2006


Hi Nico,

On 3/2/06, Nico Sabbi <nsabbi at email.it> wrote:
> yj wrote:
> > Hi,
> > I meet a problem about how to determine the total
> > duration of a MPEG2 TS Stream.
> > Any ideas on this issue?
> > Thank you and best regards.
> >
> >
>
> in theory you can approximate it determining, for every stream, the
> average bitrate
> in terms of the delta_space / delta_pts (keeping track of timers reset);
> unfortunately you still have to scan the whole TS, because streams can
> appear midway.
> If your TS is very simple (e.g.  only one video stream) the above method
> works.

While I'm at it, here's my experience with MPEG muxing with MEncoder:

Some time ago (about 6 month), I tried to remux a MPEG file (I think
it was a PS, not TS, but does it make a difference?), in order to get
the timestamps correct and be able to reliably jump from one part of
the movie to the other, as well as get the full duration of the movie.
Unfortunately, I was getting lots of warning (buffer underflow and
stuff like that), which didn't seem to indicate that what I was doing
was right, and the A/V sync was off, so I didn't push further my
invertigations with MPlayer's MPEG muxer.

Later on, I tried lavf muxer, and it worked a lot better: no spam and
correct A/V sync.

Since then (about 1-2 weeks ago), I've used lavf MPEG in order to
extract a 2000 frames sample from the middle of a movie, which worked,
but left the audio out.
If I was remuxing the whole movie, the audio was not left out.

I don't know if those problems are known by you Nico (they certainly
are), but I figured that it's better to talk now than stay silent.

Guillaume
--
Reinventing the wheel certainly is annoying, but as long as all other
wheels are square...

Reimar Döffinger




More information about the MPlayer-dev-eng mailing list