Convert Y4M to WebM — Free Online Tool
Convert Y4M (YUV4MPEG2) uncompressed video files to WebM using the VP9 codec and Opus audio — ideal for publishing raw video pipeline output to the web with excellent compression efficiency. Y4M's raw YUV frames are encoded with libvpx-vp9's constant-quality mode, dramatically reducing file size while preserving visual fidelity for HTML5 streaming.
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 headerless, uncompressed video format that stores raw YUV pixel data frame-by-frame, making it extremely large but losslessly faithful — it's the lingua franca of tools like x264, FFmpeg pipes, and video encoders that exchange uncompressed frames. Converting to WebM means the raw YUV frames are fed directly into the VP9 encoder (libvpx-vp9), which applies inter-frame prediction, DCT-based compression, and entropy coding to reduce file size by orders of magnitude. Because Y4M carries no audio, the Opus audio stream in the output will simply be absent unless you supply a separate audio source. The output WebM file uses the Matroska-based container with VP9 video, which is natively playable in Chrome, Firefox, and Edge without plugins.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg command-line tool, which handles the demuxing of the Y4M container, decoding of raw YUV frames, VP9 encoding, and writing the WebM output. |
-i input.y4m
|
Specifies the input Y4M file. FFmpeg reads the YUV4MPEG2 header to determine the frame size, frame rate, and chroma subsampling, then streams the raw uncompressed frames into the VP9 encoder. |
-c:v libvpx-vp9
|
Selects the libvpx-vp9 encoder to compress the raw YUV frames from the Y4M source into VP9 video, the standard video codec for the WebM container and the format natively supported by all major modern browsers. |
-c:a libopus
|
Sets Opus as the audio codec for any audio streams present. Since Y4M carries no audio, this flag has no effect on a pure Y4M input but ensures correct encoding if a second audio input is added to the command. |
-crf 33
|
Sets the VP9 constant-quality level to 33, where lower values yield higher quality and larger files. This controls how aggressively the VP9 encoder quantizes the raw YUV data from the Y4M source; 33 is a balanced default for web delivery. |
-b:a 128k
|
Sets the Opus audio bitrate to 128 kbps. This is a standard setting for stereo web audio; it is ignored when the Y4M input has no audio track. |
-b:v 0
|
Disables the VP9 target video bitrate constraint, which is required for CRF mode to function correctly. Without this flag, libvpx-vp9 ignores the -crf value and uses a default fixed bitrate instead, defeating quality-based encoding. |
output.webm
|
Specifies the output filename and triggers FFmpeg to use the WebM/Matroska container format, which packages the VP9 video stream (and optionally Opus audio) into an open, royalty-free format optimized for HTML5 web playback. |
Common Use Cases
- Publishing the output of a lossless video processing pipeline (e.g., from AviSynth, VapourSynth, or ImageMagick frame sequences) to a website or video platform that requires WebM
- Compressing raw Y4M captures from screen recorders or broadcast capture cards into a web-distributable format without going through an intermediate lossy step
- Finalizing a compositing or color-grading workflow that outputs Y4M to a web-ready WebM file for client preview
- Converting Y4M test sequences used in codec research or video quality benchmarking into WebM for sharing results online
- Reducing enormous Y4M intermediate files — which can be gigabytes per second of video — into compact WebM files for archiving or delivery
- Generating VP9-encoded WebM files from uncompressed source material to take advantage of WebM's transparency (alpha channel) support for web overlays
Frequently Asked Questions
Yes — Y4M is a lossless uncompressed format, and VP9 in its default constant-quality mode (CRF 33) is a lossy codec. The conversion introduces compression artifacts, though at CRF 33 these are typically imperceptible for most content. If you need visually lossless output, you can lower the CRF value toward 0 in the FFmpeg command, though this significantly increases file size. VP9 does support a true lossless mode (-lossless 1), but this produces much larger files than a well-tuned lossy encode and loses WebM's streaming advantages.
Y4M stores every frame as raw, uncompressed YUV pixel data — a single second of 1080p30 Y4M video can exceed 150 MB. VP9 achieves compression ratios of 100:1 or more by exploiting temporal redundancy between frames and spatial redundancy within frames using block-based prediction and transform coding. A 1 GB Y4M file might compress to just 5–20 MB as WebM at CRF 33, depending on the motion and complexity of the content.
Y4M is a video-only format and carries no audio stream whatsoever. If your input Y4M has no audio track, FFmpeg will simply produce a WebM file with no audio stream, and the -c:a libopus and -b:a 128k flags are harmlessly ignored. The command is structured this way so that if you extend it to include a separate audio input (using a second -i flag), the Opus codec settings are already in place for that stream.
The -crf 33 flag controls quality in VP9's constant-quality mode — lower values mean higher quality and larger files, while higher values trade quality for smaller files. The valid range for VP9 CRF is 0 (lossless) to 63 (worst quality). For high-quality web video from a Y4M source, values between 18 and 28 are common. The -b:v 0 flag is essential and must be kept alongside -crf — it tells VP9 to use unconstrained bitrate in CRF mode rather than capping the output bitrate.
Yes. On Linux or macOS, you can run a shell loop: for f in *.y4m; do ffmpeg -i "$f" -c:v libvpx-vp9 -c:a libopus -crf 33 -b:a 128k -b:v 0 "${f%.y4m}.webm"; done. On Windows Command Prompt, use: for %f in (*.y4m) do ffmpeg -i "%f" -c:v libvpx-vp9 -c:a libopus -crf 33 -b:a 128k -b:v 0 "%~nf.webm". Be aware that VP9 encoding is computationally intensive, so batch jobs on large Y4M files can take considerable time.
Yes, VP9 supports 8-bit and 10-bit color depth, as well as 4:2:0, 4:2:2, and 4:4:4 chroma subsampling. However, FFmpeg's libvpx-vp9 implementation has some constraints — 4:4:4 and 10-bit profiles require explicit profile flags (-profile:v 1 for 4:2:2, -profile:v 2 for 10-bit 4:2:0, -profile:v 3 for 10-bit 4:2:2/4:4:4). If your Y4M source uses a non-standard chroma format, you may need to add a pixel format conversion or profile flag to ensure correct encoding.
Technical Notes
Y4M files embed color space metadata in their headers (e.g., Rec.709 or Rec.601 matrix, color range), and FFmpeg reads this to correctly tag the VP9 stream in the output WebM. However, if the Y4M header omits color space information — which some tools do — FFmpeg may default to Rec.601 limited range, which can cause subtle color shifts in the WebM output. Inspect your source with ffprobe and add explicit flags like -colorspace bt709 -color_range tv if needed. VP9 encoding in libvpx-vp9 is notably slower than codecs like H.264 (libx264), so Y4M files — which are already large by nature — can result in lengthy encode times. Using -row-mt 1 enables row-based multithreading in libvpx-vp9 and significantly improves speed on multi-core systems. WebM fully supports VP9's transparency (alpha channel) via a separate alpha plane, but Y4M does not carry alpha data, so transparency is not applicable in this conversion. The -b:v 0 flag is not optional boilerplate — omitting it causes libvpx-vp9 to ignore the CRF setting and fall back to a fixed bitrate mode, producing inconsistent quality results.