file command reports incorrect mime type for mkv files

Bug #420963 reported by David D Miller
36
This bug affects 7 people
Affects Status Importance Assigned to Milestone
file (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: file

libmagic1-4.26-2ubuntu4

running "file -i" on an mkv file (matroska video) results in "application/octet-stream" for the mime type. While not technically inaccurate, the generally accepted type for this filetype at the moment is "video/x-matroska" which can be evidenced by looking in /etc/mime.types, where it's already defined this way.

Revision history for this message
Austriaco (lanieves) wrote :

There's one line missing in /usr/share/misc/magic which specifies the mime type. The addition can be made in /etc/magic for the time being, until the fix is adopted in libmagic1

$ file -bi /media/video/my.Video.mkv
video/x-matroska; charset=binary

Revision history for this message
Adam Buchbinder (adam-buchbinder) wrote :

This is fixed upstream as of version 5.04; it'll be in the development version of Ubuntu as soon as the next Debian sync.

Changed in file (Ubuntu):
status: New → Fix Committed
Revision history for this message
Austriaco (lanieves) wrote :

As of Maverick (10.10), this has not been fixed and now the solution I provided above doesn't work either

Revision history for this message
Austriaco (lanieves) wrote :

Not all MKV files are wrongly detected after upgrading file and libmagic1 to version 5.04. Only files produced by the new mkvmerge from mkvtoolnix-4.0.0-0ubuntu3. Matroska files produced by the previous mkvmerge are detected alright:

Mime Type Muxing application
application/octet-stream libebml v1.0.0 + libmatroska v1.0.0
video/x-matroska libebml v0.7.7 + libmatroska v0.8.1

An inspection of the mis-identified files shows that they have a little more info at the beginning:

$ hexdump -C new-matroska-file.mkv | head -7
00000000 1a 45 df a3 a3 42 86 81 01 42 f7 81 01 42 f2 81 |.E...B...B...B..|
00000010 04 42 f3 81 08 42 82 88 6d 61 74 72 6f 73 6b 61 |.B...B..matroska|
00000020 42 87 81 02 42 85 81 02 18 53 80 67 01 00 00 00 |B...B....S.g....|
00000030 76 a4 26 1f 11 4d 9b 74 be 4d bb 8c 53 ab 84 15 |v.&..M.t.M..S...|
00000040 49 a9 66 53 ac 82 10 03 4d bb 8c 53 ab 84 16 54 |I.fS....M..S...T|
00000050 ae 6b 53 ac 82 10 b7 4d bb 8e 53 ab 84 1c 53 bb |.kS....M..S...S.|
00000060 6b 53 ac 84 76 a3 bb 1e 4d bb 8c 53 ab 84 10 43 |kS..v...M..S...C|

While the old ones are like this:

$hexdump -C old-matroska-file.mkv | head -7
00000000 1a 45 df a3 93 42 82 88 6d 61 74 72 6f 73 6b 61 |.E...B..matroska|
00000010 42 87 81 02 42 85 81 02 18 53 80 67 01 00 00 00 |B...B....S.g....|
00000020 3e 45 2b 2a 11 4d 9b 74 c0 4d bb 8c 53 ab 84 15 |>E+*.M.t.M..S...|
00000030 49 a9 66 53 ac 82 10 03 4d bb 8c 53 ab 84 16 54 |I.fS....M..S...T|
00000040 ae 6b 53 ac 82 10 b0 4d bb 8e 53 ab 84 11 4d 9b |.kS....M..S...M.|
00000050 74 53 ac 84 3e 44 36 01 4d bb 8e 53 ab 84 1c 53 |tS..>D6.M..S...S|
00000060 bb 6b 53 ac 84 3e 43 cd 9b ec 4f bb 00 00 00 00 |.kS..>C...O.....|

Revision history for this message
Austriaco (lanieves) wrote :

With this file in ~/.magic file detects correctly both versions of matroska

Revision history for this message
Ken Sharp (kennybobs) wrote :

Still present, not fixed in 5.09.

Changed in file (Ubuntu):
status: Fix Committed → Confirmed
Revision history for this message
Pauli Virtanen (pauli-virtanen) wrote :

Bug is still present in 5.11-2ubuntu4

Revision history for this message
Ken Sharp (kennybobs) wrote :

Fixed in Trusty+

Changed in file (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.