A setting to prioritize the alternate 5.1 audio stream over the default 7.1 track in 4K movies

My parents can remotely stream 4K content to their ShieldTV from my server on both of our gigabit connections. But their sound bar can’t handle the default 7.1 tracks on the files. The audio track ends up transcoding and the movies buffer constantly. But if they switch to the alternate 5.1 track included on most 4K files the movie Direct Plays and everything is fine. Unfortunately, they need to manually switch the audio stream in Plex for every 4K movie they stream.

I’d like a setting that tells Plex to always prioritize the 5.1 stream if there is one (or any level track that your system can handle). - Regardless, Plex should probably transcode a 5.1 track by over a 7.1 Atmos track by default if possible.

Although I wouldn’t need this, I think a similar setting could prioritize a different language stream over the default.

1 Like

It’s a good idea, similar how plex should avoid transcoding 4K if there are other 1080/720 of the same video.

Although, transcoding just the audio should not be that difficult unless you have a row power server.

If the video is transcoding then it sounds like subtitles are enabled.

Try disable subtitles and see if it will play normally.

1 Like

I’ve got Plex on a pretty powerful FreeNas server. Xeon 1230v2 server CPU, 32 gigabytes of ram. It can successfully transcode 4K video in some situations.

I don’t know why the audio track transcoding causes the buffering but it’s definitely the reason. (I’m thinking it’s an Atmos issue.) While transcoding the audio, the video Direct Stream’s (according to Plexpy). And after manually switching to the 5.1 track, the file Direct Play’s (both the video and audio) perfectly.

Is there a way in a MKV container to tag the second stream as a fallback?

How would Plex know the second audio stream is the main program versus a commentary or some other audio track?

unfortunately, that cpu is not really as powerful as you think.

https://www.cpubenchmark.net/cpu.php?cpu=Intel+Xeon+E3-1230+V2+%40+3.30GHz&id=1189

passmarks 8873 Single Thread Rating: 1950

audio transcoding is single threaded, and HD audio transcoding is not as trivial as transcoding ac3/dts 5.1.

I considered that (about a commentary track), but this wouldn’t force Plex to use any specific track, just prioritize it by default. The audio stream could still be changed while playing the movie as it normally can be.

Also, for remuxes with a 5.1 track available, the 7.1 track is usually the first audio track listed (id: 1) and the alternate 5.1 track is the second (id: 2). The subsequent tracks are the commentaries and other languages. Plex could just fallback to the first available non-hd audio stream. And go from there…

Side note: I manually remove all extraneous commentary audio/subtitle tracks not essentially to the movie or in English from my mkvs anyway…

:man_shrugging: Regardless, I’m trying to avoid transcoding all together. I just want to make it more convenient for my users (who also may not realize there are other audio streams available or how to change them). I can’t be the only person who encounters this needless HD audio transcoding.

Seem like you are not solving the problem, just shifting it to somebody else.

Plex picks the first audio track in the file, ignoring any default, etc flags (*). You could remux the files, putting the 5.1 audio track first (MKVToolNix). That would help your parents, but then anybody wanting the 7.1 audio track would have to manually choose it when initially playing the movie.

(*) Language settings come into play as well. My media only has English audio tracks, so not sure what happens with other language settings & tracks.

Not always. The person performing the remuxing may not honor the original audio layout on the disc (**). Also, people who transcode with Handbrake or similar tools may re-arrange audio tracks to meet their own preferences.

I like the goal.
I just think there needs to be a deterministic method to tag audio tracks as primary/secondary/tertiary/etc (it can be done in an MP4 container, but not sure about MKV). The tagging eliminates guesswork about audio track priority, type (main audio, descriptive audio, commentary), etc.

Then build some logic into the selection process:

Something like:

  1. Match Plex language settings.
  2. Pick primary audio track for desired language. If client can direct play, then do it. If not, next step.
  3. Move to fallback audio track. If client can direct play, then do it. If not, next step.
  4. Another fallback track? Then try it. If reach end of list and still cannot direct play, then transcode audio.

This would let a user build an audio selection criteria to meet their own needs. For example:

  1. TrueHD 7.1
  2. dts 7.1
  3. AC3 5.1
  4. AAC 2.0

Plex would then proceed down the list until it finds a track that will direct play. If it hits the end and still cannot direct play, then it transcodes.


(**) A year or so ago, there was a bug in the Plex LG client. If TrueHD audio was the first track, instead of transcoding the audio, it would bypass it and pick the next track. When the (beta) build was distributed, there were several posts asking, “Why am I hearing the commentary/descriptive/etc track?” In those cases, the person muxing/remuxing/transcoding the movie did not put in another primary audio track. Simply working down the list of available audio tracks does not always work.

2 Likes

I have a 7.1.4 audio system at my house, I don’t want to make the 5.1 track the #1 track on the file.

And I’m not trying to shift the problem to someone else. Like I said I already go through the trouble of cleaning up my mkvs, using mkvtoolnix to remove all the extraneous tracks (that aren’t 7.1 or 5.1 main audio tracks or english subtitles)…

I’m not saying that there aren’t issues to be worked out. But a client setting would be more customizable for each user/client over me making rash changes to the source file. For instance, I’ll probably upgrade my bedroom TV to 4K at some point, but at most will still only have a sound bar.

The current Plex “Audio Quality” settings based on bitrate seems misdirected. I think a “# of channels” based setting would more appropriate (at least in addition to the bitrate setting). And implementing a plex client setting seems more realistic than pushing for a lobbying for changes (more tags) to the MKV container lol.

I understand your note about commentary track related issues though… like I said, there could be some kinks…but a client setting could default to original and you would only opt into if desired.

While waiting for plex to implement a solution for you, which could be a long time, I suggest you either;

  • separate your library so that the 7.1 content can be restricted from your parents, keep a second lower quality copy for them. (ie keep 4k separate and not for remote use)
  • upgrade your server so it can transcode the audio without buffering.

whether it is hitting the cpu limit, or you have an IO limit, only you can determine.

Either way, figure out and remove the bottleneck, then you can apply the most appropriate upgrade.

Or wait a few years (or never) for plex to implement your request.

I’ve never understood why a Shield (and other android devices) can’t auto-select the best track for the equipment the system is connected to. I have a couple of Rokus (as well as most of the people I share with), and if there are 7,1, 5.1 and stereo tracks, they will automatically pick the correct audio. All Android device require a manual selection

It takes a minute or two to configure the Roku, so it can make that intelligent choice, but it works every time once that is done. One would think if a Roku can do it, an Andoid (theoretically “smarter”) should be able to.

2 Likes

This is being implemented. It was released for Plex Web yesterday, and I expect it to come to other platforms soon.

yup that is what I referring to :slight_smile:

I’m not sure I completely agree with this. There is no need to remux anything.
Yes, it appears Plex picks the first audio track, however from my findings it is because the first track is typically the one with the default metadata flag (Handbrake makes the first track default, and the first track is always default when ripping in MakeMKV)

For MKV, use the header editor in MKVToolNix to modify the default track flags (note: when ripping, the first audio track does not have a default track metadata tag, and therefore is given a default track value of Yes. Therefore you need to add the metadata tag and set it to no) This takes less than a second.

For mp4/m4v you can use a meta data editor (I use Subler on mac) and set the default track flags.
Then do a library scan in Plex and it should honor those default track flags. This process works for me, and I have not had issues with it.

As you said though, the end user would still have to manually select which audio track to play if they don’t want the default. I just wanted to point out there is no need to waste the time remuxing.

@TeknoJunky

Personally, I’m too much of a nutjob and quality snob to ever recommend they watch a 1080p stream when there’s a 4K option available. I’ve been wanting them to install 11 speakers (7.1.4) in their living room for years. Lol they haven’t conceded yet.

I also don’t care enough about my users… Once I got a 4K TV, 4K content (when available) is the only stuff I update. I tell the rest of my users to upgrade their TVs, and media players, and internet connections, and sound systems, etc. lol.

I’m well aware of workarounds. But I’m just going to keeping telling my parents to deal with manually switching the audio stream…this thread was just inquiring about a more convenient, automatic way for Plex to operate (and waste less resources in the process).

Thank you for your suggestions.

Edit: That being said I’ll definitely look into upgrading my CPU.

This. I guess with Roku being a closed software Plex is forced to act as Roku ask them to. On Android, Plex does what it wants if it means being stupid.

2023 clean-up: duplicate