tools icon indicating copy to clipboard operation
tools copied to clipboard

Mime package does not recognize 3gp4 and 3gp2 magic numbers

Open Xentraxx opened this issue 5 months ago • 0 comments

A user reported the following issue: https://github.com/Xentraxx/GooglePhotosTakeoutHelper/issues/60

I ran some tests and noticed that [0x00, 0x00, 0x00, 0x14, 0x66, 0x74, 0x79, 0x70, 0x33, 0x67, 0x70, 0x34] (magic number for 3gp4) is not being detected as 3gp.

[0x00, 0x00, 0x00, 0x14, 0x66, 0x74, 0x79, 0x70, 0x33, 0x67, 0x70, 0x32] (magic number for 3gp2) is not being detected as 3gp.

In both cases, the mime package incorrectly returns "video/mp4".

However, [0x00, 0x00, 0x00, 0x14, 0x66, 0x74, 0x79, 0x70, 0x33, 0x67, 0x70, 0x35] (magic number for 3gp5) is being detected as 3gp (returns "video/3gpp").

The last 3 bytes are the brand identifiers.

So to summarize, the mime package doesn't correctly return the 3gp mime type for 3gp4 and 3gp2 files. Only 3gp5 is being detected correctly.

Xentraxx avatar Jul 14 '25 19:07 Xentraxx