Comment 18 for bug 502642

Revision history for this message
Oliver Joos (oliver-joos) wrote : Re: .ts files always get recognized as application/x-linguist and never as video/mpeg (transport stream)

You can read upstream how magic was determined. Basically I took the proposal of Stanislav and adapted it after reading about mpeg headers on rfc3555 and Wikipedia (details on https://bugs.freedesktop.org/show_bug.cgi?id=14276#c7)

The attached sample file is a video/mp2t, recorded by a common settop box. Stanislavs files seem to have slightly different header bits. This file is ok for testing. But for the magic I still prefer to obey as close as possible the standards for mpeg transport streams.

BUT...!! As a final test I applied the patch and then checked the mimetype of almost every file in my installed Karmic. This includes the sources and testfiles of shared-mime-info. (warning: this took hours!):

  $ sudo find /bin /boot /etc /home /lib /opt /root /sbin /tmp /usr /var \
     -xdev -type f -exec mimetype \{\} \; | grep video/mp2t

Unfortunately I found that files beginning with 'GIMP' also match the magic and gimp resource files are not yet in the mime-database (so tweaking priorities is not a solution). Therefore I will try to tighten the magic to exclude those files. Please stay tuned...