Opened 4 years ago

Last modified 3 months ago

#3123 new enhancement

Request: Support MKV files with ordered chapters

Reported by: 11rcombs Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: mkv
Cc: rodger.combs@gmail.com, dave@dericed.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary: In MKV files with ordered chapters from external files, the external chapters are skipped, rather than the files being found, read, and decoded.
How to reproduce:

% ffmpeg -i file_with_ordered_chapters.mkv … output.mp4
ffmpeg version N-58014-g199b8fb Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov 10 2013 13:22:37 with Apple LLVM version 5.0 (clang-500.1.58) (based on LLVM 3.3svn)
...

Expected outcome:
Output file contains the entire timeline, as would be played in a video player with ordered chapters support.
Actual outcome:
Output file contains the portion of the timeline included in the input MKV files, but skips portions encoded in external files.

Change History (5)

comment:1 Changed 4 years ago by cehoyos

  • Keywords mkv added; Matroska Chapters AVFormat removed
  • Priority changed from normal to wish

To make this a valid ticket please provide the failing command line together with the complete, uncut console output and provide a sample.

comment:2 Changed 4 years ago by 11rcombs

# mkvinfo Toradora\ 01.mkv | gist
https://gist.github.com/7403174
# mkvinfo Toradora\ OP1.mkv | gist
https://gist.github.com/7403180
# mkvinfo Toradora\ ED1.mkv | gist
https://gist.github.com/7403184
# mediainfo Toradora\ 01.mkv Toradora\ OP1.mkv Toradora\ ED1.mkv | gist
https://gist.github.com/7403066
# ffmpeg -i Toradora\ 01.mkv -preset ultrafast out.mp4 | gist 2>&1
https://gist.github.com/7403072
# mediainfo out.mp4 | gist
https://gist.github.com/7403078

(Output does not contain OP or ED)

Note that mkvinfo reports ChapterSegmentUID, and that the OP and ED chapters' ChapterSegmentUIDs match with their respective files' UIDs.
Recommended solution for searching: Provide 2 new options:

  1. -searchdir <directory path> (search directory recursively for .mkv and .mka files until all needed files are found)
  2. -extfile [uuid:]<file path/URI> (If uuid is specified, keep track of this URI and use it if a chapter requires that UUID. If unspecified, read the EBML header from the URL and do the same)

I'm not partial to the names or the arg formatting, but the functionality seems useful. -searchdir would be useful for simply transcoding a local file (perhaps default to the dirname of each input file?); -extfile would be useful if the user knows which files will be required, or if ffmpeg is being called programatically by a system that knows paths of multiple remote files and has metadata about them (e.g. a transcoding media server).

I'll see if I can figure out how to make a minimal sample with mkvmerge later today; most recent anime series encoded by Coalgirls use this.

Last edited 4 years ago by 11rcombs (previous) (diff)

comment:3 Changed 10 months ago by dericed

  • Cc dave@dericed.com added

comment:4 Changed 3 months ago by vertigo

It looks like this is stalled, but I just wanted to provide a couple links to provide more input on the issue, in case it helps the ffmpeg devs to understand what the goal is, and to show there are actually quite a few people that are waiting on this.

https://forum.kodi.tv/showthread.php?tid=55764

https://forum.kodi.tv/showthread.php?tid=214462x

comment:5 Changed 3 months ago by dericed

@vertigo, this is ugly, but here's my workaround for now https://github.com/mediamicroservices/mm/blob/996b5902e9987e97265190b274175cca294a43b6/mmfunctions#L999-L1036. This uses mkvextract to get the chapters as xml, xmlstarlet to pick out the right ordered edition, and the creates a ffconcat input based on the edition chapters' in and out points.

Note: See TracTickets for help on using tickets.