Convert Y4M to CAVS — Free Online Tool

Convert Y4M (YUV4MPEG2) lossless uncompressed video files to CAVS format using libx264 video encoding and AAC audio. This tool is particularly useful for encoding raw intermediate video from pipelines into the Chinese Audio Video Standard broadcast format directly in your browser.

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 files store raw, uncompressed YUV pixel data with no video encoding whatsoever — every frame is stored in full. During this conversion, FFmpeg reads those raw frames and encodes them using the libx264 encoder with a CRF value of 23, which applies lossy H.264-based compression to produce a CAVS-compatible output. Because Y4M typically carries no audio track, the AAC audio encoder is invoked but will produce an empty or absent audio stream unless you supply a Y4M file with audio data. The result is a dramatically smaller file — often hundreds of times smaller than the source — as the uncompressed pixel data is replaced by motion-compensated, transform-encoded video frames.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg binary, the open-source multimedia processing engine that performs all decoding, encoding, and muxing operations for this Y4M to CAVS conversion.
-i input.y4m Specifies the input Y4M file containing raw uncompressed YUV video frames. FFmpeg reads the Y4M header to determine frame resolution, chroma subsampling (typically 4:2:0), and frame rate before processing the raw pixel data.
-c:v libx264 Selects the libx264 encoder to compress the raw YUV frames from the Y4M source into H.264-compatible video suitable for wrapping in the CAVS container. This is the encoding step where all the compression work — motion estimation, DCT, entropy coding — takes place.
-c:a aac Sets the audio encoder to AAC for the CAVS output. Since Y4M files typically contain no audio, this encoder will effectively produce no audio track unless an audio stream is present in the source, but the flag is included to define the expected audio codec for the CAVS container.
-crf 23 Sets the Constant Rate Factor for libx264 to 23, which is the default quality level providing a balanced tradeoff between file size and visual fidelity. For Y4M lossless source content, lowering this value (e.g., to 18) will better preserve the original uncompressed quality at the cost of a larger output file.
-b:a 128k Sets the AAC audio bitrate to 128 kilobits per second. For Y4M sources that carry no audio, this has no practical effect on the output, but it defines the audio encoding target rate should any audio stream be present.
output.cavs Specifies the output filename with the .cavs extension, which tells FFmpeg to use the CAVS muxer to write the encoded H.264 video and AAC audio into a Chinese Audio Video Standard container file.

Common Use Cases

  • Encoding the output of a raw video processing pipeline (e.g., from tools like ffmpeg pipe or avisynth) into CAVS format for Chinese broadcast delivery
  • Compressing lossless Y4M intermediate files produced by video editing or compositing software into a distributable CAVS file for archiving
  • Converting uncompressed Y4M test sequences used in codec benchmarking into CAVS for quality comparison studies
  • Preparing raw video captures from scientific or industrial cameras stored as Y4M into CAVS for submission to Chinese media platforms or broadcasters
  • Reducing the storage footprint of large Y4M files generated during lossless post-production workflows by transcoding to CAVS for review copies
  • Encoding Y4M sequences exported from open-source video tools like MLT or Kdenlive into CAVS format for compatibility with Chinese digital broadcast infrastructure

Frequently Asked Questions

Yes. Y4M stores raw uncompressed video with no quality loss, while CAVS output here uses libx264 with CRF 23, which is a lossy encoding. The default CRF 23 produces good general-purpose quality, but it is not bit-for-bit identical to the source. If you need to minimize quality loss, lower the CRF value (e.g., CRF 10 or 0 for near-lossless), though this will significantly increase file size.
Y4M is completely uncompressed — a single second of 1080p video at 24fps can occupy hundreds of megabytes. The libx264 encoder used here applies motion estimation, DCT transforms, and entropy coding to reduce that data by orders of magnitude. A CRF 23 encode of typical content may result in a file 50 to 200 times smaller than the original Y4M, depending on the complexity and resolution of the video.
Standard Y4M files do not contain audio streams — the format is designed purely for raw video data interchange between applications. Because there is no audio in the source, the AAC audio encoder flag in the command will either produce no audio track or a silent one. If you need audio in your CAVS output, you would need to supply a separate audio source and add it with an additional FFmpeg input and mapping flags.
CAVS (Chinese Audio Video Standard) is a Chinese national multimedia standard developed by the Audio Video Coding Standard Workgroup of China, intended as an alternative to H.264/AVC for Chinese broadcast and digital media applications. It is primarily supported by Chinese set-top boxes, broadcast infrastructure, and media players that implement the AVS standard. It is not widely supported by mainstream Western devices or platforms, so CAVS output is best suited for workflows targeting Chinese broadcasting ecosystems.
The video quality is controlled by the -crf flag, where lower values produce higher quality at larger file sizes and higher values produce smaller files with more visible compression. For Y4M source material — which is lossless — you may want to use a lower CRF like 18 to preserve fine detail, especially if the original was a high-quality capture. Simply replace '-crf 23' in the command with '-crf 18' (or any value from 0 to 51) to adjust the tradeoff.
Yes. On Linux or macOS you can use a shell loop such as: for f in *.y4m; do ffmpeg -i "$f" -c:v libx264 -c:a aac -crf 23 -b:a 128k "${f%.y4m}.cavs"; done. On Windows Command Prompt, use: for %f in (*.y4m) do ffmpeg -i "%f" -c:v libx264 -c:a aac -crf 23 -b:a 128k "%~nf.cavs". The browser-based tool processes one file at a time, so the FFmpeg command is especially valuable for batch processing large collections of Y4M files locally.

Technical Notes

Y4M encodes video as planar YCbCr (commonly 4:2:0) with each frame stored sequentially and preceded by a short ASCII header describing resolution, frame rate, and chroma subsampling. This makes Y4M ideal as a pipe format but wholly impractical for storage or distribution due to its size. When encoding to CAVS with libx264, FFmpeg reads the raw YUV planes directly — no intermediate decode step is needed, which makes this conversion efficient. The CAVS container uses a .cavs extension and wraps H.264-compatible video (encoded via libx264) with AAC audio. Note that true AVS1 or AVS2 video coding is distinct from what this tool produces; the libx264 encoder here generates H.264 video placed inside a CAVS-named container, which is the practical encoding approach supported by FFmpeg's CAVS muxer. Metadata support in CAVS is minimal — there is no support for subtitles, chapters, or multiple audio tracks, and any metadata embedded in the Y4M header (such as frame rate or aspect ratio) will be read by FFmpeg and passed through to the output, but extended metadata is not preserved. The CRF-based encoding means output file size is variable and content-dependent, which is important to consider when targeting broadcast bitrate requirements.

Related Tools