Extract Audio from Y4M to J2B — Free Online Tool

Extract audio from Y4M (YUV4MPEG2) video files and save it as J2B, the ASYLUM Music Format-based audio used by Jazz Jackrabbit 2. The conversion uses the LAME MP3 encoder (libmp3lame) at 128k bitrate to produce a J2B-compatible audio stream from your uncompressed Y4M source.

FFmpeg Command

Copy this command to run the same conversion locally with FFmpeg on your desktop. Download FFmpeg

Free — no uploads, no signups. Your files never leave your browser.

Estimated output:

Conversion Complete!

Download

How It Works

Y4M is a raw, uncompressed video format commonly used as an intermediate in lossless video pipelines — it stores video frames in YUV colorspace with no video compression whatsoever, and critically, it carries no audio stream by design. This means the 'extraction' step here is more precisely a generation of a new audio output: FFmpeg discards the raw video frames entirely with -vn, then encodes whatever audio is piped or muxed alongside the Y4M input using libmp3lame into an MP3-based bitstream, which is then written into the J2B container structure used by Jazz Jackrabbit 2. Because Y4M files do not natively carry audio, this workflow is most relevant when Y4M is used in a pipeline where audio is injected separately, or when converting a source that has been wrapped in Y4M format alongside an audio track.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg binary — the open-source multimedia processing engine that powers this conversion both on the desktop command line and in the browser via FFmpeg.wasm (WebAssembly).
-i input.y4m Specifies the input file: a Y4M (YUV4MPEG2) raw video file. FFmpeg reads the uncompressed frame data and any associated audio stream from this container before processing.
-vn Disables video output entirely, telling FFmpeg to ignore all raw YUV video frames from the Y4M source. Since J2B is an audio-only format, this ensures no video stream is written to the output.
-c:a libmp3lame Sets the audio encoder to libmp3lame, the LAME MP3 encoding library. This produces an MP3-encoded audio bitstream, which is the codec used by the J2B format's audio data layer.
-b:a 128k Sets the MP3 audio bitrate to 128 kilobits per second — the default constant bitrate for J2B output. You can increase this to 256k or 320k for better fidelity, or reduce to 64k for smaller file sizes.
output.j2b Specifies the output filename with the .j2b extension. FFmpeg uses this extension to select the J2B muxer, which wraps the libmp3lame-encoded MP3 stream in the Jazz Jackrabbit 2 audio container header.

Common Use Cases

  • Extracting audio from a Y4M intermediate file produced during a lossless video editing pipeline where audio was muxed alongside the raw frames for synchronization purposes.
  • Game modding workflows for Jazz Jackrabbit 2 where a developer has a Y4M video source and needs to produce a J2B music file for use in custom game levels.
  • Converting a Y4M file used in an FFmpeg piping chain — where the output includes an audio track — into a standalone J2B audio asset for retro game audio archives.
  • Archiving or recreating Jazz Jackrabbit 2 audio assets from raw video sources captured during gameplay recording sessions that were saved in Y4M format by a screen capture tool.
  • Testing and debugging FFmpeg audio codec pipelines by isolating the libmp3lame encoding step and confirming the J2B output is valid before integrating into a larger game asset build process.

Frequently Asked Questions

Standard Y4M (YUV4MPEG2) does not include an audio stream in its specification — it is a video-only format designed for raw frame data. If your Y4M file was generated by a tool that muxed audio alongside it outside the spec, FFmpeg may detect that audio track, but in most cases a Y4M file will contain no audio to extract. If you attempt this conversion on a standard Y4M file with no audio, the output J2B file will be empty or invalid.
J2B is a proprietary audio container used by Jazz Jackrabbit 2, wrapping the ASYLUM Music Format (AMF) in a simple header. However, genuine JJ2 music files contain tracker/module music data — not MP3 streams. FFmpeg's J2B output writes a libmp3lame-encoded MP3 bitstream into a J2B-labeled container, which may not be directly compatible with Jazz Jackrabbit 2's audio engine without additional processing or a custom loader. This tool is most useful for producing J2B-structured files in contexts where the container label matters more than strict game engine compatibility.
Replace the value after -b:a in the command with your desired bitrate. Supported options are 64k, 128k, 192k, 256k, or 320k — for example, use '-b:a 320k' for the highest quality MP3 output, or '-b:a 64k' for a smaller file size. Higher bitrates produce better audio fidelity but larger J2B files: at 128k (the default), a one-minute audio track produces roughly 960KB.
Y4M files themselves are very large due to being uncompressed raw video, but the J2B output size depends only on the audio duration and the -b:a bitrate setting, not the size of the Y4M input. A large J2B output is typically the result of a long audio track duration. At 128k bitrate, expect roughly 1MB per minute of audio. If your Y4M source had no audio, the J2B output will instead be near-empty or contain only a file header.
Yes, on the command line you can use a shell loop to process multiple files. On Linux or macOS: 'for f in *.y4m; do ffmpeg -i "$f" -vn -c:a libmp3lame -b:a 128k "${f%.y4m}.j2b"; done'. On Windows (PowerShell): 'Get-ChildItem *.y4m | ForEach-Object { ffmpeg -i $_.FullName -vn -c:a libmp3lame -b:a 128k ($_.BaseName + ".j2b") }'. The browser-based tool processes one file at a time.
The J2B format uses libmp3lame to encode audio as MP3, which is a lossy codec — so yes, there is generational quality loss from whatever the source audio was. However, Y4M itself does not store audio with any inherent quality level, so the quality of the output J2B depends entirely on the quality of the audio stream present in your Y4M source and the -b:a bitrate you select. At 128k MP3, most listeners will not notice artifacts on standard music or voice content; choose 320k if fidelity is critical.

Technical Notes

Y4M (YUV4MPEG2) is fundamentally a video-only format with no defined audio container specification, which makes this conversion an edge case. FFmpeg can process Y4M files that have been non-standardly muxed with audio by external tools, but any Y4M file produced by standard encoders (such as x264 piping output or rawvideo workflows) will contain no audio track, making the -vn flag redundant but harmless. The J2B output uses libmp3lame, which is the gold-standard open-source MP3 encoder — the resulting audio stream is standard MP3 at the specified constant bitrate (-b:a 128k by default). The J2B container itself is minimal: a small header wraps the audio data, and FFmpeg writes this container correctly, but strict compatibility with Jazz Jackrabbit 2's native audio engine is not guaranteed since the game expects ASYLUM module data rather than MP3. No metadata from the Y4M source (frame rate, colorspace, resolution) is preserved in the J2B output, as J2B is a pure audio format with no video metadata fields.

Related Tools