Trim Y4M — Free Online Tool
Trim a Y4M (YUV4MPEG2) video to a precise start and end point without any re-encoding, preserving the raw, uncompressed pixel data exactly as-is. Because Y4M stores rawvideo frames with no compression, stream copying is lossless by definition — every trimmed frame is bit-for-bit identical to the original.
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 YUV video frames sequentially with no inter-frame compression, which means every frame is a self-contained, independently decodable unit. This makes trimming trivially lossless: FFmpeg simply seeks to the requested start timestamp and copies the raw frame data into a new Y4M container until the end timestamp is reached. Because there are no compressed keyframe dependencies (unlike H.264 or HEVC), the cut can be frame-accurate with no decoding or re-encoding step required. The output is a valid Y4M file with the same YUV colorspace, resolution, and frame rate as the source, just shorter.
What Each Flag Does
| Flag | What it does |
|---|---|
ffmpeg
|
Invokes the FFmpeg binary. In the browser-based tool this runs via FFmpeg.wasm (WebAssembly) entirely client-side; when run locally it calls your system FFmpeg installation directly. |
-i input.y4m
|
Specifies the input Y4M file. FFmpeg reads the YUV4MPEG2 header to determine the resolution, frame rate, and chroma subsampling before processing the raw frame data. |
-ss 00:00:00
|
Sets the trim start point at 0 seconds (the beginning of the file). Placed before -i, this uses fast input-level seeking. Because Y4M stores rawvideo with no inter-frame compression, every frame is a keyframe and seeking is always frame-accurate regardless of timestamp. |
-to 00:00:10
|
Sets the trim end point at 10 seconds from the start of the file. Combined with the -ss value, this produces a 10-second output clip. You can change this value to any timestamp in HH:MM:SS or decimal seconds format to select a different end point. |
-c copy
|
Instructs FFmpeg to copy the rawvideo stream without re-encoding. For Y4M this is both lossless and maximally fast — the uncompressed YUV frame data is written directly to the output file with no pixel modification whatsoever. |
output.y4m
|
The output filename. The .y4m extension causes FFmpeg to write a valid YUV4MPEG2 file with the appropriate per-file and per-frame headers, matching the resolution, frame rate, and colorspace of the trimmed source segment. |
Common Use Cases
- Isolating a specific segment of a lossless Y4M intermediate for use in a frame-by-frame video analysis pipeline without introducing compression artifacts
- Trimming a Y4M file produced by a capture tool (such as ffmpeg pipe output or a rawvideo recorder) before handing it off to an encoder like x264 or x265 for final compression
- Cutting out a precise range of uncompressed frames from a Y4M sequence to feed into a compositing or color grading application that expects rawvideo input
- Extracting a short test clip from a large Y4M source file to verify encoding settings on a representative segment before committing to a full encode
- Splitting a long Y4M intermediate produced during a multi-step lossless processing chain so that separate segments can be processed in parallel
- Removing leader or trailer frames added by capture software from the start or end of an uncompressed Y4M recording before archiving
Frequently Asked Questions
Trimming Y4M with -c copy is completely lossless. Because Y4M stores raw, uncompressed YUV frames with no inter-frame compression, there are no keyframe dependencies to resolve and no partial GOP boundaries to handle. FFmpeg reads the raw frame data starting at the requested timestamp and writes it directly into the output Y4M container without touching a single pixel value. The output frames are bit-for-bit identical to the corresponding frames in the source file.
Because Y4M uses rawvideo with no temporal compression, every frame is an independent keyframe. This means the -ss and -to timestamps can resolve to exact frame boundaries without any rounding to the nearest keyframe as you would see with compressed formats like H.264. The accuracy is limited only to the frame rate of the source — for example, at 30 fps each frame is 33.3 ms apart — so any timestamp you specify will snap to the nearest frame at the given frame rate.
Yes, this is entirely expected and correct. Y4M stores uncompressed YUV data, so file size is determined purely by resolution, frame count, bit depth, and chroma subsampling (e.g. 4:2:0 vs 4:4:4), not by scene content. A 10-second trim of a 1920x1080 4:2:0 Y4M at 24 fps will always be roughly the same size regardless of whether the frames show a static image or rapid motion, because no compression is applied.
Yes. The -ss flag sets the start time and -to sets the end time, both in HH:MM:SS or seconds format. For example, to trim from 5 seconds to 30 seconds you would use -ss 00:00:05 -to 00:00:30. Alternatively, you can replace -to with -t followed by a duration — so -t 25 would copy 25 seconds of content starting from the -ss point. Placing -ss before -i (as shown in the command) uses fast stream-level seeking, which is safe and frame-accurate for Y4M because every frame is a keyframe.
Y4M stores raw, uncompressed YUV pixel data for every frame — there is no compression of any kind. A 10-second 1080p 24fps Y4M clip at 4:2:0 chroma subsampling occupies roughly 1.5 GB, whereas a comparable H.264 MP4 might be only a few megabytes. Y4M is intentionally used as a lossless intermediate format for piping between tools in a processing chain, not for distribution or storage. It is normal and expected for Y4M files to be orders of magnitude larger than compressed video formats.
The command shown trims a single file, but you can batch process multiple Y4M files using a shell loop. In bash, for example: for f in *.y4m; do ffmpeg -i "$f" -ss 00:00:00 -to 00:00:10 -c copy "trimmed_$f"; done. This applies the same start and end timestamps to every Y4M file in the current directory. For files larger than 1 GB — which is common with uncompressed Y4M — running the command locally on your desktop using the displayed FFmpeg command is recommended over the browser-based tool.
Technical Notes
Y4M (YUV4MPEG2) uses a plain-text header per file and per frame to describe colorspace, resolution, frame rate, and interlacing, followed by raw planar YUV data. Because there is no compression and every frame header is self-describing, FFmpeg can seek and cut without any decode step, and the resulting output file will have a correctly formed Y4M header matching the source parameters. Y4M does not support audio tracks, subtitles, chapters, or embedded metadata beyond basic video geometry — so trimming a Y4M file involves only the video stream and there is nothing else to preserve or lose. One known limitation is that Y4M does not natively encode timestamps in individual frames in the same way MKV or MP4 do; frame timing is implied by the frame rate in the file header. FFmpeg handles this correctly when writing the output container. Because Y4M files are uncompressed, even short clips can be very large and may challenge browser memory limits for files approaching 1 GB; for large Y4M intermediates, running the FFmpeg command locally is strongly recommended.