Channel layout error for 5.1 opus encoded files played with plexamp

I’ve been looking for an option for remote 5.1 audio playback on plexamp on a headless Pi.

To this point, I’ve configured the Pi to playback 5.1 correctly, and have had success (other than problems not relevant to this thread) with flac and aac 5.1 encoded files playing back properly.

I’ve been looking for an ideal format that reduces bandwidth required when playing remotely on a phone hot spot. And first that led me to aac files. But the problem I ran into there is they weren’t strictly gapless. (for the record, this is a separate issue from the buffering issue in another thread). An audible short gap is present, rendering that unacceptable.

Kicking around ideas with AI, the support of opus files in plexamp came up. So I did some test encodings with that. Which resulted in the center channel coming out the front right, and the LFE channel coming out the rear right.

I thought it was a bad script, was driving me mad, but after going around in circles some, eventually found that playback and conversion in foobar confirms the opus 5.1 files are encoded properly with correct channel layout. Plexamp is playing them wrong.

Given that plexamp is playing back 2 other file formats correctly, this strongly suggests a plexamp issue rather than an equipment issue.

Is this a known bug?

Do I need to raise a bug report for this - or is this thread adequate?

If you’ve played the 5.1 encoded Opus with another player and it maps the channels correctly, please upload a sample.

Unless you’ve verified in another player, I’d say it strongly suggests a file issue :sweat_smile:

I appreciate your skepticism, I would be too.

For troubleshooting purposes, here is a 5.1 opus file that foobar is playing back correctly, and converts to multichannel wav as I would expect it to, but is playing back the center channel (solo vocals) to the front right, and LFE (low frequencies) to the rear right on my plexamp pi.

[removed by moderator. The file was forwarded to @elan]

Weirdly I’m not sure how to download that audio embed, can you provide as a zip or some other link?

And just to absolutely sure, other 5.1 codecs decode fine on the Pi, just not Opus?

@armyofquad1 could you provide the exact command line parameters that you used to produce this eaxmple file?
I am trying to replicate with a speaker test file, to tell with certainty which channel is routed to which speaker.

That file was created at the end of a process of asking Grok to create me an automated script with gui to quickly convert several folders of files to .opus files, after several requests for channel mapping corrections - so may not be the most scientific example, but what I had on hand and what I had determined was playing correctly in foobar, but not on plexamp. Just explaining why this syntax may be what it is.

ffmpeg -i input.flac -c:a libopus -b:a 384k -ac -ar 48000 -mapping_family 1 -map_metadata 0 output.opus

However - to be a little more scientific, I asked for a simple straightforward ffmpeg syntax to create a multichannel opus from multichannel flac, and used this syntax to create a new test file, which behaves exactly the same

C:\Windows\System32>ffmpeg -i “M:\03 - 5.1\SACD\Joel, Billy\Joel, Billy - 1978 - 52nd Street\01 - Big Shot (Multi-Channel).flac” -c:a libopus -b:a 384k -mapping_family 1 c:\temp\output.opus

And can confirm the new output.opus file behaves exactly the same as the provided example.

Please let me know if you’d like me to provide the new example, or if you’d like me to test with a different syntax or conversion method.

1 Like

Other 5.1 codecs, specifically flac and aac, decode fine on the Pi. I’m only having this problem with my test opus files.

I have a possible fix, we’re doing some internal testing.

1 Like

we have a fix for this as well as allowing transcodes to not mix down to stereo, enabling 5.1 on the fly opus streaming in the next release.

4 Likes

I cannot thank you enough for the latest updates to plexamp. I managed to get things wired up in my car to setup a switchbox to switch between my headamp and my pi stashed in a storage compartment to feed my car amp, and I added a rotary encoder to the switchbox that wires into the GPIO to be a volume control. First test was sorta a success - except that the DAC8x outputs are quite hot for my car amp, and required listening only on low levels where noise interference in the Pi are quite audible. but I have some RCA inline attenuators on order.

Thanks again, this is going to be awesome.

3 Likes

Very cool, keep us posted with more photos for sure!

Last weekend I had my first test run of the Pi on the road.

While I was able to listen to a few albums, I was plagued with power supply issues.

For half the trip, it would periodically just shut itself off, but I could usually get it to turn back on.

Then at some point - it completely stopped being able to power up on the car power supply, and my travel power supply. I was out of luck until I got home to my precious official power supply.

I’ve not determined what the problem is - my unofficial power supplies should be powering up to 3A, and I’m not getting any readings suggesting it requires more. But, for whatever reason, the Pi is picky about it’s power supplies.

So I went back to amazon, and found a car usb-c adapter that is listed as working with the Pi4, and has a review that it works with the Pi5 in a car. I just put it in the car today, and I am back to it powering on again. But, it will need another road test to determine if it will be stable or not.

I also added a power button and an LED - but my volume knob stopped working. Not sure if I damaged a wire while tearing it apart and putting it back together, or if my scripts for the led and power button interfered with something, but I will have to find time another weekend to dig back into that. For now, controlling the volume from the phone will be adequate.

Anyways, despite the problems, I did a little live stream showing it off. Although I did a quick test run before the stream, it did not go smoothly at first. Which I suppose is good to show the reality of lab experiments like this.

I’ve been wanting to do something like this for awhile. You are an inspiration.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.