Skip to content

hcs64/cdg-decode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cdg-decode

This is a simple CD+G and CD+EG decoder with some oddities for my own use.

Usage

cdg-decode disc.img disc.cdg disc.toc out.raw out.apng start_track end_track mode

Input

  • disc.img is the audio data (16-bit stereo) for the CD in a single file disc image, part of this will be copied out to out.raw.

  • disc.cdg is a single file with all the CD+G data, decoded and in logical pack order, as would be output by redumper-extract-rw.

  • disc.toc is the table of contents from the disc, as recorded by redumper.

  • start_track end_track the first and last tracks to include in the output, inclusive (e.g. 3 3 to only output track 3).

    Note: Decoding will start at index 1 of start_track. If the graphics were encoded assuming playback proceeds from the previous track, there may be unwanted artifacts such as flashing.

  • mode (optional) selects the graphics mode, cdg for CD+G (ignoring the EG commands), cdeg for CD+EG. For a non-EG disc this should have no effect. This is optional, if missing it will default to CD+G mode.

Output

If the output files exist already they will not be overwritten and the conversion will fail.

  • out.raw is the audio data, this is just a range copied from disc.img
  • out.apng is the decoded video as a 25 FPS APNG

Color

Colors are currently converted with a .5 bias then scaled by 16, instead of being scaled to a full 8 bit range (x17) as in some other decoders. This may be a mistake.

mp4 encode

My usual workflow is to feed the output into ffmpeg, using the recommended encoding specs for streaming mp4 on the Internet Archive:

ffmpeg -r 25 -i out.apng -f s16le -ar 44100 -ac 2 -i out.raw -vcodec libx264 -vf "format=yuv420p" -movflags +faststart out.mp4

With 2x scale (to reduce artifacts from subsampling, useful with sharp pixel art):

ffmpeg -r 25 -i out.apng -f s16le -ar 44100 -ac 2 -i out.raw -vcodec libx264 -vf "scale=624:432:flags=neighbor,format=yuv420p" -movflags +faststart out-2x.mp4

About

CD+G and CD+EG decoder

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages