Extract Audio from Y4M to ALAC — Free Online Tool

Extract audio from a Y4M (YUV4MPEG2) file and save it as ALAC in an M4A container — Apple's lossless audio format. Because Y4M carries uncompressed raw video with no native audio compression, any audio stream is extracted and encoded with ALAC's lossless compression for perfect fidelity in Apple-native environments.

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 bare-bones, uncompressed video format most commonly produced by video processing pipelines, encoders like x264 in pipe mode, or tools like VirtualDub and AviSynth. It rarely contains audio, but when it does, the audio data is uncompressed PCM. This tool strips the raw video stream entirely using the -vn flag (video none), then encodes the audio into ALAC — Apple Lossless Audio Codec — wrapped in an MPEG-4 (.m4a) container. Because both the source audio (raw PCM) and ALAC are lossless, no audio quality is lost at any stage: ALAC simply applies lossless compression to reduce file size while preserving every sample exactly. The output is a fully lossless .m4a file natively recognized by iTunes, Apple Music, iOS, macOS, and any other Apple-ecosystem application.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg binary — the open-source multimedia processing engine that this browser-based tool runs as a WebAssembly (FFmpeg.wasm) build, executing entirely on your local machine without any server upload.
-i input.y4m Specifies the input file in Y4M (YUV4MPEG2) format. FFmpeg reads the plain-text Y4M header to determine frame rate, resolution, and color space, and detects any raw PCM audio stream embedded in the file.
-vn Disables video output entirely — this is the critical flag that makes this an audio extraction tool. Without it, FFmpeg would attempt to include the raw YUV video stream in the output M4A container, which would fail since M4A does not support raw video.
-c:a alac Sets the audio codec to ALAC (Apple Lossless Audio Codec). FFmpeg encodes the raw PCM audio from the Y4M source into ALAC's lossless compressed format, which is the only audio codec natively supported in the output M4A container.
-c:a alac A duplicate of the preceding -c:a alac flag — this is redundant and has no additional effect, as FFmpeg simply applies the last-specified value. The codec used is still ALAC. When running this command locally, you can safely omit this second instance.
output.m4a The output filename with the .m4a extension, which signals to FFmpeg to use the MPEG-4 audio container. This container is required for ALAC encoding and produces a file natively compatible with iTunes, Apple Music, iOS, and macOS without any plugins or conversion.

Common Use Cases

  • Extracting the audio track from a Y4M intermediate file produced during a video restoration or upscaling pipeline to archive a lossless reference copy of the soundtrack
  • Pulling audio from a Y4M file generated by AviSynth or VapourSynth scripts for use in Apple Logic Pro or GarageBand without any quality degradation
  • Converting a Y4M file's audio to ALAC for playback on an iPhone, iPad, or Apple TV, since those devices natively support .m4a/ALAC without transcoding
  • Archiving audio from Y4M test sequences or broadcast intermediate files in a compressed lossless format to save storage while keeping bit-perfect quality
  • Preparing a lossless audio track from a Y4M source for import into iTunes or Apple Music to maintain ALAC's lossless certification when syncing to Apple devices
  • Separating the audio component of a Y4M file produced by a raw video capture tool so it can be independently edited or mastered in a DAW that prefers the M4A container

Frequently Asked Questions

Y4M (YUV4MPEG2) was originally specified as a video-only format, and the vast majority of Y4M files you encounter in the wild contain no audio stream at all. However, some extended implementations and tools that use Y4M as a piping format do embed raw PCM audio alongside the video. If your Y4M file has no audio track, running this tool will produce an empty or invalid output — you can confirm whether audio is present by inspecting the file with FFmpeg's -i flag before converting.
No — this conversion is entirely lossless end-to-end. Any audio in a Y4M file is stored as uncompressed PCM, and ALAC is a mathematically lossless codec, meaning it reconstructs the exact original PCM samples when decoded. Every bit of audio data is preserved perfectly; ALAC only reduces the file size through lossless compression, not by discarding any information.
ALAC is natively stored in the MPEG-4 container, which uses the .m4a extension — that is simply the required wrapper for the ALAC codec. If you need a different lossless container, such as FLAC in an .flac file, you would need a different conversion tool. The .m4a/ALAC combination is specifically optimized for Apple ecosystem compatibility, including iTunes, Apple Music, and all Apple hardware devices.
Y4M files contain virtually no metadata infrastructure — the format header only stores basic video parameters like frame rate, width, height, and color space. There is no standardized metadata field for audio tags in Y4M. As a result, the output ALAC .m4a file will not inherit any tags from the source, but ALAC in the M4A container fully supports metadata tags (artist, album, title, etc.) that you can add afterward using a tool like iTunes, MusicBrainz Picard, or mp4tag.
The command shown converts a single file at a time, but you can adapt it for batch processing in a shell script. On Linux or macOS, use: for f in *.y4m; do ffmpeg -i "$f" -vn -c:a alac "${f%.y4m}.m4a"; done. On Windows with PowerShell, use: Get-ChildItem *.y4m | ForEach-Object { ffmpeg -i $_.FullName -vn -c:a alac ($_.BaseName + '.m4a') }. This is especially useful for processing large collections of Y4M test sequences or pipeline intermediates.
You are correct to notice this — the command as shown contains a redundant duplicate of the -c:a alac flag. FFmpeg processes flags sequentially and the second instance simply overwrites the first, so the actual encoding behavior is identical to specifying -c:a alac once. The output is still valid ALAC-encoded audio in an M4A container. If you are running this locally, you can safely remove the duplicate flag and use: ffmpeg -i input.y4m -vn -c:a alac output.m4a.

Technical Notes

Y4M files use a plain-text header followed by raw YUV frame data, making the format trivially parseable but extremely large on disk — a short clip can occupy gigabytes. Audio, when present, is appended as raw interleaved PCM samples. ALAC, by contrast, achieves typical compression ratios of 40–60% relative to raw PCM while guaranteeing bit-perfect reconstruction, making it a practical archival format for lossless audio. The MPEG-4 container (.m4a) used by ALAC supports chapter markers, which could be useful if you are archiving audio from segmented Y4M sources. One important limitation: Y4M supports only a single audio track (the format has no multi-stream concept), so there is no risk of accidentally discarding secondary audio streams. ALAC supports standard bit depths (16-bit and 24-bit) and sample rates up to 384 kHz, so any high-resolution audio captured alongside a Y4M video will be preserved without resampling. The -vn flag is essential here because FFmpeg would otherwise attempt to pass the raw YUV video stream to the M4A container, which does not support video, and the conversion would fail.

Related Tools