[Ffmpeg-devel] Question : mpegts and MAX_SCAN_PACKETS

jason jason
Tue Feb 7 14:09:11 CET 2006


I have a http stream that takes a long time (> 30 seconds) to initialize
in ffmpeg (cvs as of about a week ago).

I have tracked it down to the following :

In libavformat/mpegts.c MAX_SCAN_PACKETS is set to 32000, which it
suggests will support a 1.0 second scan on a 24Mbit/s file.

My stream is only 3Mbit/s, so that works out at about 7 seconds.

The scan itself is done in the method handle_packets()

If I am following the code correctly, the scan may be performed several
times if the first time fails, leading to a long initialisation time for
my stream.

If I drop the #define MAX_SCAN_PACKETS down to a low value (say, 320),
then my stream starts very quickly with no problems.

My thought is to make this value modifiable, rather than a #define - is
that a reasonable thing to do, and if so, could someone give me a quick
primer on the correct way to implement it in ffmpeg? I'll send a patch!


More information about the ffmpeg-devel mailing list