Convert Y4M to FLAC — Free Online Tool
Convert Y4M (YUV4MPEG2) video files to FLAC audio by extracting and losslessly encoding any embedded audio stream. Since Y4M is a raw, uncompressed intermediate format primarily used in video pipelines, this tool isolates its audio content and encodes it with FLAC's lossless compression — preserving every audio sample while dramatically reducing file size.
to
FFmpeg Command
Copy this command to run the same conversion locally with FFmpeg on your desktop. Download FFmpeg
Drop your Y4M file here
or click to browse
Free — no uploads, no signups. Your files never leave your browser.
Settings
Note: Browser-based encoding uses approximate quality targets. For precise CRF compression, copy the FFmpeg command above and run it on your desktop.
Estimated output:
Conversion Complete!
DownloadHow It Works
Y4M is a raw, uncompressed video container used as an intermediate format in professional video pipelines — it stores uncompressed YUV video frames and, if present, an accompanying uncompressed audio stream. During this conversion, FFmpeg reads the Y4M file, discards the raw video frames entirely, and encodes the uncompressed audio stream using the FLAC codec at compression level 5. FLAC is a lossless codec, meaning no audio data is altered or discarded — the waveform is bit-for-bit identical to the source. The output file is a standalone FLAC audio file, far smaller than the original Y4M due to FLAC's efficient lossless compression, and playable on virtually any audio player or platform.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg command-line tool, which handles all the reading, stream selection, encoding, and writing in this conversion pipeline. |
-i input.y4m
|
Specifies the input Y4M file. FFmpeg reads the YUV4MPEG2 container, identifying both the raw uncompressed video stream and any audio stream present in the file. |
-c:a flac
|
Instructs FFmpeg to encode the audio stream using the FLAC (Free Lossless Audio Codec) encoder. Since FLAC is a lossless codec and Y4M audio is typically raw PCM, this encodes without any loss of audio data. |
-compression_level 5
|
Sets the FLAC compression effort to level 5 on a scale of 0–8. This controls encode speed and output file size only — audio quality is identical at all levels since FLAC is always lossless. Level 5 is the standard default used by most FLAC encoders and provides a good balance between file size and encoding time. |
output.flac
|
Defines the output filename. The .flac extension tells FFmpeg to write a standalone FLAC audio file, which will contain only the encoded audio stream — the raw video frames from the Y4M source are automatically discarded since FLAC is an audio-only format. |
Common Use Cases
- Extracting a lossless audio track from a Y4M file produced by a video synthesis or compositing tool like Blender or VapourSynth for separate audio mastering.
- Archiving the audio component of a Y4M intermediate file in a compact, universally supported lossless format before discarding the large raw video file.
- Pulling clean, uncompressed-origin audio from a Y4M file generated during a video encoding pipeline to use as a reference track for quality comparisons.
- Converting a Y4M file's audio to FLAC for ingestion into a Digital Audio Workstation (DAW) that prefers FLAC over raw PCM or container formats like MKV.
- Separating audio from a Y4M test clip used in codec benchmarking or video quality analysis workflows to evaluate audio independently.
- Creating a lossless FLAC archive of the audio from a Y4M file produced by tools like FFmpeg pipe chains or AviSynth scripts before the intermediate file is deleted.
Frequently Asked Questions
Y4M (YUV4MPEG2) is primarily a raw video format, and many Y4M files contain only video with no audio stream at all. However, the format specification does allow for an accompanying audio stream, which some tools include when generating Y4M files. If your Y4M file has no audio track, this conversion will produce an empty or invalid FLAC file. You can check whether your Y4M file contains audio by running 'ffprobe input.y4m' before converting.
Yes, completely. Both Y4M's audio and FLAC are lossless — the source audio in a Y4M file is typically stored as raw, uncompressed PCM, and FLAC encodes it without any loss of information. Every audio sample is preserved exactly. FLAC simply applies lossless compression to reduce the file size, similar to how a ZIP file compresses data without altering it. When decoded, the FLAC output will be bit-for-bit identical to the original audio.
You can change the compression level by modifying the '-compression_level' value in the command from 0 to 8 — for example, 'ffmpeg -i input.y4m -c:a flac -compression_level 8 output.flac'. Critically, changing this value does NOT affect audio quality in any way, since FLAC is always lossless regardless of compression level. Higher values (like 8) produce slightly smaller files but take longer to encode; lower values (like 0 or 1) encode faster with marginally larger file sizes. The default of 5 is a well-balanced midpoint used by most FLAC encoders.
Y4M stores raw, uncompressed YUV video frames, which is extraordinarily space-inefficient — a few seconds of Y4M video can occupy gigabytes. The FLAC output file only contains the audio stream (no video), and that audio is losslessly compressed by FLAC. Even a full-length audio track encoded as FLAC will typically be a tiny fraction of the size of the Y4M source, because you're removing the massive uncompressed video data entirely and compressing what remains.
The single-file command shown works for one file at a time, but you can batch process multiple Y4M files using a shell loop. On Linux or macOS, run: 'for f in *.y4m; do ffmpeg -i "$f" -c:a flac -compression_level 5 "${f%.y4m}.flac"; done'. On Windows PowerShell, use: 'Get-ChildItem *.y4m | ForEach-Object { ffmpeg -i $_.FullName -c:a flac -compression_level 5 ($_.BaseName + ".flac") }'. This processes each Y4M file in the current directory and saves a matching FLAC file.
Y4M has extremely limited metadata support — the format header contains only basic technical parameters like frame rate, pixel format, and interlacing, with no fields for tags like artist, title, or album. FLAC, by contrast, supports rich Vorbis Comment metadata tags. Since Y4M carries no standard audio metadata to transfer, the output FLAC file will contain no embedded tags. If you need to add metadata to the FLAC file, you can use a tag editor like MusicBrainz Picard or beets after the conversion.
Technical Notes
Y4M's audio stream, when present, is typically stored as raw PCM — often 16-bit or 24-bit signed integer samples — making it a perfect lossless source for FLAC encoding. FLAC supports PCM audio up to 32-bit depth and sample rates up to 655,350 Hz, so it can faithfully represent any audio found in a Y4M file without any downsampling or bit-depth reduction. One important limitation to be aware of: Y4M does not natively support multiple audio tracks, so there is no risk of losing a secondary audio stream. However, if your Y4M file contains no audio at all (which is common for Y4M files used purely as video pipe intermediates), FFmpeg will throw an 'Output file does not contain any stream' error and produce no valid output. Always verify your Y4M file contains an audio stream with ffprobe before attempting this conversion. The resulting FLAC file supports features the Y4M format never offered for audio: seekable playback, ReplayGain tags for volume normalization, and cue sheet embedding — making it far more suitable for long-term audio archival than leaving audio embedded in a raw Y4M container.