Opened 5 years ago

Closed 5 years ago

#2785 closed defect (fixed)

Matroska muxer produces non spec conformant files when adding chapters

Reported by: jamal Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mkv
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by jamal)

Take any file with chapters (Like the sample from ticket #1833) and remux it into an mkv file:

./ffmpeg -i vorbis_chapter_extension_demo.ogg -c:a copy vorbis_chapter_extension_demo.mkv

Then open the resulting file with the spec conformance checker tool mkvalidator from http://www.matroska.org/downloads/mkvalidator.html.
This shows up in the output:

ERR200: Missing element 'SimpleTag' in Tag at 4417
ERR200: Missing element 'SimpleTag' in Tag at 4441
ERR200: Missing element 'SimpleTag' in Tag at 4465
ERR200: Missing element 'SimpleTag' in Tag at 4489

If you for example comment out the for() statement from http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/matroskaenc.c;h=7efda5ab6bbda78153947d39dfcef55d6fb7c8bf;hb=HEAD#l897 (Which adds tags to each chapter) and recompile ffmpeg, the resulting mkv file is valid.

Change History (7)

comment:1 Changed 5 years ago by jamal

  • Description modified (diff)

comment:2 Changed 5 years ago by cehoyos

  • Keywords mkv added; matroska removed

comment:3 Changed 5 years ago by richardpl

That code adds metadata of each chapter? What is correct way to write such metadata?

comment:4 Changed 5 years ago by jamal

Looking at http://matroska.org/technical/specs/tagging/example-video.html it would seem that at least one SimpleTag? for things like "title" or such are needed.
Currently, mkv_write_simpletag() in matroskaenc.c is called for everything except "title" and "stereo_mode".

By letting it call mkv_write_simpletag() for "title" tags when they are for chapters, the file validates.
It also validates if i let it call mkv_write_simpletag() for any "title" tag whatsoever, be it for chapter or not. So no idea why the line i linked above is filtering them.

comment:5 Changed 5 years ago by richardpl

  • Status changed from new to open

comment:6 Changed 5 years ago by jamal

Ok, "title" and "stereo_mode" metadata entries are correctly being filtered here, but when they are the only ones available, the muxer creates a tag without any SimpleTag? element inside, which should not happen.

I just sent a patch to ffmpeg-devel to check for valid metadata entries before calling mkv_write_tag(), that will prevent the creation of empty tags.

comment:7 Changed 5 years ago by jamal

  • Resolution set to fixed
  • Status changed from open to closed
Note: See TracTickets for help on using tickets.