FFmpeg lossless cut issues where the output video freezes typically stem from incorrect timestamp handling or container format incompatibilities rather than codec errors. The most common solution involves using the correct stream copy method with explicit keyframe seeking, ensuring that the output container matches the input structure. By avoiding re-encoding and fixing negative timestamps, you can resolve playback stutters in players like VLC or Windows Media Player without needing to recompile FFmpeg or use outdated builds.
Understanding the Freeze Symptom
When a user reports that an FFmpeg lossless cut output file "freezes," they are usually describing a video that plays for a few seconds and then hangs indefinitely, or audio/video desynchronization that appears as a freeze. This is rarely a corruption of the video data itself since lossless cutting uses stream copying (
-c copy). Instead, it is almost always a metadata or timestamp issue.
Players rely on accurate presentation timestamps (PTS) and decoding timestamps (DTS) to render frames. If these values are out of order, negative, or missing, the player cannot determine when to display the next frame. This results in the application waiting for data that will never arrive in the expected sequence, creating the illusion of a frozen screen. It is crucial to distinguish this from encoding failures, which often produce garbled visuals or complete failure to open files, as discussed in our guide on
FFMPEG Video Encoding Example Not Working.
The Correct Lossless Cut Command
The standard approach to cutting video without re-encoding is using the
-c copy flag. However, simply specifying start and end times is not enough if the source file has complex timestamp structures. The most robust command for lossless cutting looks like this:
ffmpeg -ss 00:01:00 -i input.mp4 -to 00:02:00 -c copy -avoid_negative_ts make_zero output.mp4
Let's break down why each part matters. The
-ss flag before
-i performs fast seeking by jumping to the nearest keyframe before the specified time. This is much faster than seeking after
-i, but it may include slightly more data than requested. The
-to flag specifies the end time. The
-c copy instruction tells FFmpeg to stream-copy all tracks (video, audio, subtitles) without touching them, preserving original quality.
The critical addition here is
-avoid_negative_ts make_zero. Older versions of FFmpeg or certain containers might produce negative timestamps during cuts. While some modern players handle this gracefully, many older or stricter players will fail to decode frames with negative PTS, leading to the freeze. Setting these to zero ensures a clean timeline starting at 00:00:00.000.
Container Format Compatibility
Even with perfect commands, the output container must support the streams inside it. MP4 is the most universal container, but it requires specific codecs. If your input is MKV containing VP9 or AV1 video, copying those streams directly into an MP4 container will fail because MP4 does not natively support those codecs without remuxing or transcoding.
If you encounter errors about unsupported codecs when trying to create an MP4, check your input format. If you are working with specialized formats like WebM or MKV, consider keeping the output in MKV instead of forcing MP4. For users dealing with hardware acceleration conflicts that might cause similar playback issues, refer to our article on
FFmpeg Quicksync Video Conversion with NVIDIA Hardware.
Another common pitfall is using
-f mp4 incorrectly. If you force a format that doesn't match the codec capabilities, FFmpeg might write invalid headers. Always let FFmpeg guess the format based on the extension unless you have a specific reason to override it. Using
-movflags +faststart can also help with web playback by moving the index to the beginning of the file, though this is optional for local playback.
Diagnostics and Verification
Before assuming the cut failed, verify the output file properties. Use ffprobe to inspect the timestamps of the resulting file:
ffprobe -show_packets output.mp4 | grep pts_time
Look for any negative values. If you see negative PTS values, the
-avoid_negative_ts flag was necessary. If the timestamps jump erratically (e.g., 1.0, 5.0, 2.0), the keyframe alignment was poor. In such cases, you might need to use
-ss after
-i for precise seeking, but this forces a re-encode, defeating the purpose of lossless cutting.
If the file still freezes, test it in a different player. VLC is generally very forgiving with timestamp issues, while Windows Media Player or default gallery apps are less so. If it works in VLC but not elsewhere, the issue is definitely timestamp-related. You can try remuxing the file with
ffmpeg -i input.mkv -c copy output.mp4 to rebuild the container headers, which often fixes minor metadata inconsistencies.
For users experiencing startup crashes or application errors unrelated to video content, such as the 0xc0000005 error, see our troubleshooting guide on
Fixing FFmpeg: Application unable to start (0xc0000005) Issue.
Frequently Asked Questions
Why does my lossless cut work in VLC but freeze in Windows Media Player?
This discrepancy is caused by how strictly each player adheres to ISO base media file format standards. VLC is lenient with timestamp anomalies, while Windows Media Player expects perfectly ordered positive timestamps. Using the
-avoid_negative_ts make_zero flag resolves this by normalizing the timeline for stricter players.
Can I use lossless cut on HEVC/H.265 videos?
Yes, provided the output container supports HEVC. MP4 and MKV both support H.265. Ensure your FFmpeg build includes HEVC decoder/encoder support. If you face codec-specific errors, check if your version supports the required profiles, as older builds might lack full HEVC compatibility.
What should I do if the cut point is not exact?
Lossless cutting relies on keyframes. If you cut between keyframes, FFmpeg will include the entire preceding keyframe segment, making the cut slightly longer than requested. This is unavoidable without re-encoding. For pixel-perfect accuracy, you must re-encode, which sacrifices the "lossless" nature of the operation.
Does -avoid_negative_ts fix encoding errors?
No, this flag only adjusts timestamp metadata; it does not fix codec corruption or bitrate mismatches. If your video is garbled or has no audio, the issue lies in the stream copying process or codec compatibility, not timestamps. Refer to general encoding troubleshooting guides for those symptoms.
Is it safe to use third-party GUI tools for lossless cutting?
Most reputable GUI tools like LosslessCut or Shutter Encoder use FFmpeg under the hood. They are generally safe and provide visual previews of keyframes. However, always verify the underlying command they generate if you encounter issues, as GUI defaults may vary in their handling of timestamps and containers.