Extract Audio from Y4M to FLAC — Free Online Tool

Extract audio from a Y4M (YUV4MPEG2) file and save it as a lossless FLAC file. Since Y4M is a raw, uncompressed intermediate format that rarely carries audio, this tool uses FFmpeg to strip the video stream entirely and encode any embedded audio track directly to FLAC with no quality loss.

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 container primarily used for piping video data between applications like encoders, filters, and processing tools — it has no native audio compression support and rarely contains audio at all. When a Y4M file does carry an audio stream (typically raw PCM), this conversion discards the video stream entirely using the -vn flag and re-encodes the audio using the FLAC codec at compression level 5. FLAC is a lossless format, meaning the audio waveform is bit-for-bit identical to the source — only the container and compression method change. The result is a standalone .flac file that is significantly smaller than raw PCM audio while retaining every detail of the original signal.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg command-line tool, which is also what runs under the hood in this browser tool via FFmpeg.wasm compiled to WebAssembly.
-i input.y4m Specifies the input Y4M file. FFmpeg reads the raw YUV4MPEG2 video stream and any accompanying audio stream from this file, identifying them before applying the output flags.
-vn Disables video output entirely, telling FFmpeg to ignore the raw video stream in the Y4M file. This is essential here because the goal is audio extraction — without this flag, FFmpeg would attempt to include the uncompressed video in the output, which FLAC cannot store.
-c:a flac Sets the audio codec to FLAC (Free Lossless Audio Codec). FFmpeg will encode the source audio stream — typically raw PCM from the Y4M file — into lossless FLAC compression, preserving every sample value exactly.
-compression_level 5 Sets the FLAC compression effort to level 5 on a scale of 0 to 8. This is FLAC's default and strikes a balance between encoding speed and output file size. All levels decode to identical audio — this only affects how aggressively the lossless compression algorithm works.
output.flac Specifies the output filename. The .flac extension tells FFmpeg to use the FLAC container format, which wraps the encoded lossless audio stream along with any metadata blocks supported by the format.

Common Use Cases

  • Recovering an audio track from a Y4M file produced by a video processing pipeline where the audio was embedded alongside raw video frames
  • Extracting reference audio from a Y4M intermediate file used during lossless video editing or transcoding, to archive the audio separately in a space-efficient lossless format
  • Isolating audio from a Y4M file generated by tools like ffmpeg piping or AviSynth/VapourSynth scripts that output raw video with embedded audio for further audio mastering
  • Archiving the audio component of a Y4M capture or test file in FLAC for long-term storage, since FLAC is a widely supported open standard compared to raw PCM
  • Separating audio from video before re-encoding only the video stream of a Y4M file, keeping the FLAC audio as the lossless source to mux back in later

Frequently Asked Questions

Standard Y4M (YUV4MPEG2) is primarily a raw video-only format and most implementations do not include audio. However, some extended or non-standard uses of Y4M piping workflows do embed raw PCM audio alongside the video frames. If your Y4M file has no audio stream, this tool will produce an empty or errored output — you can verify whether your file contains audio by running 'ffmpeg -i input.y4m' and checking the stream list.
No — this is a fully lossless conversion. Y4M files that carry audio typically store it as raw uncompressed PCM. FLAC compresses that PCM data using a lossless algorithm, meaning the decoded FLAC output is bit-for-bit identical to the original audio. You lose nothing in terms of fidelity; you only gain a smaller file size compared to raw PCM.
FLAC typically achieves a compression ratio of 40–60% reduction compared to raw PCM audio, depending on the complexity and dynamic range of the content. At the default compression level 5 used by this tool, you get a good balance between encoding speed and file size. A 100MB raw PCM audio track might compress down to roughly 40–60MB as FLAC, while remaining perfectly lossless.
Replace the '5' in '-compression_level 5' with any integer from 0 to 8. Level 0 encodes fastest with the least compression, while level 8 produces the smallest file but takes longer to encode. Crucially, all levels are lossless — the audio quality is identical at every compression level, only the file size and encoding speed differ. For archival use, level 8 is worth the extra time; for quick extraction, level 0 is fine.
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 flac -compression_level 5 "${f%.y4m}.flac"; done'. On Windows PowerShell: 'Get-ChildItem *.y4m | ForEach-Object { ffmpeg -i $_.Name -vn -c:a flac -compression_level 5 ($_.BaseName + ".flac") }'. The browser-based tool processes one file at a time, so the command-line approach is recommended for batch jobs.
Y4M has no standardized metadata tagging system — any metadata in the file is typically limited to basic video header information like frame rate and color space. If the audio stream inside the Y4M file carries raw PCM with no tags, the resulting FLAC file will also have no embedded tags. You can add FLAC metadata tags (artist, title, album, etc.) after extraction using tools like metaflac or any audio tag editor, since FLAC fully supports Vorbis Comment metadata blocks.

Technical Notes

Y4M is an uncompressed raw video format defined by the YUV4MPEG2 specification, and its audio support is non-standard — the format was designed for video piping between tools like x264, ffmpeg, and VapourSynth, not as a general-purpose multimedia container. As a result, Y4M files with audio are rare in practice, and the audio that does appear is almost always raw linear PCM. The FLAC codec used in the output is standardized by Xiph.Org and is one of the few lossless audio formats with genuinely broad hardware and software support — it is playable on most DAPs, smartphones, media players, and editing software. The -compression_level parameter in FFmpeg's FLAC encoder maps directly to FLAC's own compression presets (0–8) and affects only the entropy coding efficiency, not the decoded audio data. One known limitation: if the Y4M source has audio at an unusual sample rate or channel count, FLAC will faithfully preserve those values, but some consumer playback devices may not support non-standard configurations like 5.1 audio or 176.4kHz sample rates. For maximum compatibility, standard 44.1kHz or 48kHz stereo PCM source audio produces the most universally playable FLAC output.

Related Tools