Problems setting tags after using mp4box and/or mp4v2 to add chapters

After using mp4tags and/or mp4box to add chapters to an mp4 file, mp3tag refuses to set any tags on that file.

When you try to set a tag (such as title) it says the tag has been set but it actually ERASES all the tags in the file. In addition, in some instances, mp3tag will set the title of the first chapter to the same value you were attempting to set to the title field.

  1. Demux and remux a file to get a clean one:
    ffmpeg -i a.mp4 -map 0:v -c:v copy -bsf:v h264_mp4toannexb a.h264 -map 0:a -c:a copy a.aac
    
    MP4Box -brand mp42 -delay 1=1 -add "a.h264:name=AVC Video Stream:lang=en:fps=23.976" -add "a.aac:name=HE-AAC Audio Stream:lang=en:sbr:mpeg4" -itags tool="MP4Box" "a.mp4"</li><li>Use MP3TAG to set the title and year tags. This will succeed.</li><li>Add chapters to the file using mp4tags (mp4v2) or mp4box:
    mp4chaps --import a.mp4
    
    OR
    
    mp4box -chap a.chapters.txt a.mp4
    

    Make sure you have a couple of named chapters in the a.chapters.txt file.

  2. then run MP3TAG again and try to change the title.

If you added chapters with mp4box, MP3TAG will clear all tags and set the title of the first chapter to the value you were attempting to set the title to. It will set the title of all subsequent chapters to the PREVIOUS value of title. MP3TAG will report that it set the tag ("Saved tag in 1 of 1 files") but will show all the tags as cleared and further checks show that they are, in fact, cleared.

If you added chapters with mp4chaps, MP3TAG will clear all tags and leave the chapters untouched. MP3TAG will report that it successfully set the tag ("Saved tag in 1 of 1 files") but will show all the tags as cleared and further checks show that they are, in fact, cleared.

In both instances MP3TAG will fail to set tags any further on those files while continuing to report success. If you added chapters with mp4box, it will continue to set the title of the first chapter if you try to modify the title field. Curiously, MP3TAG will allow you to add artwork after adding the chapters.

iTunes continues to accept these files and modify the tags without any problems I can detect. Similarly, I have had some success using mp4v2 and tag-sharp to set tags further. In these cases, MP3TAG will initially display the correct values but will still refuse to alter them, clearing them instead.

When the tags are cleared, output of ppfrobe -show_format gives something like this:

ffprobe version N-53167-g5437284 Copyright © 2007-2013 the FFmpeg developers
  built on May 16 2013 20:57:58 with gcc 4.8.0 (GCC)
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/drs/ffmpeg/sandbox/mingw-w64-x86_64/bin/x86_64-w64-mingw32-
--pkg-config=pkg-config --enable-gpl --enable-libsoxr --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enab
le-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnu
tls --enable-libgsm --enable-libfreetype --enable-fontconfig --enable-libass --enable-libutvideo --enable-libopus --disable-w32threa
ds --enable-frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --
enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libbluray --enable-lib
vpx --enable-libilbc --enable-static --disable-shared --enable-nonfree --enable-libfdk-aac --enable-runtime-cpudetect
  libavutil      52. 32.100 / 52. 32.100
  libavcodec     55.  9.100 / 55.  9.100
  libavformat    55.  7.100 / 55.  7.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 68.101 /  3. 68.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000021f08e0] stream 0, timescale not set
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000021f08e0] max_analyze_duration 5000000 reached at 5005000 microseconds
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2013-06-13 18:16:11
    encoder         : MP4Box
  Duration: 01:37:32.78, start: 0.000000, bitrate: 5082 kb/s
    Chapter #0.0: start 0.000000, end 277.777000
    Metadata:
      title           : Chapter 1
    Chapter #0.1: start 277.777000, end 532.615000
    Metadata:
      title           : Chapter 2
    Chapter #0.2: start 532.615000, end 987.153000
    Metadata:
      title           : Chapter 3
    Chapter #0.3: start 987.153000, end 1188.729000
    Metadata:
      title           : Chapter 4
    Chapter #0.4: start 1188.729000, end 1403.819000
    Metadata:
      title           : Chapter 5
    Chapter #0.5: start 1403.819000, end 1739.321000
    Metadata:
      title           : Chapter 6
    Chapter #0.6: start 1739.321000, end 2008.924000
    Metadata:
      title           : Chapter 7
    Chapter #0.7: start 2008.924000, end 2362.277000
    Metadata:
      title           : Chapter 8
    Chapter #0.8: start 2362.277000, end 2685.558000
    Metadata:
      title           : Chapter 9
    Chapter #0.9: start 2685.558000, end 3169.375000
    Metadata:
      title           : Chapter 10
    Chapter #0.10: start 3169.375000, end 3528.942000
    Metadata:
      title           : Chapter 11
    Chapter #0.11: start 3528.942000, end 3960.290000
    Metadata:
      title           : Chapter 12
    Chapter #0.12: start 3960.290000, end 4429.342000
    Metadata:
      title           : Chapter 13
    Chapter #0.13: start 4429.342000, end 4836.957000
    Metadata:
      title           : Chapter 14
    Chapter #0.14: start 4836.957000, end 5388.174000
    Metadata:
      title           : Chapter 15
    Chapter #0.15: start 5388.174000, end 5852.763000
    Metadata:
      title           : Chapter 16
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1040 [SAR 1:1 DAR 24:13], 4916 kb/s, 23.98 fps, 23.98 tb
r, 24k tbn, 47.95 tbc
    Metadata:
      creation_time   : 2013-06-13 18:16:11
      handler_name    : AVC Video Stream
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 96000 Hz, 5.1, fltp, 160 kb/s
    Metadata:
      creation_time   : 2013-06-13 18:18:02
      handler_name    : HE-AAC Audio Stream
    Stream #0:2(und): Subtitle: mov_text (text / 0x74786574)
    Metadata:
      creation_time   : 2013-06-13 18:31:45
    Stream #0:3: Video: mjpeg, yuvj444p, 1000x1500 [SAR 72:72 DAR 2:3], 90k tbr, 90k tbn, 90k tbc
[FORMAT]
filename=a.mp4
nb_streams=4
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=0.000000
duration=5852.778333
size=3718157824
bit_rate=5082246
TAG:major_brand=mp42
TAG:minor_version=0
TAG:compatible_brands=isomavc1mp42
TAG:creation_time=2013-06-13 18:16:11
TAG:encoder=MP4Box
[/FORMAT]

Please let me know if I can provide any further diagnostic information for you.

It's a great tool! This one has had me stumped for a couple of days, though. Thanks again,
Bill /)

Further testing: For whatever reason, the chapters created by Drax and Handbrake do not cause problems with MP3TAG. I don't know how to tell what they are doing differently than mp4v2\mp4chaps and mp4box. Once a file has been rendered uneditable by one of those two tools, however, the only way I know of to get it back to a state where it can be edited with MP3TAG is to remux it.

This problem existed in puddletag 1.0RC1, but has been fixed there, at least in puddletag 1.0.2RC1.

Since that is an open source project the fix can be seen in there.

The bug still exists in MP3TAG 2.5.7

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.