Opus R128 Tags are effecting Loudness Leveling

Server Version#: 1.41.4.9399
Player Version#: Plexamp v4.11.5

Posted a video explaining and test run through here.

I’ve been having issues with loudness leveling in plex/plexamp for awhile where some albums would just be super quiet and after some testing I believe there is an issue with PMS (or underlying ffmpeg I suppose) is using the R128 tag when calculating loudness data.

I have flac versions of the music for archival purposes, but I pre-transcode to Opus for PMS to consume. 99% of my listening is on mobile Android devices, so having it already at 48k sample rate already and smaller file sizes is ideal for my use case.

If the flac I have as the source has replaygain tags on them, opusenc applies a R128 tag (their own version of a replaygain tag) onto it, which seems to effect how PMS is detecting loudness levels. As soon as that R128 tag is removed and PMS rescans, its loudness data is instantly to what I was expecting.

If the files or scripts from the video will help debug the issue let me know and I can send them to you.

Thanks!

Tyler

I’m not sure why you’d want to do this when PMS is happy to convert on the fly and it’s cheap.

PMS loudness analysis decodes the files to PCM before performing R128 loudness analysis on them; possibly it “respects” the loudness tags while decoding?

Are you seeing the actual loudness levels seeing in the PMS XML/JSON being different?

I’m not sure why you’d want to do this when PMS is happy to convert on the fly and it’s cheap.

So caveat this was years ago so situation might be different and I may retry using flacs again

  • I remember scans were taking a very long time with all my flacs on regular disk drive array. Server has been upgraded a bit, but the disks are the same.
  • My work’s wifi at the time was heavily monitored so I switched to always VPN to my home network. It might be different now, but at the time plexamp would still consider me on the local network (even though I had the ip mask not in the LAN Networks) so it would always serve me the full flac vs encoding to opus.

The only real downsides of pre-transcoding for me personally was some SSD storage being taken up and this rare loudness leveling issue. Doing ABX tests with opus with my setup I consistently failed so having full flac all the time is not a huge priority to me.

These are some screen grabs from the end of the video posted above.

This is an opus file with the R128 tag

This is the same file with the R128 tag removed

Plexamp has a bitrate limit for local connections as well. You can set it to 320 kbps and thus trigger automatic transcoding of flac files.

Interesting. Maybe that’s a platform dependent option? On Android the only options I have are for Wifi Remote and Cellular.

If Android had a local wifi option as well that would resolve one of my hang ups of plex pointing to my flacs for sure. But I 100% get the playing best quality version on local decision.

Shoot, I always forget that WiFi always means remote as well.

I may have missed why this doesn’t work in your case?

When I was trying out flacs on PMS a few years ago, my work’s wifi was being heavily monitored. So I decided to VPN to my home network when I’m away from home. When I was on that wifi connected to VPN, plexamp wouldn’t transcode to opus. I made sure the VPN ip range was not in the LAN network mask and verified in the dashboard that PMS showed the traffic as remote, but plexamp still would serve flacs. Clearing playback cache, queue and downloads didn’t help.

Again was a few years ago so I’ll maybe throw some flacs on the server and try it again this week to see if it’s working now. Alternatively work situation has changed so I could just split plexamp from the VPN now.

Anyways, I know it’s a very low impact bug. Probably not a lot of people using opus directly in their library and there is a workaround, just wanted to share that there is something funky going on with that tag.

Appreciate the work with plex and plexamp. Pretty much the only app that gapless has been flawless and all the extra metadata fetching with zero effort on my part has been incredible, so thank you!

And I appreciate it!

I think in many cases we can detect being on VPN so we should not treat that as “local” for the purposes of media conversion settings.