I need to define mime type of various video files and I got a problem with .m2ts files. Before I stumbled on this, I used
file utility with
-iL keys and parsed the output with
sed. Today I found that
file 5.15 defines mime type of .m2ts files as ‘application/octet-stream’. O-okay, I updated the package and now it calls them just ‘binary’. When I expected video/something.
Reading about utilities doing similar job, I’ve tried
xdg-mime query filetype. The problem with
xdg-mime is that it looks only at the extension of the file. It defines .m2ts as ‘video/mp2t’, but shows it for any, even an empty text file with such extension.
Maybe it was correct to call .m2ts files a stream because it is actually a stream, but then why in the mime database the extension is bound to ‘video/mp2t’?
$ grep m2ts /usr/share/mime/video/mp2t.xml <glob pattern="*.m2ts"/>