Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Unnecessary Transcoding of H264

tproencatproenca Posts: 28Members, Plex Pass Plex Pass

I noticed that my Plex Media Server was transcoding H264 6ch AAC/AC3 unnecessary for my iOS devices.

I have the following iOS devices:

  • AppleTV
  • iPhone 7
  • iPad mini 2

All of them are capable of playing directly that kind of media. So, I adjusted the profiles. If anyone is interested, I'm pasting them bellow. Create the files and put them in ${your home folder}/Library/Application Support/Plex Media Server/Profiles (Create the directory if it doesn't exist).

iOS.xml

<?xml version="1.0" encoding="utf-8"?>
<Client name="iOS">
  <!-- Author: Plex Inc. -->
  <!-- This profile is used by A5 and higher devices (starting with iPhone 4S and iPad 3) -->
  <Settings>
    <Setting name="DirectPlayStreamSelection" value="true" />
    <Setting name="StreamUnselectedIncompatibleAudioStreams" value="true" />
  </Settings>
  <TranscodeTargets>
    <VideoProfile protocol="hls" container="mpegts" codec="h264" audioCodec="aac,ac3,mp3" context="streaming" />
    <MusicProfile container="mp3" codec="mp3" />
    <PhotoProfile container="jpeg" />
    <SubtitleProfile protocol="hls" container="webvtt" subtitleCodec="webvtt"/>
  </TranscodeTargets>
  <DirectPlayProfiles>
    <VideoProfile container="mp4,mov" codec="h264,mpeg4" audioCodec="aac,ac3,eac3" subtitleCodec="mov_text,tx3g,ttxt,text" />
    <!-- Allow Direct Play of HLS content  -->
    <VideoProfile protocol="hls" container="mpegts" codec="h264" audioCodec="aac" />
    <MusicProfile container="mp3" codec="mp3" />
    <MusicProfile container="mp4" codec="aac" />
    <PhotoProfile container="jpeg" />
  </DirectPlayProfiles>
  <CodecProfiles>
    <VideoCodec name="h264">
      <Limitations>
        <UpperBound name="video.width" value="1920" isRequired="true" />
        <UpperBound name="video.height" value="1080" isRequired="true" />
        <UpperBound name="video.bitDepth" value="8" />
      </Limitations>
    </VideoCodec>
    <VideoAudioCodec name="aac">
      <Limitations>
        <UpperBound name="audio.channels" value="6" />
      </Limitations>
    </VideoAudioCodec>
  </CodecProfiles>
</Client>

tvOS.xml

<?xml version="1.0" encoding="utf-8"?>
<Client name="tvOS">
  <!-- Author: Plex Inc. -->
  <!-- This profile is used by A8-based tvOS devices -->
  <Settings>
    <Setting name="DirectPlayStreamSelection" value="true" />
    <Setting name="StreamUnselectedIncompatibleAudioStreams" value="true" />
  </Settings>
  <TranscodeTargets>
    <VideoProfile protocol="hls" container="mpegts" codec="h264" audioCodec="aac,ac3,mp3" context="streaming" />
    <MusicProfile container="mp3" codec="mp3" />
    <PhotoProfile container="jpeg" />
    <SubtitleProfile protocol="hls" container="webvtt" subtitleCodec="webvtt"/>
  </TranscodeTargets>
  <DirectPlayProfiles>
    <VideoProfile container="mp4" codec="h264,mpeg4" audioCodec="aac,ac3,eac3" subtitleCodec="mov_text,tx3g,ttxt,text" />
    <!-- Since tvOS may have issues direct playing mov/*/eac3 it has its own profile  -->
    <VideoProfile container="mov" codec="h264,mpeg4" audioCodec="aac,ac3" subtitleCodec="mov_text,tx3g,ttxt,text" />
    <!-- Allow Direct Play of HLS content  -->
    <VideoProfile protocol="hls" container="mpegts" codec="h264" audioCodec="aac" />
    <MusicProfile container="mp3" codec="mp3" />
    <MusicProfile container="mp4" codec="aac" />
    <PhotoProfile container="jpeg" />
  </DirectPlayProfiles>
  <CodecProfiles>
    <VideoCodec name="h264">
      <Limitations>
        <UpperBound name="video.width" value="1920" isRequired="true" />
        <UpperBound name="video.height" value="1080" isRequired="true" />
        <UpperBound name="video.bitDepth" value="8" />
      </Limitations>
    </VideoCodec>
    <VideoAudioCodec name="aac">
      <Limitations>
        <UpperBound name="audio.channels" value="6" />
      </Limitations>
    </VideoAudioCodec>
  </CodecProfiles>
</Client>
Tagged:

Answers

  • drinehartdrinehart Posts: 1,141Members, Plex Pass Plex Pass

    It is likely detecting stereo connectivity on your device and transcoding from multi-channel AC3 to dual-channel AAC. There is not a lot of reason to send 5.1 sound to headphones in most cases.

  • tproencatproenca Posts: 28Members, Plex Pass Plex Pass

    True. However, I believe the iOS video player can deal with that since I can hear alright the sounds. What is worse is to have it transcoding, since the player can play it. Even worse, when using the Sync functionality.

  • ryanchildryanchild Posts: 4Members

    Did this work for you? I came across this post while trying to figure out why Plex is transcoding videos that I exported from my iPhone, when playing back on the plex client in iOS and tvOS. Unfortunately adding those files didn't change anything, other than generating these errors and warnings in the PMS log file:

    Mar 09, 2017 18:04:44.062 [0x700006db5000] ERROR - ClientProfileExtra: missing protocol parameter
    Mar 09, 2017 18:04:44.062 [0x700006db5000] WARN - ClientProfileExtra: ignoring directive: add-transcode-target(type=videoProfile&context=static&container=mp4&videoCodec=h264&audioCodec=aac,ac3&subtitleCodec=mov_text)
    Mar 09, 2017 18:04:44.062 [0x700006db5000] WARN - TranscodeUniversalRequest: at least one profile extra directive could not be read
    Mar 09, 2017 18:04:44.062 [0x700006db5000] ERROR - ClientProfileExtra: video transcode target already exists for  streaming hls
    Mar 09, 2017 18:04:44.270 [0x700006db5000] ERROR - ClientProfileExtra: missing protocol parameter
    Mar 09, 2017 18:04:44.270 [0x700006db5000] WARN - ClientProfileExtra: ignoring directive: add-transcode-target(type=videoProfile&context=static&container=mp4&videoCodec=h264&audioCodec=aac,ac3&subtitleCodec=mov_text)
    Mar 09, 2017 18:04:44.270 [0x700006db5000] WARN - TranscodeUniversalRequest: at least one profile extra directive could not be read
    Mar 09, 2017 18:04:44.271 [0x700006db5000] ERROR - ClientProfileExtra: video transcode target already exists for  streaming hls
    Mar 09, 2017 18:04:44.318 [0x7000071cd000] ERROR - ClientProfileExtra: missing protocol parameter
    Mar 09, 2017 18:04:44.318 [0x7000071cd000] WARN - ClientProfileExtra: ignoring directive: add-transcode-target(type=videoProfile&context=static&container=mp4&videoCodec=h264&audioCodec=aac,ac3&subtitleCodec=mov_text)
    Mar 09, 2017 18:04:44.318 [0x7000071cd000] WARN - TranscodeUniversalRequest: at least one profile extra directive could not be read
    Mar 09, 2017 18:04:44.318 [0x7000071cd000] ERROR - ClientProfileExtra: video transcode target already exists for  streaming hls
    
  • ryanchildryanchild Posts: 4Members

    Oddly when I removed those additional profiles and restarted PMS, the problem now seems to be resolved, at least for the time being. Wondering if adding and removing these user profiles caused some sort of refresh of the built-in profiles that caused PMS to stop incorrectly transcoding. Very strange... well thanks for the fix I guess? I'll just cross my fingers that Plex doesn't randomly start transcoding again.

  • albertoperojoalbertoperojo Posts: 8Members Plex Pass

    This worked perfectly for me, thanks OP :smile:

  • sytaneksytanek Posts: 3Members, Plex Pass Plex Pass
    edited June 15

    I had the same scenario, files has 2 audio streams, aac 2 channel, as well as aac 5.1, and it was still transcoding (even when selecting stereo, and the stereo stream exists). Upped the max channels to 6, and no more issues, and plays just fine. I ultimately ended up changing it to 8 channels to handle 7.1 and it still direct plays without an issue.

  • ryanchildryanchild Posts: 4Members

    I'm unable to find this max channels setting, is it a server or a player setting?

  • ryanchildryanchild Posts: 4Members

    I changed Settings->Quality->Home Streaming to "Maximum" on the iPhone app and it started direct playing.

  • LehighBriLehighBri Posts: 33Members Plex Pass

    @sytanek said:
    I had the same scenario, files has 2 audio streams, aac 2 channel, as well as aac 5.1, and it was still transcoding (even when selecting stereo, and the stereo stream exists). Upped the max channels to 6, and no more issues, and plays just fine. I ultimately ended up changing it to 8 channels to handle 7.1 and it still direct plays without an issue.

    Is there a way to request this be included in the base Plex install by default vs. us having to change it? e.g. Apple TV 4 we know can play 6 aac channels, so having the setting at 6 instead of 2 after a fresh install would be very helpful (to maximize the ability to direct play). Thoughts?

  • dragonmeldragonmel Posts: 599Members, Plex Pass Plex Pass

    I thought with the new MDE that plex no longer used server side client profiles.. and that the client was responsible for 'pushing' its request having looked at the files xml to decide if it could play it or not? and if it cant then requests a transocde?

    someone smarter than me on the streaming brain/MDE hopefully can weigh in and clear this up..

    I am betting that given the pattern of complaints..

    something got rolled in between the public and pass branches during the last update to 1.7.5

    plexpas folks were having far less issues with 1.7.2 and public with 1.5.x ...

    now boom... seems like the transcoder is not handshaking the requests properly...

  • LehighBriLehighBri Posts: 33Members Plex Pass

    No clue. All I know is there's a bunch of xml files on the server that seem to still drive different behavior on the client side. I think that's fine... but my main ask is to make them default/relevant to what the device can actually do (e.g. Apple TV can handle 6 channel AAC just fine... but in the tvOS.xml file it has 2 as the max # of channels which then forces transcoding to happen when not needed). Plex devs... hope there's something you can help with here?

  • dragonmeldragonmel Posts: 599Members, Plex Pass Plex Pass

    @LehighBri

    In complete agreement that the clients are transcoding far more than they need to be. My server side has no /profiles directory at all and in a linux install that goes back to a fairly old 1.x build.

    Hopefully plex will straighten this out but I have yet to find a thread especially on my primary client tvOS where plex has even addressed that there is an issue.

    The devs have been very quite on the board for quite awhile now and it seems that everything is being handled or at the very least triaged by level 1 reps and volunteers. Without public bug tracking there's no way of knowing what if anything is actually being reported back to the dev planners and coders. I guess time will tell

Sign In or Register to comment.