Answers.Body: <p>This is possible with the <a href="https://www.ffmpeg.org/download.html" rel="nofollow noreferrer">FFmpeg</a> command <code>ffmpeg -i input.mp4 -ss 0 -c copy -t 60 output.mp4</code>. This would cut the video from the beginning <code>-ss 0</code> to second 60 <code>-t 60</code>.</p>
  
  <p>Be aware that -ss is and offset which -t is based upon. So <code>-ss 10</code> and <code>-t 60</code> would result in cutting to second 70 and removing the first 10. You can use the <code>-to</code> option to cut at a fixed time unrelated to <code>-ss</code>.</p>
  
  <p>I'm not exactly sure how ffmpeg will handle GOPs but I think it will cut at the nearest GOP at the specified time.</p>
  
  <p>Relevant question on SU: <a href="https://superuser.com/questions/138331/using-ffmpeg-to-cut-up-video">https://superuser.com/questions/138331/using-ffmpeg-to-cut-up-video</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-17T21:04:18.080Z
Answers.Text: This will not cut accurately. It will look for the nearest iFrame and cut at that point. The only way to cut losslessly with FFmpeg is to use some lightweight encoding like the following (very slow) method:
  
  `ffmpeg -ss 00:00:03.123 -i input.mp4 -t 10 -c:v libx264 -c:a aac -strict experimental out.mp4`
Answers.UserDisplayName: cgnorthcutt
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-18T22:21:18.133Z
Answers.Text: The question was in regard to the encoding, as in lossless picture quality. When you re-encode the output you are able to cut more accurately but not without a loss in frame information.
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-23T13:29:35.047Z
Answers.LastActivityDate: 2014-07-23T13:35:35.827Z
Answers.LastEditDate: 2017-03-20T10:18:33.487Z
Answers.UserDisplayName: timonsku
Answers.Body: <p>Also, these days you can use this nice crossplatform GUI tool <a href="https://github.com/mifi/lossless-cut" rel="nofollow noreferrer">LosslessCut</a> (with <a href="https://www.ffmpeg.org" rel="nofollow noreferrer">FFmpeg</a> under the hood).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-05T22:11:59.473Z
Answers.LastActivityDate: 2021-05-05T22:11:59.473Z
Answers.UserDisplayName: rook
Answers.Body: <p>Yes, it is generally possible, but with a few limitations.  h.264 uses what is known as a group of pictures.  A group of pictures groups multiple frames together in a way that allows for further compression, but the entire group of pictures has to be decoded together.  As such, it is only possible to cut a video stream in between groups of pictures. This is often around 15 frames, but length can vary based on encoding options that were used.</p>
  
  <p>As long as you are ok breaking it on a group of pictures, you can cut up the video to your hearts content and still use the same data stream.  At the end of the day, most video formats consist of some metadata that describes how the video is laid out and how it syncs with the audio.  It then contains one or more streams of video and one or more streams of audio.  When played back, this metadata is read and then the streams are used for playback.</p>
  
  <p>Splitting the file simply means extracting part of the stream, broken up on a group of pictures, pulling out the relevant audio and then piecing the data back together in a new container that has metadata that corresponds to it.  As long as you break it at the points it is designed to break, then it ends up being two normal, otherwise unaltered streams.  There are numerous tools that can do this for you, including tools like FFMPEG, though I unfortunately do not have the exact command to perform the split as my FFMPEG skills are decidedly weaker than many others on here (though one of them will likely soon be able to post with the command line you need.)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-21T15:22:58.727Z
Answers.LastActivityDate: 2014-07-21T15:22:58.727Z
Answers.UserDisplayName: AJ Henderson
Body: <p>Is it possible to lossless clip out the video file (MPEG-4/H.264) that result chunks will be <em>equivalent</em> to the same of raw footage? I want to reduce size of the source (raw) material by cutting off the unnecessary, but desire to have remaining clips in the same quality as initial video.</p>
  
Tags: <editing><software><mpeg><clipping>
Title: Lossless cutting video (MPEG-4)
UserDisplayName: rook
ThreadText: # Lossless cutting video (MPEG-4)
  
  (Asked by: username_0 on 2014-07-21)
  
  Is it possible to lossless clip out the video file (MPEG-4/H.264) that result chunks will be *equivalent* to the same of raw footage? I want to reduce size of the source (raw) material by cutting off the unnecessary, but desire to have remaining clips in the same quality as initial video.
  
  **Tags:** editing, software, mpeg, clipping
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2014-07-21. Score: 3 | Accepted answer
  
  Yes, it is generally possible, but with a few limitations. h.264 uses what is known as a group of pictures. A group of pictures groups multiple frames together in a way that allows for further compression, but the entire group of pictures has to be decoded together. As such, it is only possible to cut a video stream in between groups of pictures. This is often around 15 frames, but length can vary based on encoding options that were used.
  
  As long as you are ok breaking it on a group of pictures, you can cut up the video to your hearts content and still use the same data stream. At the end of the day, most video formats consist of some metadata that describes how the video is laid out and how it syncs with the audio. It then contains one or more streams of video and one or more streams of audio. When played back, this metadata is read and then the streams are used for playback.
  
  Splitting the file simply means extracting part of the stream, broken up on a group of pictures, pulling out the relevant audio and then piecing the data back together in a new container that has metadata that corresponds to it. As long as you break it at the points it is designed to break, then it ends up being two normal, otherwise unaltered streams. There are numerous tools that can do this for you, including tools like FFMPEG, though I unfortunately do not have the exact command to perform the split as my FFMPEG skills are decidedly weaker than many others on here (though one of them will likely soon be able to post with the command line you need.)
  
  
  ---
  
  ### Answer by username_1 on 2014-07-23. Score: 7
  
  This is possible with the [FFmpeg](https://www.ffmpeg.org/download.html) command `ffmpeg -i input.mp4 -ss 0 -c copy -t 60 output.mp4`. This would cut the video from the beginning `-ss 0` to second 60 `-t 60`.
  
  Be aware that -ss is and offset which -t is based upon. So `-ss 10` and `-t 60` would result in cutting to second 70 and removing the first 10. You can use the `-to` option to cut at a fixed time unrelated to `-ss`.
  
  I'm not exactly sure how ffmpeg will handle GOPs but I think it will cut at the nearest GOP at the specified time.
  
  Relevant question on SU: <https://superuser.com/questions/138331/using-ffmpeg-to-cut-up-video>
  
  > **Comments:**
  > **username_2**: This will not cut accurately. It will look for the nearest iFrame and cut at that point. The only way to cut losslessly with FFmpeg is to use some lightweight encoding like the following (very slow) method:  `ffmpeg -ss 00:00:03.123 -i input.mp4 -t 10 -c:v libx264 -c:a aac -strict experimental out.mp4`  
  > **username_1**: The question was in regard to the encoding, as in lossless picture quality. When you re-encode the output you are able to cut more accurately but not without a loss in frame information.  
  
  ---
  
  ### Answer by username_0 on 2021-05-05. Score: 0
  
  Also, these days you can use this nice crossplatform GUI tool [LosslessCut](https://github.com/mifi/lossless-cut) (with [FFmpeg](https://www.ffmpeg.org) under the hood).
  
  
  ---
  
  