13

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?

2 Answers 2

21

Try adding this ffmpeg parameter:

-map_chapters -1
2
  • 2
    This only removes the chapter ToC, and doesn't affect the actual video stream.
    – Gyan
    Commented Jan 6, 2017 at 5:01
  • Finally, thank you!!
    – Riveascore
    Commented Oct 4 at 21:07
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 and acknowledge you have read our privacy policy.

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