4

I have a video file, video.mp4. This file has 3 chapters, 'Beginning', 'Middle' and 'End'. I want to delete chapter 'Middle' (the actual video, not just the metadata) and combine chapters 'Beginning' and 'End' back into one file. The chapters appear to be stored as subtitles.

How can I do this with ffmpeg?

6

ffmpeg parameters : -map_chapters -1

  • 1
    This only removes the chapter ToC, and doesn't affect the actual video stream. – Gyan Jan 6 '17 at 5:01
0

I'm unaware of a function similar Mkvtoolnix' split before chapters functionality in ffmpeg, so you probably have to use seeking or MP4box as one has suggested in this thread. You are likely to face the same issues as have been reported for mkvmerge/Mkvtoolnix, being that splitting is not accurate for compressed video streams and can only be done at key frame boundaries. There is probably no way around loading the file into a video editor, cutting and re-encoding it for an accurate result… or splitting and re-encoding with ffmpeg instead of just copying the stream data.

I haven't heard of a format for chapters in subtitles, are these just regular subtitles? If so, which format? In this case you probably need to parse the file and extract or reformat the time codes if necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.