[Ffmpeg-devel] avformat/mpegts reads too much data for lowbitratestreams

Måns Rullgård mru
Thu Jun 9 12:20:35 CEST 2005

Fabrice Bellard <fabrice at bellard.org> writes:

> M?ns Rullg?rd wrote:
>> Sergio Garcia Murillo <sgm254 at tid.es> writes:
>>>> I've been using libavformat/codec in an application in the works
>>>> for some time now, and one of the quirks I have come across is
>>>> that the mpegts format reader is searching across WAY too many
>>>> packets (MAX_SCAN_PACKETS) for a dvb specific service description
>>>> table. This table is not required in the mpeg ts format, and is
>>>> wrecking havock on my application when trying to tune a radio
>>>> service without this service table. As a temporary workaround I've
>>>> disabled the scan for sdt in mpegts_read_header. Without this
>>>> workaround, the live stream that is to be decoded is delayed
>>>> anywhere from 5-10 seconds before packets starts to arrive for
>>>> decoding..
>>> I have the same problem, i was decoding an mpeg2 ts encoded with
>>> AVS at 200kbs and it never got played until i removed the
>>> handle_packets call. Don't know if there is a better way of
>>> resolving the problem or not.
>> If nobody objects soon I'll just go ahead and remove the SDT parsing,
>> or at least make the search a bit less annoying.
> I suggest that you keep the SDT parsing but that you look for it only
> in the first N bytes of the stream (where N is for example 4KB).

A couple of DVB samples I checked repeat the SDT every 2 seconds.  If
we want to be sure to catch it, it will be necessary to keep looking
for a few seconds.  If the stream is in fact not DVB, this will impose
an annoying delay.  Limiting the search by size is not ideal, either,
the better solution being a time-limited search, as determined by PCR
values.  This is of course more complex.

M?ns Rullg?rd
mru at inprovide.com

More information about the ffmpeg-devel mailing list