News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Bug: wrong BeatsPerMinute data type in MP4

Started by dae65, August 05, 2020, 02:42:29 PM

Previous topic - Next topic

dae65

ExifTool 12.03 writes the QuickTime ItemList BeatsPerMinute tag as a 16-bit unsigned integer. This seems to be a bug. I believe it should be a signed integer instead.

Apple iTunes (12.06) and AtomicParsley (0.9.6) don't read ilst.tmpo atoms as written by ExifTool (12.03), although ExifTool reads it as written by them.

There is a comment to Image::ExifTool::QuickTime saying that tmpo is an int16u in your sample:

%Image::ExifTool::QuickTime::ItemList = (
[...]
    tmpo => {
        Name => 'BeatsPerMinute',
        Format => 'int16u', # marked as boolean but really int16u in my sample
    },


But, as an int16u, iTunes and AtomicParsley ignore it. See bpm on this screenshot for iTunes, and this for AtomicParsley:

$ exiftool -ItemList:BeatsPerMinute=100 exiftool.m4a
    1 image files updated
$ AtomicParsley exiftool.m4a -t | grep -w tmpo
$


But if we change the Format key to int16s, then they're able to read it. See another screenshot for iTunes and this for AtomicParsley:
$ exiftool -ItemList:BeatsPerMinute=100 exiftool.m4a
    1 image files updated
$ AtomicParsley exiftool.m4a -t | grep -w tmpo
Atom "tmpo" contains: 100


A tmpo.data atom edited with ExifTool 12.03 comes with a 0x16 data-type flag:


$ hexdump -C -s 77134 -n 26 exiftool.m4a
00012d4e  00 00 00 1a 74 6d 70 6f  00 00 00 12 64 61 74 61  |....tmpo....data|
00012d5e  00 00 00 16 00 00 55 c4  00 64                    |......U..d|
00012d68


But a tmpo.data atom edited with either iTunes or AtomicParsley comes with a 0x15 data-type flag:


$ hexdump -C -s 77129 -n 26 itunes.m4a
00012d49  00 00 00 1a 74 6d 70 6f  00 00 00 12 64 61 74 61  |....tmpo....data|
00012d59  00 00 00 15 00 00 00 00  00 64                    |.........d|
00012d63

$ hexdump -C -s 78843 -n 26 atomicparsley.m4a
000133fb  00 00 00 1a 74 6d 70 6f  00 00 00 12 64 61 74 61  |....tmpo....data|
0001340b  00 00 00 15 00 00 00 00  00 64                    |.........d|
00013415


0x15 (21) is a signed, 0x16 (22) is an unsigned, integer (QuickTime specification).

Finally, here and here is the code showing that AtomicParsley writes tmpo as a signed integer.

Thank you. :)

Phil Harvey

Great, thanks.  I'll patch this in ExifTool 12.04

- Phil

P.S.  I would like to see a negative beats per minute!  And brain-dead software that won't read something because it isn't the expected format really bugs me (you eventually get into the situation where one piece of software will only read a tag written in format X, while another requires format Y).
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

dae65

Quote from: Phil Harvey on August 05, 2020, 05:24:49 PM
P.S.  I would like to see a negative beats per minute!

;D you've just given me an idea.

dae65

Phil,

Other integer QuickTime tags such as Compilation have the same signed/unsigned data-type issue. I will report in another thread soon.

d