Reply 40 of 40, by svenseebeck
Big thanks for the script! Here’s my contribution to help others. Feedback welcome!
BIN/CUE to ISO/CUE converter v1.11, supports: FLAC,MP3,OGG,OPUS
Copyright (c) 2020–2026 by Akuma and contributors under GNU General Public License 2.0
Features:
* Converts BIN/CUE to ISO/WAV
* Encodes WAV to FLAC,MP3,OGG,OPUS
* Presets and user presets
* Per-track presets via preset file
* Parallel encoding
* Writes a new CUE sheet
* Skips existing files
* Checks if dependencies are installed
* CD-ROM dumping via cdrdao (stable, production-ready)
* Custom target folder names
* Source file deletion
* CD-ROM ejection
* Log file control
* No-subfolder mode
* Debug output
Note: toc2cue output is now fully compatible with bchunk
Step 1. The script converts BIN/CUE to ISO/WAV using bchunk.
Files are placed in a newly created folder named after the
CUE file. For /my/games/mygame.cue the folder will be:
/my/games/mygame/
The bchunk process is logged to:
/my/games/mygame/bchunk.log
Step 2. All WAV files are encoded in parallel using the chosen
preset or preset file. Encoded files are placed in a subfolder
named after the preset:
/my/games/mygame/<preset>/trackXX.<codec> (XX=02-99)
The encoding process is logged to:
/my/games/mygame/<preset>/trackXX.log
Step 3. A new CUE sheet is written for the encoded files.
Index times are recalculated where needed.
The CUE file is written to:
/my/games/mygame/<preset>/cdrom.cue
Step 4. A DOSBox BAT file is written for convenience:
/my/games/mygame/<preset>/cdrom.bat
Usage:
dbx-conv [-f] [-s] [-E] [-N] [-L] [--no-logfiles-force]
[-d] [--delete-force] [-e] [--eject-force]
[-t <name>] [--debug]
<cue/cdrom> <preset/file> [options]
-f : force overwrite existing files
-s : swap byte order in audio tracks (bchunk)
-E : treat missing audio tracks as error
-N : no preset subfolders, output directly to workdir
-t : override base folder name
-L : remove logfiles on success
--no-logfiles-force : never keep logfiles
-d : delete source bin/cue/toc on success
--delete-force : delete source files always
-e : eject cdrom device after success
--eject-force : eject cdrom device always
--debug : enable debug output
Presets:
Default presets : flac, mp3, ogg, opus
Advanced presets : <codec>_<type>_<complexity>_<channels>
types : music, speech, filler
complexity : simple, moderate, complex
channels : mono, stereo
FLAC only : flac_max
Custom options : dbx-conv myfile.cue mp3 -b 192
Preset file : dbx-conv myfile.cue myfile.preset
Preset file format:
<preset>=<tracknumbers>
# comment
Track numbers can be specified as:
default : applies preset to all audio tracks (2-last)
N : single track number
N M ... : multiple track numbers separated by spaces
N-M : range of tracks (inclusive)
eg:
opus_music_moderate_stereo=default
mp3_speech_simple_mono=19-61
ogg_music_moderate_mono=21
opus_music_complex_stereo=20 23 27
Exit Codes:
100 : wrong usage / missing arguments
101 : file not found
102 : unknown preset
103 : input already in ISO format
104 : no audio tracks found in CUE
105 : multiple FILE entries in CUE (merge first)
106 : required dependency not found
107 : encoding failed (see track log)
108 : cdrom.bin already exists
109 : cdrdao failed to image CD-ROM
110 : toc2cue failed to convert TOC to CUE
111 : track number out of range in preset file
112 : unknown preset in preset file
113 : failed to delete source files
114 : insufficient permissions to eject/unmount
115 : device is busy (cannot eject/unmount)
116 : cannot unmount (device busy)
117 : -e/--eject requires a device, not a cue file
118 : -N/--no-subfolder requires a single-codec preset file
119 : target files already exist, use -f to overwrite
History:
2026-04-08 1.11 Added new features, bugfixes
2026-04-06 1.10 Bugfixes
2020-11-02 1.09 Completely rewritten
2020-10-27 1.08 Added presets file *not released*
2020-10-25 1.07 Implemented parallel encoding + bugfixes
2020-10-22 1.06 First public release version
Changelog:
1.11 Added: -t/--target, --debug, -d/--delete, -e/--eject, -N/--no-subfolder
Added: --delete-force, --eject-force, --no-logfiles-force
Fixed: Multi-codec preset file handling
Improved: Error messages and exit codes
Stabilized: cdrdao support (production-ready)
1.10 Fixed: Encoding failed on first run
Fixed: Handling of .bin-path in .cue-File
Fixed: support bugfixes of cdrdao
Fixed: encoding exit status not evaluated for background processes
Fixed: checkapp() used exit code 104 instead of 106
Fixed: compress() used wrong exit code 112 instead of 107
Fixed: queue() re-declared local variables, clearing codec and options
Fixed: exit code 130 in queue_presetfile() replaced with 111
Fixed: IFS not restored on encoding error in compress()
Fixed: checkfile/checkapp overwrote global $file variable (missing local)
Fixed: parallel wait() could miss exit status of background processes
1.09 Fixed: Completely rewritten (to use a queue)
Added: cdrdao support *buggy*
Added: cdrom.preset file with:
|- multi codec support
|- multi preset support
`- per track support
1.08 Added: presets file, customizable by user
Fixed: commandline options
Added: (suggestions by krcroft)
|- Bash strict-mode
|- Mono option for mono audio to save diskspace
|- Speech option (Jones in the Fast Lane only has voices)
|- variable-bit-rate encodings as a default
`- filler option (unused space at lowest bitrate and in mono)
1.07 Added: (suggestions by krcroft)
|- Bash strict-mode without 'u'
|- Removed unneeded usage text brackets
|- Options in usage elaborated
|- Renamed 'track.cue' to 'cdrom.cue'
|- Parallel Encoding
|- Double-bracket tests
`- FLAC seekpoints to reduce CPU load
1.06 Fixed: Recalculation defaults to octal instead of decimal
1.05 Added: Index time recalculation
1.04 Added: Parsing CUE sheet instead of generating it
1.03 Added: Set basename to fixed "track" instead of dynamic
1.02 Added: CTRL-C trap and resume
1.01 Added: Codec support for OGG/FLAC/OPUS
1.00 Draft: Initial draft with MP3 and BCHUNK
Dependencies:
* bin/cue to iso/wav : bchunk, sox (for byte-swapping)
* cd-rom dumping : cdrdao, toc2cue
* cd-rom ejection : eject
* flac encoder : flac
* mp3 encoder : lame
* opus encoder : opus-tools
* ogg encoder : vorbis-tools
Authors:
- Akuma <Akuma>
- krcroft <krcroft>
- Sven Seebeck <code@svenseebeck.de>