How to Transcode Commodore 64 SID Files with FFmpeg
Transcoding vintage Commodore 64 SID files into modern formats like
MP3, WAV, or FLAC allows you to listen to classic chiptunes on modern
media players. This guide provides step-by-step instructions on
converting .sid files using FFmpeg, including how to verify
your build's decoder support, execute the conversion command, handle
multi-track subtunes, and manage playback duration.
1. Verify FFmpeg SID Support
Before converting, confirm that your FFmpeg installation includes support for SID files. Run the following command in your terminal or command prompt:
ffmpeg -demuxers | grep -i sidIf your build supports SID files, it will list the demuxer. Many
standard distributions of FFmpeg include support for vintage game music
formats via internal decoders or external libraries such as
libgme. If no output appears, you may need to install an
FFmpeg build configured with vintage audio support.
2. Basic Transcoding Command
To transcode a .sid file to an uncompressed WAV or a
compressed MP3 file, specify the input file with -i and
provide the desired output filename with its extension.
Convert to WAV:
ffmpeg -i input.sid output.wavConvert to High-Quality MP3:
ffmpeg -i input.sid -c:a libmp3lame -q:a 0 output.mp3Convert to FLAC (Lossless):
ffmpeg -i input.sid -c:a flac output.flac3. Setting Song Duration
Unlike standard digital audio files, SID files are executable machine code programs that generate sound dynamically via the MOS Technology 6581/8580 SID chip. Consequently, many SID tracks loop indefinitely and lack fixed end times.
To prevent the transcoder from running endlessly, define an explicit
duration using the -t flag:
ffmpeg -i input.sid -t 00:03:30 -c:a libmp3lame -q:a 2 output.mp3In this example, -t 00:03:30 stops encoding after three
minutes and thirty seconds.
4. Selecting Specific Subtunes
A single .sid file often contains multiple songs or
sound effects (referred to as subtunes). FFmpeg typically exposes these
subtunes as separate audio streams.
To inspect how many subtunes are present, examine the file's streams:
ffmpeg -i input.sidIdentify the stream corresponding to the desired track (e.g.,
0:0, 0:1, etc.), and map that specific stream
using the -map option:
ffmpeg -i input.sid -map 0:1 -t 02:45 output_track2.mp3This command selects the second stream (track 2) and records it for two minutes and forty-five seconds.
5. Setting Sample Rate and Channels
The original Commodore 64 SID chip generated mono output, though modern decoders often apply stereo effects or emulation filtering. To ensure broad compatibility across devices, specify the audio sampling rate and channel count explicitly:
ffmpeg -i input.sid -ar 44100 -ac 2 -t 03:00 output.wav-ar 44100: Resamples the audio to 44.1 kHz (standard CD quality).-ac 2: Outputs stereo audio (or duplicates mono into two channels).