Answers.Body: <p>This is answered in FFmpeg's <a href="https://trac.ffmpeg.org/wiki/Seeking" rel="nofollow noreferrer">Seeking</a> wiki page.
  The behavior is expected: If the time hits to a space between 2 key frames, it copies only audio up to the next keyframe and fills the video with black.</p>
  
  <p>There are some methods to get also the beginning. </p>
  
  <ul>
  <li>One is to overlay the copied part with few seconds of re-encoded original.</li>
  <li>Or, simply, seek to a bit earlier frame.</li>
  <li>Or, find the previous keyframe and clip from that.</li>
  <li>Or, reencoding the whole clip.</li>
  </ul>
  
  <p>It's a bit pity that FFmpeg (AFAIK) doesn't have a feature for this built in.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-14T23:11:34.513Z
Answers.LastActivityDate: 2020-04-14T23:11:34.513Z
Answers.UserDisplayName: Ondra Žižka
Body: <p>I have an MKV video, and want to cut the first 3 seconds. I tried with FFmpeg:</p>
  
  <pre><code>ffmpeg -i /input.mkv -ss 00:00:3.0 -c copy -t 00:09:58.0 output.mkv
  </code></pre>
  
  <p>But the result (when played in VLC) is that there are 5 seconds blank video with the original sound, and after that, the video shows.</p>
  
  <p>I think it has something to do with a missing keyframe at the beginning. So I tried:</p>
  
  <pre><code>ffmpeg -i /input.mkv -ss 00:00:3.0 -c copy -t 00:09:58.0 -force_key_frames 00:00:00.000 output.mkv
  </code></pre>
  
  <p>But this has no effect - same result.</p>
  
  <p>How can I cut a video properly so that it begins exactly where cut?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-24T18:24:05.537Z
Comments.Text: Replace `-t` with `-to`
Comments.UserDisplayName: Marware
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-25T11:01:05.493Z
Comments.Text: @Marware nope, that just chnages if the time is a duration or end time.
Comments.UserDisplayName: Ondra Žižka
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-25T11:03:13.887Z
Comments.Text: I think I found the answer here: https://superuser.com/questions/138331/using-ffmpeg-to-cut-up-video  I need to put `-ss` in front of `-i` with some more time. `ffmpeg -ss 00:08:00 -i Video.mp4 -ss 00:01:00 -t 00:01:00 -c copy VideoClip.mp4`
Comments.UserDisplayName: Ondra Žižka
Tags: <ffmpeg><editing><keyframes>
Title: FFmpeg: Cutting 3 seconds at the beginning of a video leaves 5 seconds blank
UserDisplayName: Ondra Žižka
ThreadText: # FFmpeg: Cutting 3 seconds at the beginning of a video leaves 5 seconds blank
  
  (Asked by: username_0 on 2019-03-24)
  
  I have an MKV video, and want to cut the first 3 seconds. I tried with FFmpeg:
  
  ```
  ffmpeg -i /input.mkv -ss 00:00:3.0 -c copy -t 00:09:58.0 output.mkv
  
  ```
  
  But the result (when played in VLC) is that there are 5 seconds blank video with the original sound, and after that, the video shows.
  
  I think it has something to do with a missing keyframe at the beginning. So I tried:
  
  ```
  ffmpeg -i /input.mkv -ss 00:00:3.0 -c copy -t 00:09:58.0 -force_key_frames 00:00:00.000 output.mkv
  
  ```
  
  But this has no effect - same result.
  
  How can I cut a video properly so that it begins exactly where cut?
  
  **Tags:** ffmpeg, editing, keyframes
  
  > **Comments:**
  > **username_1**: Replace `-t` with `-to`  
  > **username_0**: @username_1 nope, that just chnages if the time is a duration or end time.  
  > **username_0**: I think I found the answer here: https://superuser.com/questions/138331/using-ffmpeg-to-cut-up-video  I need to put `-ss` in front of `-i` with some more time. `ffmpeg -ss 00:08:00 -i Video.mp4 -ss 00:01:00 -t 00:01:00 -c copy VideoClip.mp4`  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-04-14. Score: 2 | Accepted answer
  
  This is answered in FFmpeg's [Seeking](https://trac.ffmpeg.org/wiki/Seeking) wiki page.
  The behavior is expected: If the time hits to a space between 2 key frames, it copies only audio up to the next keyframe and fills the video with black.
  
  There are some methods to get also the beginning.
  
  * One is to overlay the copied part with few seconds of re-encoded original.
  * Or, simply, seek to a bit earlier frame.
  * Or, find the previous keyframe and clip from that.
  * Or, reencoding the whole clip.
  
  It's a bit pity that FFmpeg (AFAIK) doesn't have a feature for this built in.
  
  
  ---
  
  