Skip to content
BlogSign in
Tutorials

How To Trim a Video Without Losing Quality

Learn how to trim a video without re-encoding it, why normal video editors can reduce quality and when a lossless trim is the better choice.

By Jacob R

How To Trim a Video Without Losing Quality

If you only want to cut out a part of a video, re-encoding feels a bit ridiculous. And it is.

When you export a trimmed video from most editors, the software decodes the original file and re-encodes it. Even if you use the same resolution, bitrate and coded, you're still "compressing" the video a second time.




What happens when you normally export a video?

Take a recording from OBS. Maybe it's a 90 second, 4K gameplay clip and you only want the last 30 seconds of it. A traditional editor will generally decode the original video, apply your edit and then encode the result into a new file.


That looks roughly like this: Original video -> decode -> edit -> new video


The encoding step is the important part. H.264, H.265 and most other common codecs are lossy, so some information is discarded every time you encode it.


Lossless trimming works differently

Instead of decoding and encoding the video, you can copy the existing streams into a new file and leave them alone.

This is usually called stream copying or lossless trimming. The actual video data isn't being changed. You're just putting the part you want into a new container. That's why it's so fast.


There's a catch: keyframes

This is the part that makes video trimming more complicated than cropping an image or trimming an audio file.


Compressed video doesn't usually store every frame independently. Instead, codecs use keyframes (also called I-frames) as reference points. Other frames can depend on those earlier frames.


So if your video has keyframes every few seconds and you ask for a cut halfway in between two of them, the software can't always just start copying from that exact frame.


For example:

video-container-keyframes


If you want to start your clip at 7.2 seconds, there might not be a keyframe there.


A strea-copy operation may therefore have to start from an earlier point, or the resulting cut may not be frame-perfect. This is the main trade-off with lossless trimming.



Lossless vs frame-accurate trimming

There are basically two approaches. Stream copy doesn't re-encode the video, it's extremely fast and doesn't introduce another generation of compression, but the cut can be limited by keyframe placement.


Re-encoding decodes the video and creates a new one. It's significantly slower and can come with quality loss, but it gives you much more control over exactly where the cut happens.


So if you're cutting a gameplay recording and don't care whether the first frame is off by a fraction of a second, stream copying is usually the best choice.



You can do it with FFmpeg

FFmpeg supports stream copying with `-c copy`

For example:

ffmpeg-stream-copy-command


This tells FFmpeg to start around 1 minute and 30 seconds into the source, take 20 seconds, and copy the existing streams instead of re-encoding them.

The -c copy part is what matters the most here. FFmpeg isn't compressing the video again, it's copying the existing video & audio streams.

There are some details around seeking and timestamps that can make FFmpeg trimming behave differently depending on the file, which is why you may occasionally see a cut that isn't exactly where you expected.


When should you re-encode?

If you're only trimming, try stream copying first.


Re-encoding makes sense when you're doing something beyond simply cutting the file:

  • You need a frame-perfect cut
  • You're changing the resolution
  • You're changing the frame rate
  • You're applying effects
  • You're adding subtitles or overlays
  • You need to change the codec
  • You need to significantly reduce the file size.

Trim first, compress second

This is especially useful for gameplay recordings.

Say you have a 15 GB recording and there's a 45-second clip somewhere in the middle that you actually want.

Re-encoding the entire recording just to get that clip is wasteful.

A better workflow is:

15 GB recording → lossless trim → 45-second clip → compress if needed

The first step doesn't need to touch the actual video quality.

Then, if you need to get the final clip down to a size suitable for Discord, TikTok, or wherever you're uploading it, you can encode that much smaller file.

That also means you're only spending encoding time on footage you're actually going to keep.




So, can you really trim a video without losing quality?

Yes, but only if you don't re-encode it.

A lossless trim doesn't improve the video and it doesn't magically make compression disappear. It simply avoids doing another unnecessary encode when all you wanted was to remove part of the file.

The limitation is keyframes. If you need to cut at an exact frame, you'll generally have to accept some form of re-encoding.

For straightforward cuts, though, there's no reason to turn a five-second edit into a full video export.

Cut the file. Keep the original stream. Encode only when you actually need to.

That is exactly the kind of workflow xype's Lossless Trim is designed for.