Calculated bandwidth is too high and causing video conversion

I have a client that can’t handle DTS audio, and so it requires conversion of audio stream to DD or Stereo. Unfortunately for some reason Plex server decides to convert video stream as well, and that doesn’t work too well because the server is not powerful enough to do video conversion.

So I’ve been hunting for the reasons, and from the logs it seems like the server is making that decision based on the calculated bandwidth?? What I can’t understand is how exactly it’s coming up with the huge 14411kbps rate when the file’s video stream has rate of only 4719kbps. Even with the “fudge factor” of 1.4 it’s only 7078kbps leaving plenty of room for reencoded audio to satisfy client’s limit of 12000kbps.

There are more seemingly incorrect numbers in this log. Like where did the “26051kbps is > the 9216kbps available” come from??

Can someone help me please to figure out what’s going on here and why the video is being converted as well?

Thanks!!

Mar 24, 2018 13:04:26.310 [0x7efee7ffc700] DEBUG - MDE: analyzing media item 196
Mar 24, 2018 13:04:26.310 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): Direct Play is disabled
Mar 24, 2018 13:04:26.310 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): media must be transcoded in order to use the hls protocol
Mar 24, 2018 13:04:26.310 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): no direct play video profile exists for http/mkv/h264/dca
Mar 24, 2018 13:04:26.310 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): selected sidecar subtitle stream will be segmented
Mar 24, 2018 13:04:26.311 [0x7efee7ffc700] DEBUG - MDE: Cannot direct stream audio stream due to codec dca when profile only allow
s aac
Mar 24, 2018 13:04:26.311 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): selected media 0 / 196
Mar 24, 2018 13:04:26.311 [0x7efee7ffc700] DEBUG - Streaming Resource: Calculated bandwidth of 14411kbps exceeds bandwidth limit. Changing decision parameters provided by client to fit bandwidth limit of 12000kbps
Mar 24, 2018 13:04:26.311 [0x7efee7ffc700] DEBUG - Streaming Resource: Determining preferred transcode encoders through transcode only decision.
Mar 24, 2018 13:04:26.312 [0x7efee7ffc700] DEBUG - Scaled up video bitrate to 7078Kbps based on 1.500000x fudge factor.
Mar 24, 2018 13:04:26.312 [0x7efee7ffc700] DEBUG - Scaled up video bitrate to 7078Kbps based on 1.500000x fudge factor.
Mar 24, 2018 13:04:26.313 [0x7efee7ffc700] DEBUG - Streaming Resource: Reducing playback quality for 11428kbps stream bitrate: video resolution to 1280x720, audio channels to 6, disable video DS as 26051kbps is > the 9216kbps available
Mar 24, 2018 13:04:26.313 [0x7efee7ffc700] DEBUG - Scaled up video bitrate to 7078Kbps based on 1.500000x fudge factor.
Mar 24, 2018 13:04:26.313 [0x7efee7ffc700] DEBUG - MDE: Selected protocol hls; container: mpegts
Mar 24, 2018 13:04:26.313 [0x7efee7ffc700] DEBUG - MDE: analyzing media item 196
Mar 24, 2018 13:04:26.313 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): Direct Play is disabled
Mar 24, 2018 13:04:26.313 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): media must be transcoded in order to use the hls protocol
Mar 24, 2018 13:04:26.314 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): no direct play video profile exists for http/mkv/h264/dca
Mar 24, 2018 13:04:26.314 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): selected sidecar subtitle stream will be segmented
Mar 24, 2018 13:04:26.314 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): Direct Streaming is disabled, so video stream will be transcoded
Mar 24, 2018 13:04:26.314 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): no remuxable profile found, so video stream will be transcoded
Mar 24, 2018 13:04:26.314 [0x7efee7ffc700] DEBUG - MDE: Cannot direct stream video stream due to profile or setting limitations
Mar 24, 2018 13:04:26.314 [0x7efee7ffc700] DEBUG - Scaled up video bitrate to 7078Kbps based on 1.500000x fudge factor.
Mar 24, 2018 13:04:26.314 [0x7efee7ffc700] DEBUG - MDE: Cannot direct stream audio stream due to codec dca when profile only allows aac
Mar 24, 2018 13:04:26.314 [0x7efee7ffc700] DEBUG - MDE: Tangled (2010): selected media 0 / 196
Mar 24, 2018 13:04:26.315 [0x7efee7ffc700] DEBUG - Streaming Resource: Adding session 0x7efeee

Please go to the video -> hover over it -> Get Info -> View XML. attach the XML so I may see what is really there.

Also, what bandwidth (upload) limitations have you set?

Here is the XML.

I have Roku set at its highest: 12000kbps. That seems to be correctly communicated to the plex server as per below. But the movie is way under the limit.

Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * X-Plex-Token => xxxxxxxxxxxxxxxxxxxx
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * X-Plex-Token => xxxxxxxxxxxxxxxxxxxx
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * protocol => hls
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * waitForSegments => 1
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * subtitles => auto
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * path => /library/metadata/196
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * offset => 245
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * session => e1874fdf99b2e0360a0121973e45b227
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * directStream => 1
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * directPlay => 0
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * videoQuality => 90
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * videoResolution => 3840x2160
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - *** maxVideoBitrate => 12000**
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * mediaIndex => 0
Mar 24, 2018 13:04:26.287 [0x7efee7ffc700] VERBOSE - * partIndex => 0

I have a Roku 3.

a. 12000 is not it’s highest rate
b. It’s not capable of 4k

Now add the video, which is not 4k. It’s 720p

<Media videoResolution="720" id="196" duration="6016427" bitrate="6231" width="1280" height="720" aspectRatio="1.78" audioChannels="6" audioCodec="dca" videoCodec="h264" container="mkv" videoFrameRate="24p" audioProfile="dts" videoProfile="high">
<Part accessible="1" exists="1" id="12169" key="/library/parts/12169/1301706349/file.mkv" duration="6016427" file="/zmovies/Video/Kids/Tangled 2010.mkv" size="4685954916" audioProfile="dts" container="mkv" videoProfile="high">
<Stream id="27127" streamType="1" default="1" forced="1" codec="h264" index="0" bitrate="4719" language="English" languageCode="eng" bitDepth="8" cabac="1" chromaSubsampling="4:2:0" codecID="V_MPEG4/ISO/AVC" duration="6016433" frameRate="23.976" frameRateMode="cfr" hasScalingMatrix="0" height="720" level="41" pixelFormat="yuv420p" profile="high" refFrames="5" scanType="progressive" width="1280" />
<Stream id="27128" streamType="2" selected="1" default="1" forced="1" codec="dca" index="1" channels="6" bitrate="1509" language="English" languageCode="eng" audioChannelLayout="5.1(side)" bitDepth="24" bitrateMode="cbr" codecID="A_DTS" duration="6016427" profile="dts" samplingRate="48000" />
<Stream id="70216" key="/library/streams/70216" streamType="3" selected="1" codec="srt" format="srt" />
</Part>
</Media>

What has been forced here?

I’m sorry, didn’t quite understand your response.

This is Roku Ultra, which can handle 4K, but the video is not 4K. Maximum allowed bitrate in the Roku is set to 12Mbps, and the video is well under the max. Since Roku is set not to accept DTS, Plex needs to transcode the audio. Somehow it transcodes the video as well, and the weird bitrate numbers in Plex logs have attracted my attention as a possible reason for video transcode.

I don’t know exactly what “forced” from the XML dump means. The issue’s observed with other movies w/o “forced”.

First, most 4K video is well beyond 12Mbps. The typical ripped content is 50+ Mbps. Peaks are typically above 100 Mbps. 12 Mpbs is 720p and 1080p range, not 4K range.

Therefore I ask this way. Why is the Roku set / limited to 12 Mbps?

Edit… This is not a linux-specific issue. Moving to General discussions.

@ChuckPA said:
First, most 4K video is well beyond 12Mbps. The typical ripped content is 50+ Mbps. Peaks are typically above 100 Mbps. 12 Mpbs is 720p and 1080p range, not 4K range.

I don’t have 4K videos. Did I ever mention 4K anywhere?

Therefore I ask this way. Why is the Roku set / limited to 12 Mbps?

No idea. It’s the highest number Plex client for Roku would allow me to pick from its video bitstream menu. There is no “Unlimited”. I wish there was, and then perhaps the issue would go away. But again, even with 12Mbps limit that Roku is transmitting to the Plex server, there is plenty of room for the original video stream and reencoded audio. And yet, Plex decides to convert video too.

Perhaps I’ll ask this another way. Does the log snippet in the original post have anything in it about why the video is being transcoded too? How can I troubleshoot this further?

Don’t confuse average bitrate with actual bitrate.
Even if your file has an average bitrate of ~6 mbps, it could have peaks in it which exceed that. The log snippet above confirms that. It states that there are bandwidth peaks with up to ~14 mbps in the file.
Hence the transcode.

for more detail see https://forums.plex.tv/discussion/comment/1582077/#Comment_1582077

Ahhh, so the 12Mbps limit was totally my mistake. I confused the client-wide settings with the per-movie settings that are accessible when the movie is paused… I set the client-wide settings to Original now, and the video reencoding went away.

The average vs peak bitrate explains the discrepancy in logged numbers.

Bottom line is that it’s all good now, thanks a lot for the prompt help.