Plex transcoding optimized movies instead of using direct stream even when it's unnecessary

I noticed an issue with the Optimized Versions feature. I’m using the “Optimized for TV” preset to create an 1080p H264 version of a HEVC 4k movie which has embedded SRT subtitles.
The optimization process creates the Movie.mp4 together with a Movie.lang.srt subtitle file. When playing the optimized movie in Chrome, Plex decides to transcode the VIDEO stream while it should be able to just direct stream the video and audio tracks:


When not selecting the subtitles:

Using another movie (not optimized) which has SRT subtitles embedded doesn’t cause the video stream to transcode:

The same is happening when NOT using subtitles but just selecting another audio track:

Does anybody know why Plex decides to transcode whole video while it could just copy the video and audio streams (the client can definitely play them, as direct play is working without subtitles)?

This DOES NOT happen with files which are not optimized, direct streaming a movie which is not optimized and selecting another audio track works as expected:
Using audio track 1:

Using audio track 2:

Not direct streaming:

May 14, 2018 16:22:06.859 [0x7feda5bff700] DEBUG - Request: [::ffff:127.0.0.1:40482 (Loopback)] GET /video/:/transcode/universal/decision?hasMDE=1&path=%2Flibrary%2Fmetadata%2F1628&mediaIndex=1&partIndex=0&protocol=dash&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=100&location=wan&addDebugOverlay=0&autoAdjustQuality=0&directStreamAudio=1&mediaBufferSize=102400&session=9456mj4wjjbz6izvbx3ymyz9&subtitles=burn&Accept-Language=de (5 live) TLS GZIP Signed-in Token (steffend_)
May 14, 2018 16:22:06.860 [0x7feda5bff700] DEBUG - Found session GUID of 9456mj4wjjbz6izvbx3ymyz9 in session start.
May 14, 2018 16:22:06.860 [0x7feda5bff700] DEBUG - TranscodeUniversalRequest: using profile Web
May 14, 2018 16:22:06.861 [0x7feda5bff700] DEBUG - Downloading document http://127.0.0.1:32400/library/metadata/1628?includeBandwidths=1&offset=-1&X-Plex-Session-Identifier=qp01y7wsxb8opjlmx6vpv5tf
May 14, 2018 16:22:06.862 [0x7feda5bff700] DEBUG - Auth: authenticated user 1 as steffend_
May 14, 2018 16:22:06.874 [0x7feda5bff700] DEBUG - Audio Stream: 7422, Subtitle Stream: 0
May 14, 2018 16:22:06.874 [0x7feda5bff700] DEBUG - Audio Stream: 7461, Subtitle Stream: 0
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - MDE: Selected protocol dash; container: mp4
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - MDE: analyzing media item 2279
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - MDE: MOVIE: Direct Play is disabled
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - MDE: MOVIE: media must be transcoded in order to use the dash protocol
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - MDE: MOVIE: selected audio stream is not the first audio stream and direct play stream selection is not enabled
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - MDE: MOVIE: no direct play video profile exists for http/mp4/h264
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - MDE: MOVIE: no direct play video profile exists for http/mp4/h264/aac
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - MDE: MOVIE: no direct play video profile exists for http/mp4/h264/aac
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - MDE: MOVIE: selected media 1 / 2279
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - Streaming Resource: Calculated bandwidth of 10500000kbps exceeds bandwidth limit. Changing decision parameters provided by client to fit bandwidth limit of 800000kbps
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - Streaming Resource: Determining preferred transcode encoders through transcode only decision.
May 14, 2018 16:22:06.876 [0x7feda5bff700] DEBUG - Scaled up video bitrate to 10846Kbps based on 1.500000x fudge factor.
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - Scaled up video bitrate to 10846Kbps based on 1.500000x fudge factor.
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - Streaming Resource: Reducing playback quality for 761904kbps stream bitrate: video resolution to 1920x800, audio channels to 6, quality to 99, disable video DS as 2147483647kbps is > the 15360kbps available, disable audio DS as 2147483647kbps is > the 768kbps available
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - Scaled up video bitrate to 10846Kbps based on 1.500000x fudge factor.
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: Selected protocol dash; container: mp4
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: analyzing media item 2279
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: MOVIE: Direct Play is disabled
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: MOVIE: media must be transcoded in order to use the dash protocol
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: MOVIE: selected audio stream is not the first audio stream and direct play stream selection is not enabled
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: MOVIE: no direct play video profile exists for http/mp4/h264
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: MOVIE: no direct play video profile exists for http/mp4/h264/aac
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: MOVIE: no direct play video profile exists for http/mp4/h264/aac
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: MOVIE: Direct Streaming is disabled, so video stream will be transcoded
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: MOVIE: no remuxable profile found, so video stream will be transcoded
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: Cannot direct stream video stream due to profile or setting limitations
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - Scaled up video bitrate to 10846Kbps based on 1.500000x fudge factor.
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: MOVIE: Audio Direct Streaming is disabled, so video's audio stream will be transcoded
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: Cannot direct stream audio stream due to profile or setting limitations
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - MDE: MOVIE: selected media 1 / 2279
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - Streaming Resource: Session 0x7fedbe623160:qp01y7wsxb8opjlmx6vpv5tf changed from using 16303kbps to 11658kbps of WAN bandwidth.  Used bandwidth is now 11658kbps
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - Streaming Resource: Session 0x7fedbe623160:qp01y7wsxb8opjlmx6vpv5tf changed transcode slot usage to used.  Used slots is now 1
May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - Streaming Resource: Reached Decision id=1628 codes=(General=1001,Direct play not available; Conversion OK. Direct Play=3000,App cannot direct play this item. Direct play is disabled. Transcode=1001,Direct play not available; Conversion OK.) media=(id=2279 part=(id=2281 decision=transcode container=mp4 protocol=dash streams=(Video=(id=7459 decision=transcode bitrate=10846 encoder=libx264 width=1920 height=800) Audio=(id=7461 decision=transcode bitrate=256 encoder=aac channels=2 rate=48000))))

vs.

May 14, 2018 16:28:41.583 [0x7fedbf3fd700] DEBUG - Request: [::ffff:127.0.0.1:43590 (Loopback)] GET /video/:/transcode/universal/decision?hasMDE=1&path=%2Flibrary%2Fmetadata%2F3&mediaIndex=0&partIndex=0&protocol=dash&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=100&location=wan&addDebugOverlay=0&autoAdjustQuality=0&directStreamAudio=1&mediaBufferSize=102400&session=j8im62guxkzudv898o74a8i1&subtitles=burn&Accept-Language=de (7 live) TLS GZIP Signed-in Token (steffend_)
May 14, 2018 16:28:41.583 [0x7fedbf3fd700] DEBUG - Found session GUID of j8im62guxkzudv898o74a8i1 in session start.
May 14, 2018 16:28:41.584 [0x7fedbf3fd700] DEBUG - TranscodeUniversalRequest: using profile Web
May 14, 2018 16:28:41.584 [0x7fedbf3fd700] DEBUG - Downloading document http://127.0.0.1:32400/library/metadata/3?includeBandwidths=1&offset=-1&X-Plex-Session-Identifier=qp01y7wsxb8opjlmx6vpv5tf
May 14, 2018 16:28:41.585 [0x7fedbf3fd700] DEBUG - Auth: authenticated user 1 as steffend_
May 14, 2018 16:28:41.601 [0x7fedbf3fd700] DEBUG - It took 10.000000 ms to retrieve 236 items.
May 14, 2018 16:28:41.602 [0x7fedbf3fd700] DEBUG - Audio Stream: 398, Subtitle Stream: 0
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - MDE: Selected protocol dash; container: mp4
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - MDE: analyzing media item 3
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - MDE: MOVIE 2: Direct Play is disabled
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - MDE: MOVIE 2: media must be transcoded in order to use the dash protocol
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - MDE: MOVIE 2: selected audio stream is not the first audio stream and direct play stream selection is not enabled
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - MDE: MOVIE 2: no direct play video profile exists for http/mp4/h264
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - MDE: MOVIE 2: no direct play video profile exists for http/mp4/h264/aac
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - MDE: MOVIE 2: no direct play video profile exists for http/mp4/h264/aac
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - MDE: MOVIE 2: selected media 0 / 3
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - Streaming Resource: Session 0x7fedb788eae0:qp01y7wsxb8opjlmx6vpv5tf changed from using 13290kbps to 12846kbps of WAN bandwidth.  Used bandwidth is now 12846kbps
May 14, 2018 16:28:41.605 [0x7fedbf3fd700] DEBUG - Streaming Resource: Reached Decision id=3 codes=(General=1001,Direct play not available; Conversion OK. Direct Play=3000,App cannot direct play this item. Direct play is disabled. Transcode=1001,Direct play not available; Conversion OK.) media=(id=3 part=(id=3 decision=transcode container=mp4 protocol=dash streams=(Video=(id=396 decision=copy width=1920 height=804) Audio=(id=398 decision=copy channels=6 rate=48000))))
May 14, 2018 16:28:41.607 [0x7fedc03ff700] DEBUG - Completed: [::ffff:127.0.0.1:43590] 200 GET /video/:/transcode/universal/decision?hasMDE=1&path=%2Flibrary%2Fmetadata%2F3&mediaIndex=0&partIndex=0&protocol=dash&fastSeek=1&directPlay=0&directStream=1&subtitleSize=100&audioBoost=100&location=wan&addDebugOverlay=0&autoAdjustQuality=0&directStreamAudio=1&mediaBufferSize=102400&session=j8im62guxkzudv898o74a8i1&subtitles=burn&Accept-Language=de (6 live) TLS GZIP 24ms 5419 bytes (pipelined: 6)

Why does it say “Streaming Resource: Calculated bandwidth of 10500000kbps exceeds bandwidth limit. Changing decision parameters provided by client to fit bandwidth limit of 800000kbps”. I have no limit set on the client side or server side (1000 mbps uplink). There seems to be something wrong.

Another case of unnecessary transcoding:


Transcoding FROM H264 4k TO H264 4k?!

Why does it say that it cannot play anything larger than 1080p but then still play 4k fine while transcoding? Manually opening the file using “https://plexserverurl/library/parts/2363/1526283961/file.mp4?download=0&X-Plex-Token=token” plays the movie fine, directly and in 4k.

please post the Plex XML info of the movie which doesn’t Direct Play. (the one from the first log file excerpt.)

Looks like PMS is of the opinion that this file requires over 2 terabit per second of bandwidth… :smiley:

May 14, 2018 16:22:06.877 [0x7feda5bff700] DEBUG - Streaming Resource: Reducing playback quality for 761904kbps stream bitrate: video resolution to 1920x800, audio channels to 6, quality to 99, disable video DS as 2147483647kbps is > the 15360kbps available, disable audio DS as 2147483647kbps is > the 768kbps available
<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="1" librarySectionTitle="Filme" librarySectionUUID="4fb71d08-57e5-475a-8de8-a6dac50c4880" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1525435723">
  <Video>
    <Media videoResolution="4k" id="2264" duration="8502744" bitrate="23984" width="3840" height="1600" aspectRatio="2.35" audioChannels="8" audioCodec="dca-ma" videoCodec="hevc" container="mkv" videoFrameRate="24p" audioProfile="ma" videoProfile="main 10" title="Original">
      <Part accessible="1" exists="1" id="2266" key="/library/parts/2266/1515690310/file.mkv" duration="8502744" file="/data/movies/movie.mkv" size="25491394871" audioProfile="ma" container="mkv" videoProfile="main 10">
        <Stream id="7421" streamType="1" default="1" codec="hevc" index="0" bitrate="22448" bitDepth="10" chromaSubsampling="4:2:0" colorPrimaries="bt2020" colorRange="tv" colorSpace="bt2020nc" colorTrc="smpte2084" frameRate="23.976" height="1600" level="153" profile="main 10" refFrames="1" width="3840" />
        <Stream id="7422" streamType="2" selected="1" default="1" codec="dca" index="1" channels="6" bitrate="768" language="Deutsch" languageCode="ger" audioChannelLayout="5.1(side)" bitDepth="16" profile="ma" samplingRate="48000" />
        <Stream id="7423" streamType="2" codec="dca" index="2" channels="8" bitrate="768" language="English" languageCode="eng" audioChannelLayout="7.1" bitDepth="24" profile="ma" samplingRate="48000" />
        <Stream id="7424" streamType="3" default="1" forced="1" codec="srt" index="3" language="Deutsch" languageCode="ger" title="GER FORCED SRT" />
        <Stream id="7425" streamType="3" codec="pgs" index="4" bitrate="0" language="Deutsch" languageCode="ger" title="GER FORCED PGS" />
        <Stream id="7426" streamType="3" codec="pgs" index="5" bitrate="34" language="Deutsch" languageCode="ger" title="GER FULL PGS" />
        <Stream id="7427" streamType="3" codec="pgs" index="6" bitrate="30" language="English" languageCode="eng" title="ENG FULL PGS" />
      </Part>
    </Media>
    <Media videoResolution="1080" id="2279" duration="8502753" bitrate="7763" width="1920" height="800" aspectRatio="2.35" audioChannels="6" audioCodec="aac" videoCodec="h264" container="mp4" videoFrameRate="24p" optimizedForStreaming="1" proxyType="42" audioProfile="lc" has64bitOffsets="1" target="Optimized for TV" targetTagID="2" videoProfile="main" title="Optimized for TV">
      <Part accessible="1" exists="1" id="2281" key="/library/parts/2281/1526154827/file.mp4" duration="8502753" file="/data/movies/Plex Versions/Optimized for TV/movie.mp4" size="8251121488" audioProfile="lc" container="mp4" has64bitOffsets="1" optimizedForStreaming="1" videoProfile="main">
        <Stream id="7459" streamType="1" default="1" codec="h264" index="0" bitrate="7231" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" frameRate="23.976" hasScalingMatrix="0" height="800" level="40" profile="main" refFrames="4" streamIdentifier="1" width="1920" />
        <Stream id="7460" streamType="2" default="1" codec="aac" index="1" channels="6" language="Deutsch" languageCode="ger" audioChannelLayout="5.1" profile="lc" samplingRate="48000" streamIdentifier="2" />
        <Stream id="7461" streamType="2" selected="1" codec="aac" index="2" channels="6" language="English" languageCode="eng" audioChannelLayout="5.1" profile="lc" samplingRate="48000" streamIdentifier="3" />
        <Stream id="7458" key="/library/streams/7458" streamType="3" forced="1" codec="srt" language="Deutsch" languageCode="ger" format="srt" />
      </Part>
    </Media>
    <Extras size="1"></Extras>
  </Video>
</MediaContainer>

The output of ffprobe, maybe this could help too.

{
  "streams": [
    {
      "index": 0,
      "codec_name": "h264",
      "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
      "profile": "Main",
      "codec_type": "video",
      "codec_time_base": "125/5994",
      "codec_tag_string": "avc1",
      "codec_tag": "0x31637661",
      "width": 1920,
      "height": 800,
      "coded_width": 1920,
      "coded_height": 800,
      "has_b_frames": 2,
      "sample_aspect_ratio": "1:1",
      "display_aspect_ratio": "12:5",
      "pix_fmt": "yuv420p",
      "level": 40,
      "chroma_location": "left",
      "refs": 4,
      "is_avc": "1",
      "nal_length_size": "4",
      "r_frame_rate": "2997/125",
      "avg_frame_rate": "2997/125",
      "time_base": "1/11988",
      "start_pts": 0,
      "start_time": "0.000000",
      "duration_ts": 101931000,
      "duration": "8502.752753",
      "bit_rate": "7230557",
      "bits_per_raw_sample": "8",
      "nb_frames": "203862",
      "disposition": {
        "default": 1,
        "dub": 0,
        "original": 0,
        "comment": 0,
        "lyrics": 0,
        "karaoke": 0,
        "forced": 0,
        "hearing_impaired": 0,
        "visual_impaired": 0,
        "clean_effects": 0,
        "attached_pic": 0
      },
      "tags": {
        "language": "und",
        "handler_name": "VideoHandler"
      }
    },
    {
      "index": 1,
      "codec_name": "aac",
      "codec_long_name": "AAC (Advanced Audio Coding)",
      "profile": "LC",
      "codec_type": "audio",
      "codec_time_base": "1/48000",
      "codec_tag_string": "mp4a",
      "codec_tag": "0x6134706d",
      "sample_fmt": "fltp",
      "sample_rate": "48000",
      "channels": 6,
      "channel_layout": "5.1",
      "bits_per_sample": 0,
      "r_frame_rate": "0/0",
      "avg_frame_rate": "0/0",
      "time_base": "1/48000",
      "start_pts": -1024,
      "start_time": "-0.021333",
      "duration_ts": 408120832,
      "duration": "8502.517333",
      "bit_rate": "257101",
      "max_bit_rate": "341000",
      "nb_frames": "398556",
      "disposition": {
        "default": 1,
        "dub": 0,
        "original": 0,
        "comment": 0,
        "lyrics": 0,
        "karaoke": 0,
        "forced": 0,
        "hearing_impaired": 0,
        "visual_impaired": 0,
        "clean_effects": 0,
        "attached_pic": 0
      },
      "tags": {
        "language": "ger",
        "handler_name": "SoundHandler"
      }
    },
    {
      "index": 2,
      "codec_name": "aac",
      "codec_long_name": "AAC (Advanced Audio Coding)",
      "profile": "LC",
      "codec_type": "audio",
      "codec_time_base": "1/48000",
      "codec_tag_string": "mp4a",
      "codec_tag": "0x6134706d",
      "sample_fmt": "fltp",
      "sample_rate": "48000",
      "channels": 6,
      "channel_layout": "5.1",
      "bits_per_sample": 0,
      "r_frame_rate": "0/0",
      "avg_frame_rate": "0/0",
      "time_base": "1/48000",
      "start_pts": -1024,
      "start_time": "-0.021333",
      "duration_ts": 408120832,
      "duration": "8502.517333",
      "bit_rate": "262975",
      "max_bit_rate": "341000",
      "nb_frames": "398556",
      "disposition": {
        "default": 0,
        "dub": 0,
        "original": 0,
        "comment": 0,
        "lyrics": 0,
        "karaoke": 0,
        "forced": 0,
        "hearing_impaired": 0,
        "visual_impaired": 0,
        "clean_effects": 0,
        "attached_pic": 0
      },
      "tags": {
        "language": "eng",
        "handler_name": "SoundHandler"
      }
    }
  ],
  "format": {
    "filename": "movie.mp4",
    "nb_streams": 3,
    "nb_programs": 0,
    "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
    "format_long_name": "QuickTime / MOV",
    "start_time": "-0.021333",
    "duration": "8502.753000",
    "size": "8251121488",
    "bit_rate": "7763247",
    "probe_score": 100,
    "tags": {
      "major_brand": "isom",
      "minor_version": "512",
      "compatible_brands": "isomiso2avc1mp41",
      "encoder": "Lavf58.9.100"
    }
  }
}

Thanks you for the media info. This is looking all sanely.
Can you look at the XML page again please?
But this time, go into the address bar and replace the part that says includeExtras=1 with includeBandwidths=1
Then post it again.

P.S. When did you perform the optimzation? Just today or is it already a few days?

includeBandwidths=1 was already set to 1, actually, setting it to 0 makes no difference:

~ curl https://plexserver/library/metadata/1628\?checkFiles\=1\&includeBandwidths\=0\&X-Plex-Token\=redacted > 1.xml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14502    0 14502    0     0  71979      0 --:--:-- --:--:-- --:--:-- 71792
~ curl https://plexserver/library/metadata/1628\?checkFiles\=1\&includeBandwidths\=1\&X-Plex-Token\=redacted > 2.xml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14502    0 14502    0     0  44656      0 --:--:-- --:--:-- --:--:-- 44759d
~ diff 1.xml 2.xml
~ 

The optimization was done yesterday, but exactly the same is written to the log using a file I optimized today.

I just tried to remux the optimized movie using ffmpeg (mkv container just for testing):
ffmpeg -i movie.mp4 -map 0:0 -vcodec copy -map 0:1 -acodec copy "movie.mkv"

Playing this file using Plex also causes the “disable video DS as 2147483647kbps is” log message…
Plex Server version: 1.13.0.5023

Have you disabled the Scheduled Task which performs the in-depth analysis of your media files?
Is your server actually switched on during the maintenance hours?
https://support.plex.tv/articles/201553286-scheduled-tasks/

The server is running 24/7…

Then I’m stumped why I don’t see the requiredBandwidths="... property for the streams.
This would be most enlightening for the diagnosing.

Have you verified that the optimized version is actually playable in full? Perhaps the analysis failed for this item due to some weirdness in the file.

Do the requiredBandwidths="... appear on other videos in your library?

Could you trigger an Analyze manually for this movie?
Then wait a few minutes and look at the XML again.

Yes, I’m actually seeing requiredBandwidths= for most other movies, but not for the optimized version:

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="1" librarySectionTitle="Filme" librarySectionUUID="4fb71d08-57e5-475a-8de8-a6dac50c4880" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1525435723">
  <Video>
    <Media videoResolution="1080" id="1806" duration="6966005" bitrate="31952" width="1920" height="1080" aspectRatio="1.78" audioChannels="6" audioCodec="dca" videoCodec="vc1" container="mkv" videoFrameRate="24p" audioProfile="dts" videoProfile="advanced" title="Original">
      <Part accessible="1" exists="1" id="1808" key="/library/parts/1808/1447439002/file.mkv" duration="6966005" file="/data/movies/Back to the Future (1985).mkv" size="27822571254" audioProfile="dts" container="mkv" deepAnalysisVersion="2" requiredBandwidths="35052,34444,34049,33871,33697,33523,33127,33127" videoProfile="advanced">
        <Stream id="6348" streamType="1" default="1" codec="vc1" index="0" bitrate="30416" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" frameRate="23.976" height="1080" level="3" profile="advanced" refFrames="1" requiredBandwidths="29827,29170,28714,28330,28205,28104,28052,28052" scanType="progressive" width="1920" />
        <Stream id="6349" streamType="2" selected="1" default="1" codec="dca" index="1" channels="6" bitrate="768" language="Deutsch" languageCode="ger" audioChannelLayout="5.1(side)" profile="dts" requiredBandwidths="768,768,768,768,768,768,768,768" samplingRate="48000" title="German DTS 5.1 768 kbps | GER BD" />
        <Stream id="6350" streamType="2" codec="dca" index="2" channels="6" bitrate="768" language="English" languageCode="eng" audioChannelLayout="5.1(side)" bitDepth="24" profile="ma" requiredBandwidths="4912,4776,4619,4433,4332,4249,4249,4249" samplingRate="48000" title="English DTS-HD MA 5.1  4250 kbps | US BD" />
        <Stream id="6351" streamType="3" default="1" codec="pgs" index="3" bitrate="13" language="English" languageCode="eng" headerCompression="1" requiredBandwidths="52,52,52,52,52,52,52,52" />
        <Stream id="6352" streamType="3" codec="pgs" index="4" bitrate="14" language="Deutsch" languageCode="ger" headerCompression="1" requiredBandwidths="96,96,96,96,96,96,96,96" />
        <Stream id="6353" streamType="3" codec="pgs" index="5" bitrate="0" language="Deutsch" languageCode="ger" headerCompression="1" requiredBandwidths="71,71,71,71,71,71,71,71" title="German Forced" />
      </Part>
    </Media>
    <Media videoResolution="1080" id="2292" duration="6966008" bitrate="8355" width="1920" height="1080" aspectRatio="1.78" audioChannels="6" audioCodec="aac" videoCodec="h264" container="mp4" videoFrameRate="24p" optimizedForStreaming="1" proxyType="42" audioProfile="lc" has64bitOffsets="1" target="Optimized for TV" targetTagID="2" videoProfile="main" title="Optimized for TV">
      <Part accessible="1" exists="1" id="2294" key="/library/parts/2294/1526269363/file.mp4" duration="6966008" file="/data/optimized/movies/Plex Versions/Optimized for TV/Back to the Future (1985).mp4" size="7274751839" audioProfile="lc" container="mp4" has64bitOffsets="1" optimizedForStreaming="1" videoProfile="main">
        <Stream id="7496" streamType="1" default="1" codec="h264" index="0" bitrate="7839" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" frameRate="23.976" hasScalingMatrix="0" height="1080" level="40" profile="main" refFrames="4" streamIdentifier="1" width="1920" />
        <Stream id="7497" streamType="2" selected="1" default="1" codec="aac" index="1" channels="6" language="Deutsch" languageCode="ger" audioChannelLayout="5.1" profile="lc" samplingRate="48000" streamIdentifier="2" />
        <Stream id="7498" streamType="2" codec="aac" index="2" channels="6" language="English" languageCode="eng" audioChannelLayout="5.1" profile="lc" samplingRate="48000" streamIdentifier="3" />
      </Part>
    </Media>
  </Video>
</MediaContainer>

I just triggered an analyzation, and check if this changes in the next few minutes.

EDIT: Yes, playing the files is working fine.

Weird. I see the detailed analysis for optimized versions too.
Perhaps the analysis crashes on a different file beforehand, so the Butler never reaches your newer files.

The manually triggered analysis will give us a hint.

Okay maybe the issue is, that the Deep Analysis is currently busy scanning some TV-Shows I recently added (I just enabled the scheduled tasks for the whole day):

May 14, 2018 17:37:46.791 [0x7fa6d97f7800] DEBUG - Opening 20 database sessions to library (com.plexapp.plugins.library), SQLite 3.13.0, threadsafe=1
May 14, 2018 17:37:46.934 [0x7fa6d97f7800] DEBUG - [MI] Opening input file: "/data/shows/[...].mkv"
May 14, 2018 17:37:46.935 [0x7fa6d97f7800] DEBUG - [FFMPEG] - Opening '/data/shows/[...].mkv' for reading

I guess I’ll have to wait for it to complete scanning these items, before it scans the optimized movies, added after the shows?
Still: When PMS hasn’t performed deep analysis yet, shouldn’t it just use the average bitrate for its calculations instead of going crazy and thinking it requires 2147483647kbps of bandwidth?

@steffend_ said:
I guess I’ll have to wait for it to complete scanning these items, before it scans the optimized movies, added after the shows?

I think so, yes.

Still: When PMS hasn’t performed deep analysis yet, shouldn’t it just use the average bitrate for its calculations instead of going crazy and thinking it requires 2147483647kbps of bandwidth?

Yes, it should do that - with some added ‘safety margin’ on top.
But the detailed analysis was mainly interesting to see whether the optimized file has any damage inside. It may be still a genuine bug in the server.
But the more data & evidence we gather, the better the chances of a swift fix.

I’ll try to manually force a deep analysis and check, if the error still happens (I’ll also post the updated XML).
export LD_LIBRARY_PATH=/usr/lib/plexmediaserver
/usr/lib/plexmediaserver/Plex\ Media\ Scanner --analyze-deeply --item 1628 --log-file-suffix Deep Analysis

seems to work, but takes a while…

Direct Stream works after the Deep Analysis is finished! The 2147483647kbps seems to be a bug in the server.

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="1" librarySectionTitle="Filme" librarySectionUUID="4fb71d08-57e5-475a-8de8-a6dac50c4880" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1525435723">
  <Video>
    <Media videoResolution="4k" id="2264" duration="8502744" bitrate="23984" width="3840" height="1600" aspectRatio="2.35" audioChannels="8" audioCodec="dca-ma" videoCodec="hevc" container="mkv" videoFrameRate="24p" audioProfile="ma" videoProfile="main 10" title="Original">
      <Part accessible="1" exists="1" id="2266" key="/library/parts/2266/1515690310/file.mkv" duration="8502744" file="/data/movies/movie.mkv" size="25491394871" audioProfile="ma" container="mkv" deepAnalysisVersion="2" requiredBandwidths="44892,42645,40392,37611,36157,35395,31641,27532" videoProfile="main 10">
        <Stream id="7421" streamType="1" default="1" codec="hevc" index="0" bitrate="22448" bitDepth="10" chromaSubsampling="4:2:0" colorPrimaries="bt2020" colorRange="tv" colorSpace="bt2020nc" colorTrc="smpte2084" frameRate="23.976" height="1600" level="153" profile="main 10" refFrames="1" requiredBandwidths="38194,35931,33710,30985,29739,28977,24909,20990" width="3840" />
        <Stream id="7422" streamType="2" selected="1" default="1" codec="dca" index="1" channels="6" bitrate="768" language="Deutsch" languageCode="ger" audioChannelLayout="5.1(side)" bitDepth="16" profile="ma" requiredBandwidths="2344,2230,2230,2230,2230,2230,2230,2230" samplingRate="48000" />
        <Stream id="7423" streamType="2" codec="dca" index="2" channels="8" bitrate="768" language="English" languageCode="eng" audioChannelLayout="7.1" bitDepth="24" profile="ma" requiredBandwidths="5775,5506,4797,4406,4345,4289,4229,4229" samplingRate="48000" />
        <Stream id="7424" streamType="3" default="1" forced="1" codec="srt" index="3" language="Deutsch" languageCode="ger" requiredBandwidths="1,1,1,1,1,1,1,1" title="GER FORCED SRT" />
        <Stream id="7425" streamType="3" codec="pgs" index="4" bitrate="0" language="Deutsch" languageCode="ger" requiredBandwidths="32,32,32,32,32,32,32,32" title="GER FORCED PGS" />
        <Stream id="7426" streamType="3" codec="pgs" index="5" bitrate="34" language="Deutsch" languageCode="ger" requiredBandwidths="46,46,46,46,46,46,46,46" title="GER FULL PGS" />
        <Stream id="7427" streamType="3" codec="pgs" index="6" bitrate="30" language="English" languageCode="eng" requiredBandwidths="40,40,40,40,40,40,40,40" title="ENG FULL PGS" />
      </Part>
    </Media>
    <Media videoResolution="1080" id="2279" duration="8502753" bitrate="7763" width="1920" height="800" aspectRatio="2.35" audioChannels="6" audioCodec="aac" videoCodec="h264" container="mp4" videoFrameRate="24p" optimizedForStreaming="1" proxyType="42" audioProfile="lc" has64bitOffsets="1" target="Optimized for TV" targetTagID="2" videoProfile="main" title="Optimized for TV">
      <Part accessible="1" exists="1" id="2281" key="/library/parts/2281/1526154827/file.mp4" duration="8502753" file="/data/movies/Plex Versions/Optimized for TV/movie.mp4" size="8251121488" audioProfile="lc" container="mp4" deepAnalysisVersion="2" has64bitOffsets="1" optimizedForStreaming="1" requiredBandwidths="8386,8227,8134,8029,8029,8029,8029,8029" videoProfile="main">
        <Stream id="7459" streamType="1" default="1" codec="h264" index="0" bitrate="7231" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" frameRate="23.976" hasScalingMatrix="0" height="800" level="40" profile="main" refFrames="4" requiredBandwidths="7860,7713,7615,7512,7512,7512,7512,7512" streamIdentifier="1" width="1920" />
        <Stream id="7460" streamType="2" default="1" codec="aac" index="1" channels="6" language="Deutsch" languageCode="ger" audioChannelLayout="5.1" profile="lc" requiredBandwidths="258,258,258,258,258,258,258,258" samplingRate="48000" streamIdentifier="2" />
        <Stream id="7461" streamType="2" selected="1" codec="aac" index="2" channels="6" language="English" languageCode="eng" audioChannelLayout="5.1" profile="lc" requiredBandwidths="264,264,264,264,264,264,264,264" samplingRate="48000" streamIdentifier="3" />
      </Part>
    </Media>
  </Video>
</MediaContainer>

@steffend_ said:
Direct Stream works after the Deep Analysis is finished!

Awesome!

The 2147483647kbps seems to be a bug in the server.

I was told now, that this is used when the bandwidth of the stream is unknown.
Did you try to play the file when it was very ‘freshly’ optimized? Maybe Plex didn’t even know the average bandwidth then?

I’d keep an eye on the deep analysis.
If some of your movies are still missing this information in a few weeks’ time, I’d go & analyze the server logs from the nightly Butler activity.
Maybe you’ll find one problematic file which causes the analyser to crash.
In which case, the developers would like to get their hands on it, so the issue can be fixed.

First of all, thank you @OttoKerner for your great support!

I was told now, that this is used when the bandwidth of the stream is unknown.

I think that there still is an issue about this:

<Stream id="7496" streamType="1" default="1" codec="h264" index="0" bitrate="7839" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" frameRate="23.976" hasScalingMatrix="0" height="1080" level="40" profile="main" refFrames="4" streamIdentifier="1" width="1920" />

This was before the deep analysis and clearly the average bitrate of the streams is known. Maybe Plex is just not using this information because it is waiting for the result of the deep analysis. I’m pretty sure, direct stream was working fine before the deep analysis feature was introduced. After monitoring the Plex Media Scanner Deep Analysis.log I can reproducibly only direct stream the files, which have already been deeply analysed (having requiredBandwidths). Files waiting for the Scanner cause the 2147483647kbps message in the log.

Maybe you’ll find one problematic file which causes the analyser to crash.

I think the analyser is working fine, I just needed to make the scheduled tasks window larger, as I had it set to only 3 hours, and my storage is mounted via NFS with only 100 Mbit/s. I guess that’s why Plex wasn’t fast enough with only 3 hours of deep analysis per day and having some large files recently added.

Are you running PMS on a NAS or the Raspberry Pi?

Sorry for the late response, I’ll have to enable mail notifications somewhere…
No, I am running it on a Quad-Core Xeon Server Intel(R) Xeon(R) CPU E3-1246 v3 @ 3.50GHz.