Opened 13 years ago

Last modified 4 years ago

#3123 new enhancement

Request: Support MKV files with ordered chapters

Reported by: Ridley Combs Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: mkv
Cc: rodger.combs@gmail.com, dave@dericed.com, jou@gmx.net 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 (14)

comment:1 by Carl Eugen Hoyos, 13 years ago

Keywords: mkv added; Matroska Chapters AVFormat removed
Priority: normalwish

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 by Ridley Combs, 13 years ago

# 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)

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.

Version 0, edited 13 years ago by Ridley Combs (next)

comment:3 by dave rice, 9 years ago

Cc: dave@dericed.com added

comment:4 by vertigo, 9 years ago

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 by dave rice, 9 years ago

@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.

comment:6 by JouMxyzptlk, 8 years ago

Cc: jou@gmx.net added

comment:7 by JouMxyzptlk, 8 years ago

That is a pretty annoying and unexpected bug to skip chapters unexpectedly.
Especially when the console tells me that the chapters are all detected.
Now I a forced to check my older encodings which were a wasted time.
Who introduces such stupidness in the code as default behaviour?

ffmpeg.exe -y -i "%%X" -vf "hqdn3d=4:3:7:6" -c:v libx264 -preset veryslow -tune animation -level 5.2 -profile:v high -crf 22 -codec:a libvorbis -q:a 6  "out1\%%X"
Output #0, matroska, to 'out1\1.mkv':
  Metadata:
    encoder         : Lavf57.83.100
    Chapter #0:0: start 0.000000, end 92.030000
    Metadata:
      title           : Opening
    Chapter #0:1: start 0.000000, end 669.640000
    Metadata:
      title           : Part 1
    Chapter #0:2: start 669.669000, end 1359.330000
    Metadata:
      title           : Part 2
    Stream #0:0(eng): Video: h264 (libx264) (H264 / 0x34363248), yuv420p(progressive), 1440x1080 [SAR 1:1 DAR 4:3], q=-1--1, 23.98 fps, 1k tbn, 23.98 tbc (default)
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(jpn): Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, stereo, fltp (16 bit) (default)
    Metadata:
      encoder         : Lavc57.107.100 libvorbis
    Stream #0:2(eng): Subtitle: ass (ssa) (default)
    Metadata:
      encoder         : Lavc57.107.100 ssa
frame= 6158 fps=8.4 q=-1.0 Lsize=  161724kB time=00:04:16.71 bitrate=5160.7kbits/s speed=0.35x

comment:8 by JouMxyzptlk, 8 years ago

It does not even list chapter 4, which is the ending.
Well, I will push the files through mkvtoolnix to remove all chapter info and then add it after encoding.
ffmpeg 3.4.1 is still doing that very stupid behaviour.

Last edited 8 years ago by JouMxyzptlk (previous) (diff)

in reply to:  7 ; comment:9 by Carl Eugen Hoyos, 8 years ago

Replying to JouMxyzptlk:

That is a pretty annoying and unexpected bug to skip chapters unexpectedly.

Would you like to add a sample that allows reproducing the issue?

in reply to:  9 ; comment:10 by JouMxyzptlk, 8 years ago

Replying to cehoyos:

Replying to JouMxyzptlk:

That is a pretty annoying and unexpected bug to skip chapters unexpectedly.

Would you like to add a sample that allows reproducing the issue?

Here: http://joumxyzptlk.de/tmp/1.mkv
Tell when you got it so I can remove it.
Thank you for taking a look into it.

in reply to:  10 ; comment:11 by Carl Eugen Hoyos, 8 years ago

Replying to JouMxyzptlk:

Replying to cehoyos:

Would you like to add a sample that allows reproducing the issue?

Here: http://joumxyzptlk.de/tmp/1.mkv

Are you sure this file contains ordered chapters from external files, which is what this ticket is about?

in reply to:  11 comment:12 by JouMxyzptlk, 8 years ago

Replying to cehoyos:

Replying to JouMxyzptlk:

Replying to cehoyos:

Would you like to add a sample that allows reproducing the issue?

Here: http://joumxyzptlk.de/tmp/1.mkv

Are you sure this file contains ordered chapters from external files, which is what this ticket is about?

Oh, sorry. Should I make a separate ticket?

comment:13 by dave rice, 8 years ago

I suggest that support for ordered chapters and linked Matroska files be separate. I made a sample file at https://archive.org/download/chapters_test/chapters_test.mkv (more info at https://archive.org/details/chapters_test). This includes at 25 second video whether the default ordered chapter only shows from 15 seconds to 20 seconds of it. In VLC, the video only plays those 5 seconds unless the non-default chapter editions are selected.

comment:14 by bear, 4 years ago

Adding to the downstream Kodi reports above, the downstream Jellyfin request linked to this is https://features.jellyfin.org/posts/390/support-mkv-ordered-chapters-segment-linking

Note: See TracTickets for help on using tickets.