[Ffmpeg-devel] [Ffmpeg-devel-old] SVCD bug

Colin Ward lists
Thu Feb 2 08:32:08 CET 2006

M?ns Rullg?rd wrote:


> A simple solution might be to attempt reading any file starting with lots of
> zeros as MPEG.  I don't know of any other format that allows this.

   It *is* quite a mystery to me why anyone would want to pad the start 
of a file with 64 or so kilobytes of zeros!

   I looked into getting libavformat to scan more than 2048 bytes worth 
of data at the start of the file and now all of my VCDs work.  However, 
I ran into some issues that we may want to look into.

   1) Merely changing libavformat/utils.c::PROBE_BUF_SIZE to be larger 
than 2048 bytes was not enough because in 
libavformat/mpeg.c::mpegps_probe() is the following line:

   int size= FFMIN(20, p->buf_size);

   Which means that even though PROBE_BUF_SIZE is passed in in 
p->buf_size then only the first 20 bytes get scanned anyway.  I had to 
change the code to scan p->buf_size before it would work.

   Plus as an added bonus, when av_open_input_file() first calls this 
function it will set p->buf_size to zero anyway, causing this function 
to only scan the first zero bytes!

   2) After I got it to work I thought that it would be better to pass 
in a buffer size to av_open_input_file() rather than to hack the 
PROBE_BUF_SIZE #define.  The 4th parameter of av_open_input_file() is 
described as:

   buf_size optional buffer size (zero if default is OK)

   However, if I pass this in then it is not used for the initial call 
to  av_probe_input_format() (PROBE_BUF_SIZE is used for this) but only 
for the second call, when the first one fails.  Is there a reason for 
this that I am missing?

>>    I need to learn a bit more about MPEG 1/2/4, VCDs and DVDs.  Any
>> suggestions of a good book that covers these on a file format level?
> MPEG1: ISO 11172-1 system, -2 video, -3 audio
> MPEG2: ISO 13818-1 PS/TS, -2 video, -3 audio, -7 AAC
> MPEG4: ISO 14496-1 QT-like format, -2 video, -3 ACC, -10 AVC, -14 more format
>        stuff, save your sanity and leave this to Mike
> VCD: White Book, apparently MPEG with some added junk
> SVCD: no official standard, MPEG2 video, presumably with added junk
> DVD: the spec is yours for $5000, some useful information at
>      http://dvd.sourceforge.net/dvdinfo/

   Thanks, this is a good start.  :-)

[Hitman/Code HQ - 6502/z80/68000/604e/80x86/ARM coder - Amiga rulez!]
[VZ-200/VIC-20/MZ-700/c16/c64*10/c128*8/Plus-4/CPC464/CD32/500*2    ]
[600/1000/1200*2/A4000/SNES/N64/Dreamcast/Athlon 1100/AmigaOne      ]
[Assembly Language: The most fun you can have with your clothes on! ]

More information about the ffmpeg-devel mailing list