I think you understand that some transcoding is inevitable. You may be able to avoid re-encoding the entire video using the following approach:
- Divide the video into two parts: the first GOP and the rest of the video. You should be able to do this without re-encoding (use
-vcodec copy ) - Transform the first GOP into something that you can easily cut, like YUV
- Cut yuv file
- Re-encode the section file using the same parameters as the original video (you can get them from
ffprobe . - Attach the re-encoded section file to the rest of the video (from the first step). Again, you should use
-vcodec copy to ensure that re-encoding is not performed.
I've never had to do this, but the FAQ seems to have a section on joining video files.
misha source share