[Ffmpeg-devel] CDXA bug in libavformat

Allan Sandfeld Jensen kde
Tue Aug 15 14:56:17 CEST 2006


I am using libavformat in a new decoding library called avkode, but I've 
encountered a problem, basically libavformat can't recognize most CDXA MPEGs.

The problem have previously been discussed here in january in the "SVCD bug" 
thread, but I couldn't see any conclusion, so I would like to add my own 

CDXA files are MPEG-PS with a some crap prepended. The crap varies from 
40bytes to 64kbytes(!)

The "crap" is however easy to skip and parse as it consist of CDXA blocks that 
are exactly 2352 bytes long. In all files I've seen either 0 or 30 CDXA 
blocks preceding the MPEG stream. Each CDXA block has a 24 byte header that 
starts with 00 ff ff ff ff ff ff ff ff ff ff 00 and then 12 bytes of other 
stuff. The blocks that precede the MPEG data are for the rest of the block 
pure zeros.

To find the mpeg streams I've scanned the first upto 32 CDXA blocks looking at 
bytes 24-28  in each block, which are "00 00 01 ba" when the MPEG starts 
and "00 00 00 00" for skipable crap. The problem though is that the current 
probing system in libavformat only tests the first 2048 bytes, which is just 
not enough.

What I am wondering though is if it would be possible to create a thin CDXA 
input format that didn't need to find the MPEG stream to initialize itself?


More information about the ffmpeg-devel mailing list