Bug 440632 - Mimetype - MPEG-2 TS and Matroska video files flagged as audio/vnd.dts.hd
Summary: Mimetype - MPEG-2 TS and Matroska video files flagged as audio/vnd.dts.hd
Status: RESOLVED UPSTREAM
Alias: None
Product: frameworks-kfilemetadata
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.84.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Pinak Ahuja
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-05 15:02 UTC by tagwerk19
Modified: 2021-08-11 13:47 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tagwerk19 2021-08-05 15:02:56 UTC
SUMMARY:

    A MPEG-2 TS or Matroska file, with embedded DTS HD audio, is flagged
    as audio/vnd.dts.hd

STEPS TO REPRODUCE:

    Download a .m2ts video that has embedded DTS HD audio, check with

        xdg-mime query filetype testfile.m2ts 

OBSERVED RESULTS

    The mimetype is shown as "audio/vnd.dts.hd". 

EXPECTED RESULTS

    The mimetype is shown as "video/mp2t"

SOFTWARE/OS VERSIONS

    Neon Testing

    Plasma : 5.22.4
    Frameworks : 5.85.0
    Qt : 5.15.5 

ADDITIONAL INFORMATION

    The same affects Matroska files with embedded DTS HD audio

        xdg-mime query filetype testfile.mkv

    shows a mimetype of "audio/vnd.dts.hd".

    Seems to be an issue with the "magic" for the DTS HD entry which has
    a priority "60" in freedesktop.org.xml, higher than that for MPEG-2 TS
    files (that have a priority of "50") or for Matroska files (that have
    the default priority of "50"), potentially also "application/x-matroska"
    and "video/webm"

    The container files, I suspect, need a higher priority than the DTS HD
    audio and the "video/x-matroska" entry should include sufficient "magic"
    so that a priority can be specified.

    If changing the priority of "video/x-matroska", the
    "application/x-matroska" and "video/webm" priorities may also need
    changing. I don't have test cases for the full range of formats.

    (Issue extracted from Bug 420939)
Comment 1 Paul Worrall 2021-08-05 15:56:18 UTC
This doesn't look like a KDE-specific issue, probably better reported at freedesktop.org:  https://freedesktop.org/wiki/Software/shared-mime-info/

Please reset the status back to "Reported" if you know it's KDE specific.
Comment 2 tagwerk19 2021-08-05 16:41:12 UTC
(In reply to Paul Worrall from comment #1)
> ... better reported at freedesktop.org ...
Done:
    https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/167

It impacts KDE as baloo depends on the mimetype to work out whether it extracts video specific metadata.
Comment 3 tagwerk19 2021-08-10 21:43:08 UTC
See attachment, Synthetic test for video/mp2t
    https://bugs.kde.org/attachment.cgi?id=140645

This is a MPEG-2 TS file, zero'd out except for the bytes that flag that it was video/mp2t with embedded audio/vnd.dts.hd

It should return a mimetype of video/mp2t but, seemingly depending on the Frameworks version, returns text/vnd.qt.linguist or audio/vnd.dts.hd

It is an upstream issue, except for "which wrong mimetype" is returned.

With Frameworks 5.85.0, returns text/vnd.qt.linguist, with 5.84.0, 5.83.0, 5.80.0, returns audio/vnd.dts.hd. Consider a curious edge case....
Comment 4 tagwerk19 2021-08-11 13:47:17 UTC
(In reply to tagwerk19 from comment #3)
> It is an upstream issue...
Patch...
    https://gitlab.freedesktop.org/xdg/shared-mime-info/-/commit/0678d7c3e7384dde48f2f17059e54bef1507fd69

> With Frameworks 5.85.0, returns text/vnd.qt.linguist, with 5.84.0, 5.83.0,
> 5.80.0, returns audio/vnd.dts.hd. Consider a curious edge case ...
No, not as clear cut. Not correlated with version of Frameworks