

If you don’t mention copy, re-encoding is the norm.

If you want to cut specifically at a non-keyframe and have it play at the desired point on a player that doesn’t support edit lists, or if you want to make sure the cut section isn’t in the output file (for example, if it includes sensitive information), you can do so by re-encoding so that a keyframe is present at the desired start time. Some players can disregard the edit list and play the entire file from beginning to end, regardless of the edit list. If this does not work for you, it is you are likely using an older version of FFmpeg or that your player does not support edit lists. I am currently using this command to trim video, ffmpeg -ss 00:00:00 -t 00:00:04 -i inputFile.mp4 -async 1 -vcodec copy -acodec copy outputFile. If you’re using the latest version of FFmpeg from git master, it’ll use an edit list when you run it with the command you give. In other words, if the closest keyframe before 3s is at 0s, the video will be copied starting at 0s, and FFmpeg will use an edit list to tell the player to begin playing 3 seconds in. Using an edit list, it is possible to cut at a non-keyframe with the mp4 container without re-encoding. to H.264 using -c:v libx264 as shown above.

You will therefore have to re-encode the video, e.g. Non-keyframes need all of the data beginning with the previous keyframe because they encode variations from other frames. Note that cutting on exact frames with bitstream copy (-c:v copy) is not possible, since not all frames are intra-coded (keyframes).A video must begin with a keyframe to be decoded properly. You probably don’t have a keyframe at the specified second mark if you can’t cut a video at a particular moment. The stream sent to the second output of split, labelled as tmp, is processed through the crop filter, which crops away the lower half part of the video, and. In GNU/Linux tagged cut / ffmpeg / time by Tux
