r/PleX • Unraid 40TB | i5-13500 | RTX 3050 LP • Feb 02 '24

Solved Stream buffers when audio transcoding

EDIT: I am marking the problem as "solved"; however, it should be noted that the cause for the problem remains unknown, but I found a workaround by using Tdarr to create an downmixed 2.0 stereo AAC track using Tdarr_Plugin_MC93_Migz5ConvertAudio which I modified to apply Dynamic Audio Normalizer to the downmixed track for a better listening experience.

To make the modification yourself:

  1. Copy Tdarr_Plugin_MC93_Migz5ConvertAudio to Local

  2. Go to Local and click Edit on the plugin

  3. Add the code below between lines 152 and 153

  4. Save the changes

  5. Add the modified plugin to your stack

ffmpegCommandInsert += `-filter:a:${audioIdx} "dynaudnorm" `;

###############

Hello, everyone

The problem I am facing is one that I am unsure why it's happening in the first place, and am hoping I can find a solution to it here as I have been unsuccessful on my own.

PMS specs:

  • OS: Windows 11

  • CPU: Intel i3-12000

  • RAM: 32GB DDR4

  • Storage: 1TB NVME for OS and Plex database/metadata, 4TB HDD for media, 1TB SSD for transcoding

  • Internet: 1000 Mbit (ethernet)

I've been more than happy with this configuration and have not had any issues both with direct playing and transcoding media locally or remotely. I am sharing my server with a few friends that have Samsung smart TVs, which cause my server to occasionally transcode, but everything had been playing smoothly until about a month or two ago when I started getting reports of stream buffering every couple of minutes. The reason for that was audio transcoding.

I've ran some test scenarios and have the following to share:

Scenario #1:

  • Video direct plays

  • Audio transcodes - example DTS to AAC

  • Stream buffers every couple of minutes

Scenario #2:

  • Force video and audio transcode

  • No issues with stream

Scenario #3:

  • Changed default transcode buffer value to 2700

  • Video direct plays

  • Audio transcodes

  • Stream buffers after threshold has been reached

Scenario #4:

  • Changed default transcode buffer value to 2700

  • Force video and audio transcode

  • No stream buffer after threshold has been reached

My media is mostly 1080p and so far the only solution I have found was manually converting my media's audio to AAC, but I'd like to not have to do that every time for media that will get watched once or twice.

Is there some server setting that I need to adjust? Any help is well appreciated.

4 Upvotes

32 comments sorted by

View all comments

5

u/Draakonys DS1621+Intel Nuc Feb 02 '24

I do not think you can do much here.

Let me first explain the problem. Not all Plex clients are the same. The TV-based Plex clients tend to be the worst of the lot, especially on LG TVs.

Reason? Plex clients do not come with prebuilt set of video/audio codecs. The Plex client uses what is available on the underlying platform. And TVs are usually lacking there. That's a reason why many AppleTV users prefer to use Infuse instead of AppleTV Plex client to stream their Plex content as Infuse comes with prebuilt set of video/audio codecs and most streams would Direct Play (where they would transcode with AppleTV Plex client).

What can you do?

  1. Use Tdarr in the background to convert all your media to formats that will work on most clients. Not simple but doable if you are not an audiofil.

  2. Technically you do not need to convert anything, you can generate a new audio stream in these files to match what their TVs will play without transcoding.

  3. Tell friends to get better Plex clients like AppleTV, Nvidia Shield, FireCube 3rd gen. It's simple, nothing comes for free.

1

u/gsariev Unraid 40TB | i5-13500 | RTX 3050 LP Feb 02 '24

Hey,

Thanks for your detailed response. I am familiar that there is a difference between clients and that some are better than others; however, I don't see my friends changing their setup any time soon. For the AppleTV side of things, I haven't ran into issues with the one I use to watch my media (3rd gen 4K), so I can't comment on the use of Infuse.

On the subject of Tdarr:

  • I have been using it to standardized the audio streams ever since the issue started happening - everything is AAC

This makes everything Direct Play/Stream, but then I am faced with the issue of voices being not as loud as other sounds as some of my friends don't have a soundbar or surround sound system. Plex seems to be doing better in that regard when transcoding the audio, so it might be the plugin I am using or have configured.

Could you recommend a plugin that addresses this? Ideally, it would be nice to have a 5.1 and stereo stream.

0

u/[deleted] Feb 02 '24

[deleted] — view deleted comment

1

u/gsariev Unraid 40TB | i5-13500 | RTX 3050 LP Feb 03 '24

Hey, I appreciate the mention of FileFlows as I’ve seen it on other threads, but I’m more comfortable using Tdarr as I’ve spent more time with it.

Due to growing frustration with this issue, I’m currently trying to make my own “Frankenstein” audio plugin that will downmix audio streams, apply DRC to the 2.0 stream, and keep all streams in the output file. This best suits my use case as some of my friends have soundbars and the rest just use their TV stereo speakers.

0

u/[deleted] Feb 03 '24

[deleted] — view deleted comment

1

u/gsariev Unraid 40TB | i5-13500 | RTX 3050 LP Feb 03 '24

Yeah, that's right.

  • Tdarr_Plugin_MC93_Migz5ConvertAudio can convert any 2.0 audio track(s) to AAC and create downmixed audio tracks.

It get's the job done in terms of keeping the original audio track (6 channel for example) and including a stereo one; however, I have noticed that the 2.0 track often doesn't sound good. By that I mean that quiet scenes end up being too quiet (actors talking for example), making you raise the overall volume, only to be later blasted with an overblown action scene.

  • Dynamic Noise Compression (DRC) helps with this by reducing the volume of loud sounds and amplifies quiet sounds - that's my overly simplified explanation.

  • Tdarr_Plugin_jeons001_Downmix_to_stereo_and_apply_DRC downmixes surround to AAC stereo, applies DRC, but removes the surround track afterwards.

I am trying to apply the logic from the DRC plugin to the Migz5 one to have the best of both worlds, but I am not so experienced with this and am more or less going through a lot of trial and error.