<p>While in many cases it is impossible, there are cases where it may be <em>theoretically</em> possible. I will ignore here cases where no keyframes exist, since your question clearly stated that you are dealing with the codec with keyframe, but codecs differ in whether they allow keyframes in specific locations, or a keyframe may appear at any point.</p>
<p>If you have the latter, it would be possible to set up a case like the following:</p>
<p><a href="https://i.sstatic.net/VGgi4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VGgi4.png" alt="encode+copy" /></a></p>
<p>Here the green frames are Key Frames, and the red is the new keyframe that will be created. You can see that most blocks can be copied as is, without reencoding, that is because every frame that follows the keyframe that can be just copied, can just be copied itself. We can also simply drop the unneeded frames from the last block without any issues (in many cases).</p>
<p>So what is happening with the red keyframe? It is generated from the information that come from the keyframe of the first block, plus all the changes that were applied by the frames following it up until the specific timestamp. This is 3.3 seconds in your example.</p>
<p>I will repeat myself once again, that in order for this to generate a playable file, you would need to be dealing with the codec which allows you to have as few frames between keyframes as you have left in the first block.</p>
<p>I am unaware of any tool which makes this approach easy, however.</p>

CC BY-SA 4.0
2021-12-06T07:54:28.543Z
2021-12-06T07:54:28.543Z
v010dya
<p>I have a MKV video and I want to cut from seconds 3.3 to 22:07 minutes, but I can't cut at that start timing because there isn't a keyframe. How can I bypass that?</p>

CC BY-SA 4.0
2020-07-05T17:41:31.757Z
You can’t “bypass” it. If that was possible it would be the default option. If you use -codec copy, you must cut on key frames, otherwise re-encoding is required.
SlimSCSI
CC BY-SA 4.0
2020-07-05T22:04:09.887Z
ok, thanks for your help
tommy
<ffmpeg>
FFMPEG: How can I cut a mkv without considering keyframes?
tommy
# FFMPEG: How can I cut a mkv without considering keyframes?

(Asked by: username_0 on 2020-07-05)

I have a MKV video and I want to cut from seconds 3.3 to 22:07 minutes, but I can't cut at that start timing because there isn't a keyframe. How can I bypass that?

**Tags:** ffmpeg

> **Comments:**
> **username_1**: You can’t “bypass” it. If that was possible it would be the default option. If you use -codec copy, you must cut on key frames, otherwise re-encoding is required.  
> **username_0**: ok, thanks for your help  

---

## 1 answers

### Answer by username_2 on 2021-12-06. Score: 2

While in many cases it is impossible, there are cases where it may be *theoretically* possible. I will ignore here cases where no keyframes exist, since your question clearly stated that you are dealing with the codec with keyframe, but codecs differ in whether they allow keyframes in specific locations, or a keyframe may appear at any point.

If you have the latter, it would be possible to set up a case like the following:

[![encode+copy](https://i.sstatic.net/VGgi4.png)](https://i.sstatic.net/VGgi4.png)

Here the green frames are Key Frames, and the red is the new keyframe that will be created. You can see that most blocks can be copied as is, without reencoding, that is because every frame that follows the keyframe that can be just copied, can just be copied itself. We can also simply drop the unneeded frames from the last block without any issues (in many cases).

So what is happening with the red keyframe? It is generated from the information that come from the keyframe of the first block, plus all the changes that were applied by the frames following it up until the specific timestamp. This is 3.3 seconds in your example.

I will repeat myself once again, that in order for this to generate a playable file, you would need to be dealing with the codec which allows you to have as few frames between keyframes as you have left in the first block.

I am unaware of any tool which makes this approach easy, however.


---

