Why am I transcoding?

Server Version#: 1.20.1.3252
Player Version#: 3rd Gen. Chromecast

I cannot for the life of me figure out why certain media is transcoded.

My Plex server is running on a Raspberry Pi 4B, so I avoid transcoding like the plague. I reference this guide for supported formats (all of my players are 3rd Gen. Chromecasts), use ffmpeg to match my media to specification, which my server generally direct plays without issue. Everything is played locally, so bandwidth is not the problem.

For the longest time remuxing/reencoding media to H264, AAC 2.0, .mp4, and removing any subtitles has worked great. For some reason, I’ve run into a couple of files that seem to require further tweaking, but I just don’t understand why.

I thought I had narrowed it down to the video stream H264 profile level and color profiles, but now I’m not so sure. The “Supported Media for Google Cast” that I linked above only mentions H264 profile levels, and says nothing about color profiles. I am able to direct play one video at level 5.0, but with “unknown” color range, space, transfer, and primaries, while at the same time another video at level 4.0, and unknown color profiles (according to ffprobe) tries to transcode. Changing the color profiles to tv / bt709 fixes the transcoding problem, but it is so inconsistent, and I would love to figure out exactly what is causing this inconsistency. I must be missing a setting somewhere, or ffprobe is not showing that information.

I am happy to share any logs or ffmpeg/ffprobe outputs.

Luckily, I noticed the setting for completely disabling transcoding, which stops my Raspberry Pi from catching on fire when my wife accidentally plays unsupported media and it tries to transcode it for hours. However, I would still like to understand what I am missing here.

Thanks!

in the logs, look for entries with
mde: will tell WHY something is transcoded
tpu: will tell you WHAT cpu/or gpu transcoder mode is used

you can see/filter the logs @ https://app.plex.tv/desktop > settings > console

or settings > troubleshooting > download logs

What client are you using to Cast from? That can also have an impact. To know for sure you’ll need to recreate the playback then provide logs from PMS.

@TeknoJunky Console is very helpful here. However, PMS is seeing a different profile level than ffprobe:

Logs:

[Chromecast] [MDE] Invalid profile property; level: 50 > 42

ffprobe media.mp4 -show_streams:

...
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 5102 kb/s, 23.98 fps, 23.98 tbr, 16k tbn, 47.95 tbc (default)
...
[STREAM]
index=0
...
level=41

From what I understand, the media is H264 Profile level 4.1, but PMS is seeing 5.0?

@MovieFan.Plex Transcoding initiates from both my Pixel 3 Plex app, as well as my Windows 10 Chrome web app. Both show profile level 5.0 in the logs even though I am pretty sure the media is level 4.1.

Please provide the XML from Plex and the entire output from ffprobe.

XML:

<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="15" librarySectionTitle="television" librarySectionUUID="6200d6a3-6fb1-43c5-97c9-3af0cf318555" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1598519473">
  <Video ratingKey="35094" key="/library/metadata/35094" parentRatingKey="35093" grandparentRatingKey="35048" guid="com.plexapp.agents.none://35048/4/1?lang=xn" parentGuid="com.plexapp.agents.none://35048/4?lang=xn" grandparentGuid="com.plexapp.agents.none://35048?lang=xn" type="episode" title="Blood of the Father, Heart of Steel" grandparentKey="/library/metadata/35048" parentKey="/library/metadata/35093" librarySectionTitle="television" librarySectionID="15" librarySectionKey="/library/sections/15" grandparentTitle="The Venture Bros." parentTitle="Season 4" summary="Questions are answered and truths are revealed." index="1" parentIndex="4" year="2009" thumb="/library/metadata/35094/thumb/1597619407" art="/library/metadata/35048/art/1597619409" parentThumb="/library/metadata/35093/thumb/1597619409" grandparentThumb="/library/metadata/35048/thumb/1597619409" grandparentArt="/library/metadata/35048/art/1597619409" duration="1417718" originallyAvailableAt="2009-10-18" addedAt="1596239878" updatedAt="1597619407" createdAtAccuracy="epoch" createdAtTZOffset="-25200">
    <Media id="31338" duration="1417718" bitrate="5237" width="1920" height="1080" aspectRatio="1.78" audioChannels="2" audioCodec="aac" videoCodec="h264" videoResolution="1080" container="mp4" videoFrameRate="24p" optimizedForStreaming="0" audioProfile="lc" has64bitOffsets="0" videoProfile="high">
      <Part accessible="1" exists="1" id="36243" key="/library/parts/36243/1596239878/file.mp4" duration="1417718" file="/mnt/media/television/the_venture_bros/S04E01.mp4" size="928103807" audioProfile="lc" container="mp4" has64bitOffsets="0" optimizedForStreaming="0" videoProfile="high">
        <Stream id="55710" streamType="1" default="1" codec="h264" index="0" bitrate="5103" language="English" languageCode="eng" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" codedHeight="1088" codedWidth="1920" frameRate="23.976" hasScalingMatrix="0" height="1080" level="50" profile="high" refFrames="5" streamIdentifier="1" width="1920" displayTitle="1080p (H.264)" extendedDisplayTitle="1080p (H.264)"/>
        <Stream id="55711" streamType="2" selected="1" default="1" codec="aac" index="1" channels="2" bitrate="135" language="English" languageCode="eng" audioChannelLayout="stereo" profile="lc" samplingRate="48000" streamIdentifier="2" displayTitle="English (AAC Stereo)" extendedDisplayTitle="English (AAC Stereo)"/>
      </Part>
    </Media>
    <Extras size="0"> </Extras>
    <Related> </Related>
  </Video>
</MediaContainer>

ffprobe:

$ ffprobe S04E01.mp4 -hide_banner -show_streams

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'S04E01.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Blood of the Father, Heart of Steel
    composer        : Jackson Publick
    date            : 2009-10-18
    encoder         : Lavf58.20.100
    genre           : Action, Comedy, Animation
    description     : Questions are answered and truths are revealed.
    show            : The Venture Bros.
    episode_id      : 1
    network         : Adult Swim
    season_number   : 4
  Duration: 00:23:37.72, start: 0.000000, bitrate: 5237 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 5102 kb/s, 23.98 fps, 23.98 tbr, 16k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=94511/4532000
codec_tag_string=avc1
codec_tag=0x31637661
width=1920
height=1080
coded_width=1920
coded_height=1088
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=41
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=2266000/94511
time_base=1/16000
start_pts=0
start_time=0.000000
duration_ts=22682640
duration=1417.665000
bit_rate=5102538
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=33990
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=VideoHandler
[/STREAM]
[STREAM]
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=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=68049408
duration=1417.696000
bit_rate=128525
max_bit_rate=128525
bits_per_raw_sample=N/A
nb_frames=66456
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:handler_name=SoundHandler
[/STREAM]

Not sure why the profile levels are different, might need a sample of the file to check. There is nothing super wrong with that file. However:

coded_height=1088

That could be the cause. Chromecast can’t scale the video so PMS is likely transcoding to get this to 1080. Could also be that PMS is seeing the profile as 5.0. This is strange. Was this a new file or did you replace an older version? If the latter, it could be PMS didn’t update it’s info. Try a Plex Dance of the file.

Will need to logs from PMS after recreating the issue to dig further.

I re-encoded using the following settings:

ffmpeg -hide_banner \
               -i "$filename" \
               -c:v libx264 \
               -c:a aac -ac 2 \
               -color_range 1 \
               -colorspace bt709 \
               -color_trc bt709 \
               -color_primaries bt709 \
               ...

Now ffprobe shows profile level 40 (even though I did not specify the profile level explicitly). Removed & re-added it to Plex, and the xml shows level 4.0, and direct plays to Chromecast.

The “Coded Height” attribute still says 1088, but that does not seem to bother the Chromecast.

Nice work. So I guess one or more of the unknown color parameters was the cause.

It seems like changing one or more of the color parameters (and thus re-encoding) changed the H264 level from 4.1 to 4.0 (both of which should be able to direct play on Chromecast). I’m still not sure about why Plex thought the original file was 5.0, but at least now I know to check the XML to see what Plex thinks the file is to troubleshoot transcoding.

I’ll keep playing around with variables and post here if I find out anything else.

Do you still have the original file? It could just be a badly made file. If you remux it, that might fix the problem and you wouldn’t need to reencode the entire thing.

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