Bug report: WaveLab Pro 13 writes a malformed `trkn` — track number invisible in Apple Music

Bug report: WaveLab Pro writes a malformed iTunes trkn atom in M4A renders — track number invisible in Apple Music

Summary

When rendering to M4A (AAC), WaveLab Pro writes the iTunes-style track-number
atom (moov.udta.meta.ilst.trkn) with an invalid data-type indicator
(0x0000001F instead of 0x00000000) and a 7-byte value payload instead of
the standard 8 bytes. As a result, Apple Music / iTunes / Finder ignore the
tag entirely: the track number field shows up empty, although tools such as
ffprobe (which do not validate the type indicator) still display it.

Environment

  • WaveLab Pro 13.0.20 (build as reported in the ©too atom: “WaveLab Pro 13.0.20”)
  • macOS 26.5 (build 25F71), Apple Silicon
  • Render format: AAC (M4A), 128 kbps CBR, encoded through the bundled
    FFmpeg 8.0.1 (aac_at AudioToolbox encoder)
  • Track number set in the WaveLab montage / CD metadata: track 1 of 2

Steps to reproduce

  1. In WaveLab Pro, set up a render to M4A (AAC) with a track number in the
    metadata (e.g. track 1 of 2).
  2. Render the file.
  3. Import the resulting .m4a into Apple Music (or inspect it in Finder’s
    Get Info panel).

Expected result

The track number is displayed (“1 of 2”).

Actual result

The track number field is empty in Apple Music even
though the trkn atom is present in the file.

Analysis

Hex dump of the trkn atom as written by WaveLab (file offset 0x2A1470 in
the sample file):

00 00 00 1F 74 72 6B 6E   trkn box, size 31        <- should be 32
00 00 00 17 64 61 74 61   data box, size 23        <- should be 24
00 00 00 1F               type indicator = 0x1F    <- INVALID, must be 0x00
00 00 00 00               locale
00 00  00 01  00 02  00   payload: 7 bytes         <- should be 8:
                          pad, track=1, total=2,      pad(2) track(2)
                          1 trailing byte             total(2) pad(2)

The same atom as written by compliant taggers (AtomicParsley, iTunes, TagLib,
mutagen, FFmpeg’s mov muxer) — this is also the byte-exact form that fixed
the file:

00 00 00 20 74 72 6B 6E   trkn box, size 32
00 00 00 18 64 61 74 61   data box, size 24
00 00 00 00               type indicator = 0 ("reserved"/binary, implicit)
00 00 00 00               locale
00 00  00 01  00 02  00 00  payload: 8 bytes (pad, track, total, pad)

Two defects:

  1. Type indicator is 0x1F (31). Per Apple’s QuickTime File Format
    specification (“Metadata” chapter, Data Atoms and Well-Known Types),
    the 32-bit version/flags field of a metadata data atom holds a
    well-known data-type code. trkn/disk must use type 0
    (“reserved” — value interpreted implicitly by the atom type). Type 31 is
    not a registered well-known type, so Apple’s parsers discard the atom.
    Note that 0x1F (31) happens to be the size of the enclosing trkn box,
    which may hint at the underlying bug in the writer (a size value being
    written into the version/flags field).

  2. Payload is 7 bytes instead of 8. The trkn value is defined as four
    16-bit big-endian fields: padding, track number, track total, padding.
    WaveLab writes only one trailing padding byte, making both the data
    box (23 vs 24) and the trkn box (31 vs 32) one byte short.

Other atoms written by the same tagging pass are fine — e.g. the ©too
atom (“WaveLab Pro 13.0.20”) uses the correct type indicator 1 (UTF-8) and
correct sizes. Only the binary-typed number atoms are affected.

Evidence that the defect is in WaveLab’s tag writer (not FFmpeg)

  • The FFmpeg command line issued by WaveLab (captured via a logging
    wrapper) contains no -metadata track=... option, and replaying that
    exact command against the bundled ffmpeg binary produces an M4A with
    no trkn atom at all and ©too = “Lavf62.12.102”.
  • The final rendered file contains trkn and ©too = “WaveLab Pro
    13.0.20”: WaveLab rewrites the ilst after FFmpeg has finished.
  • FFmpeg’s mov muxer (mov_write_trkn_tag in libavformat/movenc.c)
    hard-codes the compliant 32/24-byte, type-0, 8-byte-payload form and is
    therefore incapable of producing the observed bytes.

Proof that this is the cause of the Apple Music symptom

Patching only the trkn atom of a rendered file to the compliant form
shown above (type indicator 0x1F → 0x00, payload padded to 8 bytes, box
sizes 31/23 → 32/24, parent ilst/meta/udta/moov sizes adjusted by
+1) — with the audio stream and every other byte untouched — makes Apple
Music display the track number correctly. Re-tagging with AtomicParsley
(--tracknum 1/2 --overwrite) has the same effect.

Suggested fix

In WaveLab’s MP4 metadata writer, for trkn (and presumably disk):
write 0x00000000 as the data atom’s version/flags (well-known type 0)
and an 8-byte payload (uint16 padding, uint16 number, uint16 total,
uint16 padding), giving data size 24 and trkn size 32.

References

  • Apple, QuickTime File Format Specification, “Metadata” chapter —
    “Data Atoms” and “Well-Known Types” (type 0 = reserved/implicit binary;
    list of valid type codes, which does not include 31).
  • ISO/IEC 14496-12 (box size/structure rules).
  • Interoperability references writing the compliant form: iTunes /
    Apple Music itself, AtomicParsley (AtomFlags_Data_Binary = 0, 4×uint16
    payload), TagLib, mutagen, FFmpeg libavformat/movenc.c.

A sample rendered file (before/after fix) can be provided on request.

I don’t know who you are, but thank you for this outstanding, detailed report. This will be fixed in WaveLab 13.0.30

Hard to discern these days between honest and wholesome human investigation/reporting, and something that’s the result of several prompts into a highly sophisticated AI coding engine…

Either way, bravo for the exemplary report.

I believe this report is a human finding that was then well laid out by some AI.
One of the best ways to use AI in many fields, in my opinion… Human first, then AI for polishing.

Hi all,

Thank you so much for taking this into consideration and I’m so glad that it will be fixed.

This is indeed the results of my human searches and findings and claude code finalizing the detailed report and also fixing my own ffmpeg wrapper which was lacking efficiency in waiting for wavelab to finalize the files.

Best from France, and really : THANK YOU!

Raph

Oh - I’m 100% with you on that.!

So happy to hear this was some actual ‘human effort’… :wink:

Ah.! Perfect… just as PG surmised… it is a terrific investigation/researched/laid out piece of work.!