Convert Y4M to AVI — Free Online Tool
Convert Y4M (YUV4MPEG2) uncompressed video files to AVI format using H.264 encoding via libx264 with MP3 audio support. Y4M is a raw, lossless intermediate format commonly output by video processing pipelines — this tool compresses it into a widely compatible AVI container while preserving visual quality at a configurable CRF level.
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 files store raw, uncompressed YUV pixel data with no inter-frame compression, making them enormous but perfectly lossless. During this conversion, FFmpeg reads each raw frame and encodes it using the libx264 H.264 encoder at CRF 23 — a perceptually transparent quality level for most content. Since Y4M carries no audio stream (it is a video-only format), no audio transcoding occurs; the output AVI will contain only the H.264 video track encoded with libmp3lame at 128k as a placeholder for potential audio. The result is a dramatically smaller file that retains excellent visual fidelity, wrapped in the AVI container using interleaved audio/video structure for broad legacy compatibility.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg binary, the open-source multimedia processing engine that handles all decoding, encoding, and container operations for this Y4M to AVI conversion. |
-i input.y4m
|
Specifies the input Y4M file. FFmpeg automatically detects the YUV4MPEG2 format and reads the per-frame headers to determine resolution, framerate, and chroma subsampling from the raw uncompressed stream. |
-c:v libx264
|
Selects the libx264 encoder to compress the raw YUV frames from the Y4M source into H.264 video, transforming the uncompressed data into a highly compressed stream suitable for storage inside the AVI container. |
-c:a libmp3lame
|
Selects the LAME MP3 encoder for any audio stream. Since Y4M contains no audio, this flag is effectively a precautionary default that ensures the AVI output uses MP3 if audio is ever present in the pipeline. |
-crf 23
|
Sets the Constant Rate Factor for the H.264 encoder to 23, the libx264 default. This controls the quality-to-size tradeoff when compressing the lossless Y4M frames — lower values (e.g., 10) preserve more detail from the raw source at the cost of larger file size. |
-b:a 128k
|
Sets the MP3 audio bitrate to 128 kilobits per second, a standard quality level for stereo audio. This parameter is included for completeness but has no effect on Y4M conversions since Y4M carries no audio data. |
output.avi
|
Defines the output filename and tells FFmpeg to wrap the encoded H.264 video stream in the AVI container format, enabling playback in legacy media players and compatibility with older video editing software. |
Common Use Cases
- Compressing the raw Y4M output from video synthesis tools like Avisynth or VapourSynth into a shareable AVI file for editors who work in legacy Windows-based workflows
- Archiving the lossless Y4M intermediate produced by a film grain or color grading pipeline into a smaller H.264-encoded AVI for client review without sending multi-gigabyte raw files
- Converting Y4M test sequences used in codec benchmarking or video quality research into AVI files for playback on media players that do not support raw Y4M
- Packaging raw Y4M output from open-source transcoding tools (such as x264 piping workflows) into AVI format for compatibility with older video editing software that requires AVI input
- Reducing Y4M files captured from screen recording or animation rendering pipelines to manageable AVI sizes for upload to platforms or sharing via email
- Preparing Y4M reference video sequences for distribution to colleagues using Windows systems where AVI remains a familiar and universally supported container
Frequently Asked Questions
Yes, this conversion introduces lossy compression because libx264 at CRF 23 is a perceptually lossy encoder, whereas Y4M stores raw uncompressed pixel data. However, CRF 23 is widely considered visually transparent for most content — meaning the loss is generally imperceptible to the human eye. If you need to preserve maximum fidelity, you can lower the CRF value (e.g., CRF 10 or CRF 0 for lossless H.264), though this significantly increases file size.
Y4M stores every frame as raw, uncompressed YUV data with no inter-frame prediction or spatial compression whatsoever. A single minute of 1080p Y4M video can exceed several gigabytes. H.264 inside AVI uses motion compensation, DCT transforms, and entropy coding to discard redundant information between and within frames, typically achieving 50x to 200x size reductions compared to raw Y4M while maintaining good visual quality.
Y4M (YUV4MPEG2) is a video-only format and does not support audio streams at all. As a result, the output AVI produced by this conversion will not contain any audio track, even though AVI supports multiple audio tracks. If you need audio in your final AVI file, you will need to supply a separate audio source and merge it using FFmpeg's -i flag for a second input alongside your Y4M file.
AVI is specifically useful for workflows targeting legacy software, older hardware media players, or Windows-based editing environments that predate MP4 adoption. AVI with H.264 (also called H.264 in AVI) is supported by many older non-linear editing systems and standalone DVD players with USB playback. If your target environment supports MP4 or MKV, those containers offer better feature support such as chapters, subtitles, and more efficient streaming.
Adjust the -crf value in the command to control H.264 quality. CRF ranges from 0 (mathematically lossless) to 51 (extremely low quality), with 23 as the default. Lower numbers produce better quality and larger files — for high-fidelity output from a lossless Y4M source, values between 10 and 18 are commonly used. For example, replace '-crf 23' with '-crf 15' in the command: ffmpeg -i input.y4m -c:v libx264 -c:a libmp3lame -crf 15 -b:a 128k output.avi
Yes. On Linux or macOS, use a shell loop: for f in *.y4m; do ffmpeg -i "$f" -c:v libx264 -c:a libmp3lame -crf 23 -b:a 128k "${f%.y4m}.avi"; done. On Windows Command Prompt, use: for %f in (*.y4m) do ffmpeg -i "%f" -c:v libx264 -c:a libmp3lame -crf 23 -b:a 128k "%~nf.avi". The browser-based tool processes one file at a time, so the FFmpeg command is especially valuable for bulk processing large Y4M datasets locally.
Technical Notes
Y4M files encode pixel data in planar YUV colorspaces (commonly yuv420p, yuv422p, or yuv444p) with explicit header metadata per frame specifying resolution, framerate, and chroma subsampling. When encoding to H.264 via libx264, FFmpeg will automatically handle colorspace compatibility — yuv420p is natively supported and the most common case. If your Y4M source uses yuv422p or yuv444p, libx264 can encode these with the -profile:v high422 or high444 flags, but standard AVI players may not decode these profiles correctly, so downsampling to yuv420p using -vf format=yuv420p is advisable for maximum compatibility. The AVI container imposes a 2GB file size limit in its standard form (though OpenDML extensions allow larger files, not all players respect this). For very long Y4M sequences at high resolutions, output file size should be monitored. AVI does not support variable frame rate video, so Y4M sources with irregular timestamps may need -vsync cfr added to the command. Metadata embedded in the Y4M header (frame rate, aspect ratio) is read by FFmpeg and carried into the AVI container's stream headers accurately.