Convert Y4M to MP3 — Free Online Tool

Convert Y4M (YUV4MPEG2) video files to MP3 audio by extracting and encoding the audio stream using the LAME encoder at 128kbps. Since Y4M is a raw, uncompressed intermediate format with no embedded audio, this tool is most useful when your Y4M file was generated alongside a separate audio source that you want to encode as a standalone MP3.

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 (YUV4MPEG2) is a raw, uncompressed video-only format — it stores planar YUV pixel data with no audio stream whatsoever. When FFmpeg processes a Y4M file, it finds no audio to extract, so the output MP3 will be silent unless the Y4M was somehow muxed with audio data in an unconventional way. The conversion command instructs FFmpeg to pass the file through the libmp3lame encoder, targeting a 128kbps CBR bitrate. In practice, this tool is most valuable as a reference for the FFmpeg command structure when you need to encode audio to MP3 using the LAME encoder — for example, in a piped workflow where Y4M video data is paired with a separate audio input fed into the same FFmpeg process.

What Each Flag Does

Flag What it does
ffmpeg Invokes the FFmpeg binary — the core multimedia processing engine that handles demuxing the Y4M input, routing streams, and encoding the MP3 output via libmp3lame.
-i input.y4m Specifies the input file in Y4M (YUV4MPEG2) format. FFmpeg reads the raw uncompressed video frames and checks for any audio stream — in standard Y4M files, no audio stream will be found.
-c:a libmp3lame Instructs FFmpeg to encode the audio stream using the LAME MP3 encoder (libmp3lame), the highest-quality open-source implementation of the MP3 standard and the standard choice for producing compatible, high-quality MP3 files.
-b:a 128k Sets the audio bitrate to 128kbps CBR (Constant Bitrate) for the MP3 output. This is the conventional default MP3 bitrate, offering broad device compatibility and reasonable perceptual quality; increase to 192k or 320k for better fidelity.
output.mp3 Defines the output filename and container. The .mp3 extension tells FFmpeg to write a standard MP3 file, which will contain only the encoded audio stream with no video data from the Y4M source.

Common Use Cases

  • Extracting audio from a Y4M file produced by a tool that non-standardly embedded an audio track alongside raw video data
  • Using the FFmpeg command as a template for a piped transcoding workflow where Y4M frames come from one source (e.g., a video processing tool) and you need to encode audio separately as MP3
  • Testing the libmp3lame encoder settings and bitrate options in a local FFmpeg setup before applying them to a larger pipeline involving Y4M intermediate files
  • Converting a Y4M file that was paired with audio during a lossless editing session and needs to be archived as an MP3 audio track
  • Learning the correct FFmpeg flags for CBR MP3 encoding (-b:a and libmp3lame) in the context of a raw video workflow where Y4M is the source container

Frequently Asked Questions

Standard Y4M (YUV4MPEG2) files do not contain an audio stream — the format is defined as video-only, storing raw planar YUV frames with a simple text header. If you run this conversion on a standard Y4M file, FFmpeg will produce a silent or empty MP3 because there is no audio data to encode. If you need audio in your output, your audio must come from a separate source file, which you would add to the FFmpeg command using an additional -i flag.
This conversion is most useful in scripted or piped FFmpeg workflows where Y4M frames are piped from a video processing tool (such as VapourSynth or avisynth) and audio is provided from a second input source. The FFmpeg command shown here serves as the correct structural template for encoding audio to MP3 using libmp3lame, and understanding its flags is essential even when the actual Y4M file is just one part of a more complex pipeline.
Change the value after the -b:a flag to your desired bitrate. For example, use -b:a 320k for the highest standard MP3 quality (approximately 320kbps CBR), or -b:a 64k for a much smaller file suitable for voice recordings where audio fidelity is less critical. The default used here is 128k, which is a widely accepted balance between file size and perceptual audio quality for music and general content.
Yes. You can add a second input file by inserting -i audio_source.wav (or any supported audio format) before the output filename. FFmpeg will then map the audio from that second input through the libmp3lame encoder while ignoring the video-only Y4M stream for the MP3 output. The full command would look like: ffmpeg -i input.y4m -i audio_source.wav -map 1:a -c:a libmp3lame -b:a 128k output.mp3
libmp3lame is the gold standard open-source MP3 encoder and consistently outperforms older encoders like the original Fraunhofer encoder in blind listening tests at equivalent bitrates. At 128kbps CBR (the default here), LAME produces audio that is perceptually transparent for most listeners with typical content. For archival or high-fidelity use cases, 192kbps or 320kbps is recommended, or consider a lossless format like FLAC instead.
Yes, you can batch process on the command line using a shell loop. On Linux or macOS, use: for f in *.y4m; do ffmpeg -i "$f" -c:a libmp3lame -b:a 128k "${f%.y4m}.mp3"; done. On Windows Command Prompt, use: for %f in (*.y4m) do ffmpeg -i "%f" -c:a libmp3lame -b:a 128k "%~nf.mp3". The browser-based tool on this page processes one file at a time, so the local FFmpeg command is particularly useful for bulk operations.

Technical Notes

Y4M is a headerless-friendly raw format originally designed for inter-application piping (e.g., between x264 or FFmpeg and tools like VapourSynth). Its specification explicitly does not define an audio stream, making it inherently video-only. The libmp3lame encoder used here produces CBR (Constant Bitrate) MP3 at the specified bitrate, which ensures predictable file sizes and broad compatibility — CBR MP3 files are supported on virtually every device and platform, from hardware MP3 players to streaming services. One important metadata note: MP3 supports ID3 tags (v1 and v2) for storing title, artist, album, and similar fields, but since Y4M carries no such metadata, none will be transferred to the output file. If metadata is needed, it must be added separately using FFmpeg's -metadata flag or a dedicated tag editor. File size for the output MP3 depends entirely on the duration of the audio and the chosen bitrate (not on the Y4M file size, which is determined by resolution and frame count). At 128kbps, one minute of audio produces roughly 960KB.

Related Tools