Closed jplatte closed 4 years ago
I second this. Since there's been support for Opus in gstreamer and mplayer for years, I was quite surprised when I found out, that all my Opus files are being ignored.
Apparently GStreamer support has been added about 2 years ago (#76).
But unfortunately gmusicbrowser still does not play Opus files (gmusicbrowser v1.1.14 on Ubuntu 2015.10)
Opus is the format used by youtube-dl -x
(audio download from YouTube)
+1
mpv supports opus, so it's just a matter of modifying GMusicBrowser to include the files in the index.
Switched to Clementine Music Player because of this.
Making some progress hacking on oggheader
@RomanHargrave libopus supports 44.1 kHz sampling rate? Or is that reading "work in progress"?
@davidfoerster It's the input encoding rate. The ID packet encodes data about what the encoder was fed. As for sample rate I am unsure. I suppose I should put it in a different info field.
@davidfoerster I wasn't thinking. I edited my comments before you, heh.
WRT backends, due to the way GMusicBrowser handles files, you only need to implement a tag/metadata parser for each format. The file itself is handed as-as to the decoder (mpv, gstreamer, etc). mpv and gstreamer should both work, since I know for fact they support opus.
One thing to note is that while it may seem that the length calculation brought over from ogg works, it doesn't quite - it's usually off by ten to twenty seconds.
Tags are read correctly now, I haven't touched writing yet.
@RomanHargrave I'm surprised you can't reuse the code that parses and writes the Ogg container data and tags of Vorbis files.
I suppose I could. This was more the result of tinkering with things.
Already I can tell you that due to Perl 5's way of going about classes (and my not having read much about them), that if I include the Ogg parser, I don't know that much of the shared non-namespaced code will even be accessible.
@davidfoerster I've merged the common code.
Is there any chance to add better replaygain support? At the moment the GStreamer decoder applies replaygain from the metadata (as it should) but GMB is unaware of it and thus applies the configured fall-back gain regardless.
I'm attaching a sample file in Opus and Vorbis format (both from the CC-licensed Machina II by the Smashing Pumpkins and thus legal to redistribute).
@davidfoerster the issue is with missing RG support in non-gstreamer backends? or the issue is with improper RG support in the Opus tag parser?
@RomanHargrave I'd say the issue is in the tag parser, not in GStreamer. The latter appears to do what it's supposed to (apply replay gain according to file metadata) while GMB applies the fall-back gain meant for files without replay gain info on top the replay gain that GStreamer applies.
I should mention that GMB displays empty replay gain entries for Opus files in the file properties dialogue even though opusinfo
shows replay gain data for the same file(s).
i'll need to explore the RG implementation in GMB core for that. my backend is MPV (I use jack and have a large collection of different file types, GStreamer is simply out of the question for me). I'll have to investigate a few things:
Does RG even work correctly for MPV - if not, fix it
Where/why RG problems happen with Opus
I'd investigate the MPV back-end too if I knew which Perl bindings or other (Ubuntu) packages I need to install to enable the MPV option in the audio back-end settings of GMB. The mpv
package suggested by the gmusicbrowser
package didn't do it. Any suggestions?
My best guess is still that GMB's Opus tag parser is simply unaware of the replay gain data and I'd assume that it works independently of the audio back-end.
The MPV backend appears to have working RG.
You do not need any special modules installed - all RPCs are done internally. The backend itself uses JSON::PP
, Time::HiRes
and IO::Socket::Unix
which are all most certainly going to be present in the first place.
I lacked the JSON:PP
module and installed it now. The others are part of the Perl base installation. The MPV option in GMB is still unselectable.
sub check_version
{ return unless $mpv;
my $output= qx/$mpv -V/;
my ($ok,$version);
if ($output=~m/mpv\s*(\d+)\.(\d+)(\S+)?/i) { $ok= $1>0 || $2>=7; $version= "$1.$2".($3||"") } #requires version 0.7 or later
elsif ($output=~m/mpv\s*(git-[[:xdigit:]]+)/i) { $ok=1; $version=$1; } #assume git version is ok
else { warn "mpv: error looking up mpv version\n"; }
warn "mpv: found mpv version $version\n" if $version && ($::debug || !$ok);
if (!$ok) { warn "mpv version earlier than 0.7 are not supported -> mpv backend disabled\n" }
return $ok;
}
do you have ≥0.7?
@davidfoerster I've just performed EBU loudness measurements of the same track played in MPV by GMB, first in ogg, then opus.
RG mode is set to album, and the two files have identical RG tags.
OGG Measurement:
Spectrum w/ Peaks:
Screencap of OGG file properties
Opus Measurement:
Spectrum w/ Peaks:
Screencap of Opus file properties
Comparing the two spectrums, it would appear that any visible difference in volume between these during playback is within an error margin.
Capture Setup:
The above observations lead me to wonder if this is an issue somewhere else, as the actual tag format parsing and loading is done inside oggheader.pm
even for opus files. All that opusheader.pm
does is extract the raw OGGTag data from the opus file. So as far as GMB is concerned the RG data is identical at playback time, even if it may ultimately be up to GStreamer or MPV to ultimately handle the gain adjustment.
What's the fall-back gain in your GMP configuration? I set mine to -9.0 dB. If I set it to 0 both files are played back at the same volume (which is consistent with my earlier problem description).
On another note I have an old MPV version and can't install or even build a newer version trivially. I'll try again tomorrow or whenever I find time.
FBG is 0.0dB but swapping between album/track mode causes noticeable changes for both formats.
MPV invocation is
/usr/bin/mpv --input-unix-socket=/home/roman/.config/gmusicbrowser/gmb_mpv_sock --idle --no-video --no-input-terminal --really-quiet --gapless-audio=weak --softvol-max=100 --mute=no --no-sub-auto --volume=55 --af-add=@RG:volume=0:replaygain-album=yes:replaygain-clip=yes:replaygain-preamp=1 --replaygain album --af=channels=2 --ao jack --jack-name GMusicBrowser
I'll have to start it manually and see if can catch GMB changing to fallback gain, though I doubt it.
On a more pressing note, I've noticed that GMB is writing bad tag headers for certain opus files. This certainly warrants a more critical investigation than potential RG issues.
Switched to Clementine Music Player because of this.
Me too then dumped for Amarok and now I want to go back to gmusicbrowser since all sucks...the biggest sucker was exile... (hahaha)
Better late than never I guess. It's fixed in both branches: master (gtk3) and v1.1.x (gtk2) Please report any problems you encounter with opus files.
It would be nice to be able to play opus files. This should definitely be possible with #76 done, but may also be possible without it.