Convert Y4M to HEVC — Free Online Tool

Convert Y4M (YUV4MPEG2) lossless uncompressed video to HEVC/H.265 using libx265 — dramatically reducing file size while retaining excellent visual quality. Y4M files are enormous by nature, making H.265's superior compression ratio an ideal target for archiving or distributing raw video pipeline output.

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 headerless, fully uncompressed video format that stores raw YUV planar pixel data frame-by-frame — no compression whatsoever. Converting to HEVC involves a full encode of every frame through the libx265 encoder, which applies inter-frame and intra-frame prediction, transform coding, and entropy encoding to achieve compression ratios that can be 100x to 1000x smaller than the original Y4M file. The default CRF value of 28 produces visually near-transparent quality at a fraction of the size. Because Y4M carries no audio track, the output HEVC file will also be video-only. The raw YUV color data from the Y4M source is fed directly into the encoder, so there is no intermediate color space conversion overhead — what you shot or rendered is what gets compressed.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg binary — the open-source multimedia processing engine that handles the Y4M decoding and HEVC encoding pipeline.
-i input.y4m Specifies the input Y4M file. FFmpeg automatically detects the YUV4MPEG2 format and reads the uncompressed raw video frames and chroma subsampling layout from the file header.
-c:v libx265 Selects libx265 as the video encoder, which implements the HEVC/H.265 standard. This is what performs the actual compression of the raw Y4M pixel data into a compact, delivery-ready bitstream.
-crf 28 Sets the Constant Rate Factor to 28, controlling the quality-to-filesize tradeoff for the libx265 encode. CRF 28 is the libx265 default — lower values (e.g., 18) produce higher quality and larger files, while higher values (e.g., 35) produce smaller files with more visible compression artifacts.
-x265-params log-level=error Passes the log-level=error parameter directly to the libx265 encoder, suppressing its per-frame verbose output and only surfacing actual encoding errors. This keeps the console output clean without affecting the encoded video in any way.
output.hevc Specifies the output file as a raw HEVC bitstream. The .hevc extension signals FFmpeg to write a bare H.265 bitstream without any container wrapper — useful for piping or further processing, though a .mp4 extension would produce a more universally playable file.

Common Use Cases

  • Archiving the output of a video processing pipeline (e.g., from tools like vapoursynth or avisynth) that exports Y4M before long-term storage, replacing multi-gigabyte raw files with compact H.265 archives.
  • Compressing Y4M test sequences used in codec benchmarking or video quality research so they can be shared or stored without consuming terabytes of disk space.
  • Delivering Y4M render output from FFmpeg filter graphs or color grading tools to clients or collaborators who need a standard, widely-supported compressed format.
  • Reducing the size of Y4M files produced by screen capture or synthetic video generators (e.g., test pattern generators) before uploading to video platforms that accept HEVC.
  • Converting lossless intermediate Y4M files from animation or VFX pipelines to H.265 for efficient streaming or web playback while preserving as much visual fidelity as possible.
  • Producing a compressed reference copy of a Y4M source file to verify encode quality against the original uncompressed frames during post-production QC.

Frequently Asked Questions

The size reduction is dramatic. A Y4M file stores every pixel of every frame uncompressed, so a single minute of 1080p at 24fps can easily exceed 10GB. With the default CRF 28 setting, libx265 can compress that same content to 50–200MB depending on motion complexity — a reduction of 50x to 200x or more. The exact ratio depends on how much motion and detail is in the video, since H.265 exploits temporal redundancy between frames.
Yes, at the default CRF 28 this is a lossy encode — some pixel-level information from the uncompressed Y4M source is permanently discarded. However, CRF 28 with libx265 is generally considered visually transparent for most content, meaning the quality loss is imperceptible to the human eye on normal viewing. If you need lossless HEVC output, you can change the CRF to 0 in the FFmpeg command, which forces libx265 into lossless mode at the cost of a much larger output file.
Y4M is a video-only format — it does not support embedding audio streams. Because there is no audio in the source file, the output HEVC file will also be video-only. If you need a final deliverable with audio, you would need to add an audio source using FFmpeg's -i flag for a second input and map both streams to a container that supports audio alongside HEVC, such as MP4 or MKV.
The libx265 encoder is notoriously verbose by default, printing detailed per-frame encoding statistics to the console that can clutter logs or slow down browser-based tools. The -x265-params log-level=error flag suppresses all of that output except actual error messages. You can safely remove it if you want to see the full encoder output — for example, to monitor encoding speed, bitrate, and PSNR statistics while running the command locally on your desktop.
Change the -crf value to control the quality-to-size tradeoff. For libx265, CRF ranges from 0 (lossless) to 51 (worst quality). Lower values produce higher quality and larger files — CRF 18–20 is considered visually lossless for most content, while CRF 23–28 is a good balance for archiving. For example: ffmpeg -i input.y4m -c:v libx265 -crf 18 -x265-params log-level=error output.hevc would produce a noticeably higher-quality encode than the default.
Yes. On Linux or macOS you can run a shell loop: for f in *.y4m; do ffmpeg -i "$f" -c:v libx265 -crf 28 -x265-params log-level=error "${f%.y4m}.hevc"; done. On Windows Command Prompt: for %f in (*.y4m) do ffmpeg -i "%f" -c:v libx265 -crf 28 -x265-params log-level=error "%~nf.hevc". This is particularly useful when processing multiple Y4M files exported from a render pipeline.

Technical Notes

Y4M files encode raw YUV planar data — typically YUV 4:2:0, 4:2:2, or 4:4:4 — with a minimal ASCII header per frame. libx265 can accept all of these chroma subsampling formats and will encode them accordingly, though 4:2:0 is the default and most compatible profile. The HEVC output from this command is a raw bitstream file (.hevc), not wrapped in a container like MP4 or MKV, which means some media players may not open it directly — for broader compatibility, consider changing the output to output.mp4. The libx265 encoder defaults to the 'medium' preset, which balances encoding speed and compression efficiency; adding -preset slow or -preset veryslow will improve compression at the cost of significantly longer encode times, which can be worthwhile given that the source is already lossless. Because Y4M contains no metadata, timestamps, chapters, or subtitles, none of these are lost in the conversion — the Y4M source simply doesn't carry them. HDR metadata (HDR10, HLG) is not present in standard Y4M files, so the HEVC output will be standard dynamic range unless you explicitly inject HDR metadata via -x265-params during encoding.

Related Tools