Opened 4 years ago

Last modified 4 years ago

#3259 new defect

MP4 chapter metadata issues: map_metadata failures

Reported by: y3kcjd5 Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: mov chapters metadata
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

OK, I'm having two really annoying problems with chapter metadata in mp4 files. The first one I'm dearly hoping is just command syntax misuse on my part, but I cannot for the life of me find documentation on the subject. The second problem involves much more weird behavior. I can't tell if the two problems are actually different symptoms of the same cause or not, but they both deal with mp4 chapter metadata, so I'm lumping them together for now.

ENVIRONMENT:
win764bit using latest builds from Zeranoe

PROBLEM 1:
If I have an mp4 file (e.g. "metatst.mp4") with chapters in it I can set chapter metadata using something like -metadata:c:0 title=ch_title and something like -map_metadata:s:0 0:s:0 or even -map_metadata:s 0:s works, but when I try anything like -map_metadata:c:0 0:c:0 I get a fatal error:

ffmpeg started on 2013-12-30 at 22:04:55
Report written to "ffmpeg-20131230-220455.log"
Command line:
ffmpeg -i metatst.mp4 -report -map_metadata:c:0 0:c:0 -c copy metatst2.mp4
ffmpeg version N-59275-g9b195dd Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 21 2013 22:06:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 58.101 / 52. 58.101
  libavcodec     55. 45.103 / 55. 45.103
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.100 /  4.  0.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument 'metatst.mp4'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-map_metadata:c:0' ... matched as option 'map_metadata' (set metadata information of outfile from infile) with argument '0:c:0'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'metatst2.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file metatst.mp4.
Successfully parsed a group of options.
Opening an input file: metatst.mp4.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002827680] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002827680] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002827680] Before avformat_find_stream_info() pos: 485573 bytes read:34864 seeks:1
[h264 @ 0000000000307c80] Detected GBR colorspace.
[h264 @ 0000000000307c80] no picture 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002827680] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000002827680] After avformat_find_stream_info() pos: 7081 bytes read:67632 seeks:2 frames:2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'metatst.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.22.100
  Duration: 00:00:01.13, start: 0.094000, bitrate: 3446 kb/s
    Chapter #0.0: start 0.000000, end 0.500000
    Metadata:
      title           : 
    Chapter #0.1: start 0.500000, end 1.033000
    Metadata:
      title           : 
    Stream #0:0(und), 1, 1/24000: Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(tv, GBR), 1280x720 [SAR 1:1 DAR 16:9], 3030 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und), 1, 1/48000: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 410 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Successfully opened the file.
Parsing a group of options: output file metatst2.mp4.
Applying option map_metadata:c:0 (set metadata information of outfile from infile) with argument 0:c:0.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: metatst2.mp4.
Invalid chapter index 0 while processing metadata maps.
[AVIOContext @ 0000000004b40da0] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0000000002827c60] Statistics: 67632 bytes read, 2 seeks

Is the syntax for mapping chapter metadata supposed to be different from streams and the -metadata tag somehow? I couldn't find any documentation to that effect.

PROBLEM 2:
If I try to create an mp4 file with chapters in it and I do not include -map_metadata:c -1 in my command line, the resulting file will, for some bizarre reason, get a weird text stream tacked on to it invisibly. This stream doesn't show up anywhere in the creation log, and cannot be edited by ffmpeg in any way (trying to modify or add to its metadata has no effect). but a subsequent ffprobe will reveal its presence. My best guess is that this 'stream' contains the chapter metadata, but I am confounded as to why chapter metadata should show up in its own little fake stream while all other metadata is handled transparently. Example with metatst.mp4:

ffmpeg started on 2013-12-30 at 22:02:26
Report written to "ffmpeg-20131230-220226.log"
Command line:
ffmpeg -i metatst.mp4 -report -c copy metatst2.mp4
ffmpeg version N-59275-g9b195dd Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec 21 2013 22:06:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 58.101 / 52. 58.101
  libavcodec     55. 45.103 / 55. 45.103
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.100 /  4.  0.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument 'metatst.mp4'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'metatst2.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file metatst.mp4.
Successfully parsed a group of options.
Opening an input file: metatst.mp4.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000357a60] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000357a60] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000357a60] Before avformat_find_stream_info() pos: 485573 bytes read:34864 seeks:1
[h264 @ 000000000035b4c0] Detected GBR colorspace.
[h264 @ 000000000035b4c0] no picture 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000357a60] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000357a60] After avformat_find_stream_info() pos: 7081 bytes read:67632 seeks:2 frames:2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'metatst.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.22.100
  Duration: 00:00:01.13, start: 0.094000, bitrate: 3446 kb/s
    Chapter #0.0: start 0.000000, end 0.500000
    Metadata:
      title           : 
    Chapter #0.1: start 0.500000, end 1.033000
    Metadata:
      title           : 
    Stream #0:0(und), 1, 1/24000: Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(tv, GBR), 1280x720 [SAR 1:1 DAR 16:9], 3030 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und), 1, 1/48000: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 410 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Successfully opened the file.
Parsing a group of options: output file metatst2.mp4.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: metatst2.mp4.
Successfully opened the file.
Output #0, mp4, to 'metatst2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.22.100
    Chapter #0.0: start 0.094000, end 0.594000
    Metadata:
      title           : 
    Chapter #0.1: start 0.594000, end 1.127000
    Metadata:
      title           : 
    Stream #0:0(und), 0, 1/24000: Video: h264 ([33][0][0][0] / 0x0021), gbrp, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 3030 kb/s, 23.98 fps, 24k tbn, 24k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und), 0, 1/48000: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 410 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
frame=   27 fps=0.0 q=-1.0 Lsize=     475kB time=00:00:01.10 bitrate=3505.7kbits/s    

video:417kB audio:56kB subtitle:0 global headers:0kB muxing overhead 0.557476%
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0000000002659ec0] Statistics: 86 seeks, 148 writeouts
[AVIOContext @ 0000000000358060] Statistics: 520389 bytes read, 2 seeks
ffprobe started on 2013-12-30 at 22:02:54
Report written to "ffprobe-20131230-220254.log"
Command line:
ffprobe metatst2.mp4 -report
ffprobe version N-59275-g9b195dd Copyright (c) 2007-2013 the FFmpeg developers
  built on Dec 21 2013 22:06:20 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 58.101 / 52. 58.101
  libavcodec     55. 45.103 / 55. 45.103
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.100 /  4.  0.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000002fc680] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000002fc680] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000002fc680] Before avformat_find_stream_info() pos: 486124 bytes read:68179 seeks:3
[h264 @ 000000000030d620] Detected GBR colorspace.
[h264 @ 000000000030d620] no picture 
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000002fc680] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000002fc680] After avformat_find_stream_info() pos: 7085 bytes read:100947 seeks:4 frames:2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'metatst2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.22.100
  Duration: 00:00:01.20, start: 0.000000, bitrate: 3230 kb/s
    Chapter #0.0: start 0.000000, end 0.594000
    Metadata:
      title           : 
    Chapter #0.1: start 0.594000, end 1.127000
    Metadata:
      title           : 
    Stream #0:0(und), 1, 1/24000: Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(tv, GBR), 1280x720 [SAR 1:1 DAR 16:9], 3030 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und), 1, 1/48000: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 378 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng), 0, 1/1000: Subtitle: mov_text (text / 0x74786574), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
detected 2 logical cores
[AVIOContext @ 0000000000304ca0] Statistics: 100947 bytes read, 4 seeks

Note the third stream (index 2) that only shows up in the ffprobe report. Moreover, as previously mentioned, the only way to prevent this weirdostream from appearing is to include -map_metadata:c -1 (or -map_metadata -1) in the command line. This means that even if there is no actual chapter metadata, one such superfluostream is (aggravatingly) still generated by default (as demonstrated above).

Attachments (1)

metatst.mp4 (474.2 KB) - added by y3kcjd5 4 years ago.
test file (that doesn't have a superfluostream, check it with ffprobe)

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by y3kcjd5

test file (that doesn't have a superfluostream, check it with ffprobe)

comment:1 in reply to: ↑ description Changed 4 years ago by cehoyos

Replying to y3kcjd5:

OK, I'm having two really annoying problems with chapter metadata in mp4 files.

If you found two problems, please open two tickets. Otherwise, it will be impossible to manage the tickets on this tracker.

comment:2 Changed 4 years ago by y3kcjd5

  • Summary changed from MP4 chapter metadata issues: map_metadata failures and weird/superflous text streams to MP4 chapter metadata issues: map_metadata failures

OK then make this one for the -map_metadata failures, just ignore everything in the description after "PROBLEM 2"; I made another ticket for that: #3267

comment:3 Changed 4 years ago by cehoyos

  • Keywords mov added; mp4 removed
  • Version changed from unspecified to git-master
Note: See TracTickets for help on using tickets.