[BUG] LG Plex Transcoding Audio to MP3 (generic client profile)

Hello everyone
I have an LG CX, and use the native plex app. Since I watch a lot of media with .ass subtitles that means that a lot of my media is transcoded. It’s not something I typically mind as long as the conversions are typical. I remember that stereo audio that isn’t typically supported used to get transcoded to aac 256kbps, but now it is being transcoded to mp3 258kbps, this seemed like an unnecessary downgrade.

I noticed that the LG app was using the generic client profile; if you look at this profile in your program files you can see that it’s your typical blank profile:

<?xml version="1.0" encoding="utf-8"?>
<!-- Author: Plex Inc. -->
<Client name="Generic" />

For some unknown reason, this generic profile has been transcoding stereo audio to mp3 for the last few months, and I have no idea why. With the generic profile, stereo audio would get transcoded to mp3, 5.1 unsupported audio would get transcoded to multi channel aac - which would get sent to an AV receiver as a stereo signal, and 7.1 audio would get transcoded to eac3 which worked well as far as I know.

I am not very good at editing things like this, but I had a look at the other profiles and tried to copy edit the generic profile to make it better. First I used the HTML TV APP profile as a base, just because it seemed like a good starting point but maybe someone has better guidance.

I first edited these values to represent the specifications of an LG OLED;

<VideoCodec name="*">
      <Limitations>
        <UpperBound name="video.width" value="3840" isRequired="true" />
        <UpperBound name="video.height" value="2160" isRequired="true" />
        <UpperBound name="video.bitDepth" value="10"/>
      </Limitations>
    </VideoCodec>

I’m not actually sure if this whole section is needed.

I edited the first line in transcode targets to this:

    <VideoProfile protocol="hls" container="mpegts" videoCodec="h264" audioCodec="flac,aac,ac3,eac3" context="streaming">
      <Setting name="BreakNonKeyframes" value="true" />

Now I don’t actually know what breaknonkeyframes does, this was just copied over from html tv app, and the profile works without it. I added flac in this line for a specific reason I will explain later in this post but I will say that flac won’t be supported with how the line is written above. With this line, stereo audio gets transcoded to aac 258kbps (instead of 256), 6.1/7.1 audio gets transcoded to eac3, 5.1 audio gets transcoded to multichannel aac (which will passthrough as stereo), and if you have any ac3 audio - that won’t get transcoded. With this change, plex now functions as it used to do (with the exception of aac 258 instead of 256).

I further added onto the profile to try and improve it further, I copy edited this from the playstation 4 client profile;

    <VideoAudioCodec name="aac">
      <Limitations>
        <UpperBound name="audio.channels" value="2" />
        <LowerBound name="audio.bitrate" value="96" />
        <UpperBound name="audio.bitrate" value="774" />
        <UpperBound name="audio.samplingRate" value="48000" />
      </Limitations>	
    </VideoAudioCodec>

audio.channels is the important bit, this will make it so 5.1 audio will get transcoded to ac3, instead of aac, meaning this pass through to an av receiver correctly as multi channel audio. aac will max out at 258kbps (for stereo) no matter what value you put in the upper bound, so just put in 258kbps, I experimented with higher values because I saw a story about how streaming service ‘HIDIVE’ had holes in their aac audio due to an old ffmpeg version used in the pipeline (top image HIDIVE, bottom image competing streaming service Imgur: The magic of the Internet), encoding audio properly is important, it would be good to see some transparency how plex does this.

I am now going to talk about FLAC. Plex is capable transcoding audio to FLAC, you need to limit it to 2 channels similar to the AAC example above. You do get sound from multi channel FLAC but the channels are messed up. LG only officially support 2 channels. If you want to playback FLAC you need to transcode to mkv instead of mpegts, you also need to remove AAC from your profile. Something like this:
<VideoProfile protocol="hls" container="mkv" videoCodec="h264" audioCodec="flac,ac3,eac3" context="streaming">
Flac behaves strangely. Firstly if you have 2.0 flac audio it will transcode flac to flac, it seems like the lowerbound for the bitrate is 2250 for stereo, if you try to change the lowerbound setting to lower than 2250, it will not respect it.

Now this doesn’t seem like a massive dealbreaker since it’s academically lossless to lossless, even removing aac isn’t a big deal because lossy → lossless shouldn’t effect things. It’s also nice to transcode unsupported audio like opus and dts to lossless flac. However I currently can’t recommend this because transcoding 6.1/7.1 audio via eac3 is currently broken when using the mkv container. You get a playback error when you try to do it. I’ve tried with a 7.1 truehd atmos track and a 6.1 FLAC track. Transcoding to mkv would be close to perfect otherwise if PLEX fixed eac3 transcoding for mkv’s (and also made flac the preferred codec for stereo transcodes ahead of aac - so you don’t have to remove aac from your profile).

This paragraph isn’t really related to transcoding but it is tangentially related to client profiles. The LG CX supports av1 but you won’t be able to play it on plex without forcing direct play, it would be nice to get some community help on figuring out how to code in a directplayprofile.

Anyway TLDR / In summary; the generic profile is currently not fit for purpose and PLEX needs to fix it. While editing this profile helps, there are some quirks and plex will reset your edits when you update your server. I hope plex fixes eac3 conversion when transcoding in the mkv container - this really does seem like a bug. I’m not really super good at editing xml profiles, I kinda just winged it - so I would be super grateful if someone could replicate my results or even improve/explain them.

Alternatively if Plex could make a bespoke profile for LG webOS - that would be ideal.

I believe my post will be relevant to LG OLED owners of the last few years, if you aren’t experiencing the same issue as me as stereo audio being transcoded in mp3 then that would be an interesting datapoint too. Even so editing your profiles to transcode to flac instead of aac should be a decent upgrade for everyone even though I cant currently recommend it for people with surround setups.

I hope someone working at plex working on the LG app sees this.

Server Version#: 1.40.2.8395
Player Version#: Client version: 5.83.1, Platform version: 5.5.0

1 Like

A short update to this,

These are are my current settings:
I have this in transcode targets:

    <VideoProfile protocol="hls" container="mkv" videoCodec="h264" audioCodec="flac,ac3,eac3" context="streaming">
      <Setting name="BreakNonKeyframes" value="true" />

I have this under codec profiles:

    <VideoAudioCodec name="flac">
      <Limitations>
        <UpperBound name="audio.channels" value="2" />
      </Limitations>	
    </VideoAudioCodec>	
    <VideoAudioCodec name="eac3">
      <Limitations>
        <UpperBound name="audio.channels" value="7" />
      </Limitations>	
    </VideoAudioCodec>

As you can see I have decided to exclude aac as a transcode target because I wanted plex to transcode to flac when possible, and I noticed plex preferred to transcode to aac, removing aac from the profile was the only way I could find to force transcode to flac. This means that when transcoding a video, any aac is converted to flac which should be lossless but seems like a waste of CPU cycles. The upside to this is that now any opus, dts, or any other unsupported stereo audio should also have lossless audio conversion to flac.

In my previous post I mentioned that I hesitated to do this because transcoding to the mkv container broke eac3 conversion in some cases. You can see I limited the eac3 audio channels to 7, I believe this mean it will be a maximum of 6.1, or maybe 5.1 because I’m not sure if eac3 supports 6.1 audio. For some reason eac3 conversion with 8 channels is broken when transcoding under mkv container but works under the mpegts. This might be a deal breaker for some people. This is why I will be adding the “BUG” tag to the title in hopes that plex fix this at a minimum (hopefully they will do a wider fix to the default generic profile webos uses too).

This concludes my work around to recent issues. Appreciate any other users testing / replicating / improving on what I’ve done.

1 Like

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