When I limit BW, Plex Transcodes Unexpectedly

Solved: Please see this summary.

Server Version#: 1.18.1.1973
Player Version#: 7.26.0.14578 (Android Phone)

Hello all,
I am having an issue with managing my bandwidth. My ISP only provides 2Mbps upload (lame, I know) and if I max it out, it kills my download (12 Mbps). This results in all youtube, Netflix, gaming, etc. coming to a halt if I max out my upload. I have contacted my provider and he claims this is to be expected because downloading requires a return path. Since it is TCP/IP I guess I understand that. Anyway I am trying to get around this limitation by re-encoding and limiting bandwidth consumption.

I have re-encoded my collection to HEVC @ 750Kbps. I am reasonably happy with the quality on my phone screen but cannot seem to get Plex to limit my BW to 1.5Mbps, stay under 2Mbps, and not transcode. I chose 1.5Mbps to accommodate any flux in my encoding.

If I leave the limiter off, Plex will deliver the video using “direct play” (as I want). Unfortunately, it pegs the needle on my bandwidth in spurts approximately every four seconds. Each spurt disrupts my download and ruins game playing, Netflix, youtube, etc.

If I turn on limiting, Plex will transcode to H264 and then spurt exactly as before, apparently ignoring the BW limitation, but now the quality is low in addition to the rest of my family’s downloads suffering.

I am a bit of a loss as to where I should go from here. Is there an option to stream out in a steady flow instead of the spurts? I would like to discover how to keep the flow constant and under a bandwidth limit.

Can anybody help?
Thank you!

If your router has an adaptive qos option you could use it to set your max upload to say 1.8 leaving some headroom to avoid buffer bloat. Our specifically limit the upload of your pms box.

I’ll need more details (log, wink, wink) to figure out why it’s transcoding, but these pegs as you describe could be due to spikes in the encode. Keep in mind that the bitrate setting you use when encoding is an average so there can be spikes. I don’t know what program you use, but some will allow you to set the maximum these spikes can reach, which could help.

Another possibility is that the audio you have is causing the file to exceed the limit. The limit checks both the video and audio bitrates. You could have a 750kbps video, but if the audio is 1 Mbps, the total would be above your limit so it will transcode.

I found this in my log:

Dec 25, 2019 17:10:11.398 [0xa55ff450] DEBUG - Streaming Resource: Reached Decision id=17624 codes=(MDE=3001,Not enough bandwidth for direct play of this item. Required bandwidth is 1760kbps and only 1600kbps is available. General=1001,Direct play not available; Conversion OK. Direct Play=3000,This app cannot play this item. The reason is: part.optimizedForStreaming limitation applies: 0 != 1. Transcode=1001,Direct play not available; Conversion OK.) media=(id=28109 part=(id=28180 decision=transcode container=mpegts protocol=hls streams=(Video=(id=74468 decision=transcode bitrate=1061 encoder=libx264 width=720 height=406) Audio=(id=74469 decision=transcode bitrate=135 encoder=aac channels=2 rate=48000))))

But I have triple-checked and the file is No where near 1769Kbps. I have attached a screenshot.


The overall bitrate is 880Kbps. Even if I allow a 50% variance, I only reach 1320Kbps that fits comfortably into the allowed 1600Kbps.

I am not totally comfortable uploading my log file as it has my username and maybe more. :-/

I really appreciate your help.
Thank you!

Thank you for your reply. I am looking into if this is possible with my equipment. :slight_smile:

Thank you, I’ll let you know how it goes. :slight_smile:

Plex has two bandwidth limiters on the “Remote Access” config screen - one for the total concurrent internet upload speed (which allows you to type in a number in Mbps), and another that limits each individual stream which is a dropdown. Have you experimented with setting both? In your case I think you need to have the total internet upload speed set to have Plex fully respect your limit, not just the per-stream rate.

This Plex article is very useful. Note that in their example a 3.5 Mbps average video spikes up to 10 Mbps in an action scene. It goes on to state that Plex assumes a 2x average bitrate unless a deep analysis has been performed (e.g. a 50% overhead allowance isn’t sufficient.) Particularly pay attention to the very informative “So how does Plex handle it” section. The buffer size of your client can make a big difference in the actual overall bitrate required.

PS Your encoder may allow a constant bitrate instead of variable - but that is going to be at the encoder, not Plex. Constant bitrate will have implications for file size and how it displays.

3 Likes

Thank you! Very Helpful!

Plex also does an analysis of your file to see what bitrate is needed to make sure the file will stream properly. This analysis may not match up with the average bitrate in the file. If you can provide the xml from PMS for that video, those analyzed values should be there.

Thank you for the reply.

I have learned so much from this one question! Here is my xml file. I see the same numbers as I saw on the VideoSpec snapshot. Is there a particular tag I should be looking at?

Thank you!
17624.xml.txt (14.4 KB)

MediaInfo can/may provide a more detailed inspection, particularly Bandwidth - that may not be in the XML - I really don’t know, but it’s worth a shot.

(you’ll do well having that anyway)

Thank you. I appreciate the link. It shows the exact same numbers as VideoSpec. :slight_smile:

Create a report (Export) from MI and attach it here - just for completeness should someone important come along…lol

:slight_smile:

General
Complete name                            : /Volumes/Multimedia/Video/hevc/Movies/13 Going on 30 (2004) - BD.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 616 MiB
Duration                                 : 1 h 37 min
Overall bit rate                         : 880 kb/s
Writing application                      : Lavf58.33.100

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L3.1@Main
Codec ID                                 : hev1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 1 h 37 min
Bit rate                                 : 744 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 23.976 (23976/1000) FPS
Minimum frame rate                       : 4.795 FPS
Maximum frame rate                       : 23.976 FPS
Original frame rate                      : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.034
Stream size                              : 520 MiB (85%)
Menus                                    : 0
Codec configuration box                  : hvcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 1 h 37 min
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 89.8 MiB (15%)
Default                                  : Yes
Alternate group                          : 1
Menus                                    : 0

Menu

Thanks!

Here is a snapshot of my server with the bandwidth “spurts” I was referring to…

The video played very well on my remote. At first everything is great, and my local download is not affected. Then the spurting starts, and finally big spurts that completely destroy my download bandwidth. When the upload looks like the right side of the graph. I cannot do anything involving downloads. The video continues to play fine though.

I did not have any bw controls set on the server for this test.
Thoughts?

I am still looking fir the correct answer, but wanted to update this thread to let you know that I found something that is working.

My router does not have this feature as an upload option, only download. :-/ However, I found WonderShaper (The tutorial on that page is out of date, but the readme is pretty good.). Anyway, I installed it on my Plex server and did some speed tests per the instructions then set the values and it seems to be working. I did not set any BW limitation in Plex.
Here is my new screenshot:

The peaks are still way too high, but for at least this test, it is working great and not impacting my download speed.

I am still really interested in doing this the correct way. Is there a tag I should be looking at? I posted the xml file above. :slight_smile:

Thanks!

Well I guess I spoke too soon. I think this would work great if I could control all of my network through Wondershaper, but since it only controls the Plex server when I do a speed test (upload) from another machine it saturates the upload part of the network and then Plex starts spurting again. See here:


This then results in the download being completely unusable. I have to stop the video and restart to get the spurting to reset.
Any thoughts anyone?
Thanks!

Ugh. this is interesting from a technical standpoint to learn, but a real pain for you.

Is your Plex server Win or Linux? This thread is tagged Windows, but the WonderShaper link is Linux and you got me researching QoS and shaping.

In general I think what is happening is that you are seeing more level network use while the buffer is filling on the client (which may continue even after playing has started.) Then when the buffer is full it starts transmitting in chunks as needed, so you get spikes when chunks are transmitted and nothing while the client is happy playing from it’s buffer.

Hmmm… if you are Linux, have you looked at configuring routing tables with tc? (I’m Linux, but have never needed to do this…)

Wow, I totally screwed that up. It is linux. I changed the tag. Thank you for catching that. I don’t know what I was thinking. :-/

Ya, that seems very likely. I just cant figure out why it is peaking so high. When I limit to 2.2Mbps, it still peaks over 5, unless the graph in Plex is not accurate. BTW, 2.2 seems to be the sweetest spot.

I will check out the link, thanks!

It’s cool that you are Linux - in this case I feel like you have a better chance of finding a resolution. The link I provided is rather generic and I don’t know what distro you are using, but if you google “(your distro) linux QoS” I think you will find some good material. Microsoft, in their wisdom, decided only corporate network admins could possibly need advanced networking, so they limit certain capabilities to their server OS editions…

The advice of @Dr_Tone to do QoS on your router would be choice #1 since limiting on your Plex server still leaves you vulnerable to saturation if another device on you LAN starts uploading, but since that doesn’t appear to be an option…

Keep in mind that without setting a bandwidth limit in PMS, a client will try to download as fast as your network will allow. So what you are seeing is normal and expected. If you need to limit your throughput, you will need to setup a limit in PMS or control it outside of Plex with your router’s QoS or a 3rd party program like you tried. I’m not sure why it is triggering a transcode. Your XML looks fine. I’ll need to see your PMS logs after recreating the issue. You can PM me the log if you don’t want to share it publicly.

1 Like