[FFmpeg-devel] CDG problems

Don Moir donmoir at comcast.net
Fri Apr 20 14:57:52 CEST 2012

I don't use ffmpeg for CDG files as I use my own code for them, but I thought I would try it with ffmpeg.

This is just a heads up and when I find the time to look into it more, I will open a ticket on it.

I used ffplay and ffmpeg in my own code to test with and got similiar results.

o - The play back is way to slow. In the brief time I looked at it, the timing of the packets seem correct and I think this is more of a player playback problem.

o - It doesn't pick up a matching mp3 file. This again could be looked at as a player playback problem and responsibility of the player to pick this up.

o - Seeking is wrong. I see that cdg code attempts to mark keyframes, but it misses some associated color changes and it screws the colors up. In my own code I don't bother with trying to mark keyframes, and just start from the beginning and recolor to the seek position. It does this optimally as a byte mask and is quite fast for even the largest cdg file. I started out trying to optimize on some kind of keyframe but it just wasn't worth it but in future I will probably add some keyframe management to it though.

It appears the cdg decoder tries to mark keyframes and then the default seek behavior is used. Would be better if it had it's own seek function. This is the primary reason I will stay with my own code for CDG files. Possibly CDG_LOADCOLORLOW(30) and CDG_LOADCOLORHIGH(31) need to be taken into account in keyframe calculation but I think there is probably more to it.

An example of bad seek behavior for CDG files:


Since I use my own CDG code it may be sometime before I get back to ffmpeg problems with CDG, like when I have nothing better to do :)

More information about the ffmpeg-devel mailing list