Bug 492644 - Opus files with ".oga" or ".ogg" file extensions are not properly handled
Summary: Opus files with ".oga" or ".ogg" file extensions are not properly handled
Status: REPORTED
Alias: None
Product: frameworks-kfilemetadata
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 6.5.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Pinak Ahuja
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-04 11:34 UTC by Schlaefer
Modified: 2024-09-04 15:58 UTC (History)
0 users

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 Schlaefer 2024-09-04 11:34:52 UTC
Opus audio files usually have the ".opus" extension, but ".oga" or ".ogg" are also valid extensions.

The mime-type for ".ogg" or ".oga" is "audio/ogg". 

kfilemetadata relies on taglib to extract the metadata, but explicitly asked for vorbis (not opus!) extraction based on the mime-type[1], which erros in taglib [2] and therefore kfilemetadata.

As a result application relying on it (e.g. Elisa) refuse to handle opus in ".ogg" and ".oga" files [3].

I'm not a C++ dev, but I got some kdesrc-build going and did a simple copy&paste job in taglibextractor.cpp [4], which at least fixed playback in Elisa.

[1] https://invent.kde.org/frameworks/kfilemetadata/-/blob/master/src/extractors/taglibextractor.cpp#L661
[2] https://github.com/taglib/taglib/blob/master/taglib/ogg/vorbis/vorbisfile.cpp#L124
[3] https://bugs.kde.org/show_bug.cgi?id=443519
[4] https://pastebin.com/BgydkqpM

Operating System: CachyOS Linux 
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Kernel Version: 6.11.0-rc6-1-cachyos-rc (64-bit)
Graphics Platform: Wayland
Processors: 12 × 11th Gen Intel® Core™ i5-11400 @ 2.60GHz
Memory: 31,2 GiB of RAM
Graphics Processor: Mesa Intel® Arc
Comment 1 Schlaefer 2024-09-04 15:58:07 UTC
Sorry for the sloppy, original writeup. Here the missing context:

SUMMARY

kfilemetadata doesn't process the opus codec in ogg container files if the file extension isn't ".opus", but e.g. ".ogg" or ".oga".

STEPS TO REPRODUCE

1. Create an opus encoded file in an ogg container (e.g. export as opus from Audacity)
2. Rename the file from "foo.opus" to "foo.ogg"
3. Try to play back the "foo.ogg" in e.g. Elisa

EXPECTED RESULT

Elisa should show up metadata (title, album, cover) and play back the audio.

OBSERVED RESULT

Elisa doesn't show any metadata and doesn't allow to start playback.

ADDITIONAL INFORMATION

Analysis see above. Essentially: kfilemetadata expects ".ogg" files to only contain the "vorbis" codec, but doesn't take into account that the "opus" codec is also valid.

"foo.opus" files (no renaming to "foo.ogg") are handled fine (in Elisa). Interestingly ".opus" files show up as "audio/ogg" too, at least with "file --mime-type foo.opus". From what I see Elisa uses "QMimeDatabase" for ".opus" files, which must report something different(?), but this is above my paygrade now (only reading code, no clue about C++ and/or Qt).