If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
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!

RPi Transcoding

LongChairLongChair Plex Dev TeamPosts: 669Members, Plex Pass, Plex Ninja Plex Ninja
edited March 2014 in Rasplex

In order to build / update the Rpi transcoding profile for RasPlex, i'll gather here the information that the transcoding profile will use.

 

Please let me know what you experiences are so that we can make it as much complete as possible.

 

We need to know which formats are playing fine on Rpi from your experience. if they are not listed below, just drop a post in this thread so that i can complete this list and the implementation/

Whatever will not be in this list will ask Plex Media Server for transcoding :)

 

 

1 - Default transcoding format :

  • container : mpegts
  • Video codec : h264
  • Audio codec : aac, ac3, mp3

2 - Formats that should be used in DirectPlay or not transcoded (natively supported)

 

  • Containers = "?" (not sure if we have any limitation here"
  • Video codec = "H264, mpeg4"
  • Audio Codec = "mp2, mp3, mp4, aac, ac3, dca (aka DTS), flac"

 

3 - Various Limitations

  • Bitrate limitation for video (when transcoding) : 20 Mbps.
  • Bitrate limitation for audio (when transcoding), if audio + video bitrates are above 21 mbits : 1 Mbps.
  • Framerate limitation would have been nice around 30fps on 1080p content, but this is not technicallly possible as of now without capping this bitrate for all resolutions, that would mean PAL / NTSC medias would have to be capped to 30 fps as well. So skipped for now.
  • BitDepth limitation to 8 bits as higher depths will result in pixelized playback.

Waiting for your suggestions / comments :)

Plex Dev Team

«13456710

Comments

  • mooturnermooturner Posts: 13Members ✭✭

    On Rasplex I tend to be either playing h.264 in a MP4 container, or MPEG2 (I have the licence).

    With MPEG2, I have found that the Rpi can play the regular program and transport stream containers, but it struggles with the Microsoft DVR-MS and WTV containers.  Automatic remuxing of these containers would be awesome.

    From memory, no dramas with AC3 either.

  • dlanordlanor Posts: 2,215Members, Plex Pass Plex Pass
    edited February 2014

    There's one CODEC combination which always fails for me in RasPlex when using 'Direct Play' setting, but works fine when I force transcoding on by selecting a bitrate setting instead of "Direct Play". Apparently that enforces transcoding for everything, which in itself is a bug (it should only enforce transcoding for material with higher bitrate). But for me this bug is fortunate, as I would otherwise be forced to play these media files encoded to some crappy bitrate, just to make transcoding kick in.
     
    Anyway, this 'Direct Play' failure occurs for my collection of 'Farscape (1999)' which uses CODECs as shown below (customized "MediaInfo" list):

    -- File --: Farscape s01e01 Premiere.avi
    Video #0  : 50mn 20s 684ms : 776 Kbps DivX 3 Low : 512x384 (1.333) @ 23.976 fps
    Audio #0  : 50mn 20s 664ms : 96.0 Kbps CBR 'MPEG-1 Audio layer 3' in 2 ch @ 48.0 KHz

    I'm pretty sure that it's the "DivX 3 Low" video CODEC that causes the problem, though I don't understand exactly why.
    All normal DivX and XviD media work just fine, and on my PCs I've never had any problem with this show.
    I suspect that the DivX/XviD CODEC implemented for the RPi is less generic, and doesn't include compatibility to old variants like 'DivX 3 Low'.
     
    Best regards: dlanor

  • LongChairLongChair Plex Dev Team Posts: 669Members, Plex Pass, Plex Ninja Plex Ninja

    Thanks dlanor.

    Here is how I plan to implement transcoding on RPi and my first trials give really nice results :

    Whatever is not identified as being natively played by Rpi will be transcoded by the server.

    This will allow to DirectPlay the codecs natively supported (which is the purpose of the list above).

    So what i really need to identify is the video / audio codecs that are supported natively by RPi.

    In the list on the first post, i'll try to updated what the findings are (Hopefully will get some feedback from users :p ).

    The RasPlex build will be updated with the codec list mentionned above :)

    Ths idea would be to gather the supported format in order to avoid to unecessarrily transcode natively supported medias.

    Plex Dev Team

  • wickning1wickning1 Posts: 119Members, Plex Pass Plex Pass

    I still use raspbmc, planning to try plex when you make the big release.  But just a note, I use 6-channel AAC and the RPi sends it to multi-channel LPCM correctly, so no need for a channel limitation on the aac entry.  If I learn differently on rasplex, I'll reply to this topic again.

  • xortimxortim Posts: 8Members, Plex Pass Plex Pass

    VC1 and MPEG2 should leverage DirectPlay if the licenses are added to the config.txt:

    decode_MPG2=0x00000000
    decode_WVC1=0x00000000

    Verified they're actually enabled with:

    vcgencmd codec_enabled MPG2
    vcgencmd codec_enabled WVC1

    Perhaps always have PMS DirectPlat these, but have some intelligence on the RasPlex side to turn DirectPlay off if the above commands don't indicate support for the formats.

    The other option, would probably to setup two profiles for 4 profiles for the Rasperry Pi in DirectPlay, no licenses, mpg2, wvc1 and both.

  • rsokoloffrsokoloff Posts: 56Members, Plex Pass Plex Pass

    Not certain I fully understand the question so at the risk of making a fool of myself...

    I rip videos using Make MKV (which preserves codecs). The only codec license on my RasPi is Mpeg-2 and I have no playback issues.

    Dedicated audio files (music) are mostly FLAC and play without issues.

    Server: unRAID Server Pro: 6.2.0

    PMS: 1.7.3

    Tuner: HDHomeRun Connect
    PHT: Mac, RasPlex
    Other: iOS, Android, Chromecast

  • LongChairLongChair Plex Dev Team Posts: 669Members, Plex Pass, Plex Ninja Plex Ninja
    There is no stupid question :)

    Actually transcoding only works on video, so the question is mostly for videos :)

    I have identifies i think the most common ones, but maybe i have missed a few. Also the maximum bitrate for transcoding is something i need to settle. As of now, 20 mbits would seem like a reasonnable limit, but if you guys have experience with higher bitrates working then we could reconsider this :)

    Plex Dev Team

  • LongChairLongChair Plex Dev Team Posts: 669Members, Plex Pass, Plex Ninja Plex Ninja

    I have read various reports about results of directplay with DTS / DTS-HD using obviously dca codec.

    From testing over a few samples, it seems that they are playing ok with DirectPlay.

    I would be interested to have you feedback on this one.

    If you are having troubles with it, I would like to have maybe a video sample so that i can figure out what can make it not work in certain cases and see if we can detect this and eventually transcode.

    Plex Dev Team

  • the_belgainthe_belgain Posts: 70Members, Plex Pass Plex Pass

    The list looks good I think.  A couple of things:

    • What output container are you specifying?  I think MKV is probably best - it definitely works and supports all video/audio combinations.
    • I can confirm that video using the "old" DivX codec (codec ID DIVX3) doesn't work and therefore needs transcoding (but more recent MPEG4 implementations, eg. codec ID DIVX or XVID are fine).
    • FLAC multi-channel audio works fine too.  Maybe we should just always directplay audio - are there any audio formats which are unsupported?

    When transcoding video the audio stream is presumably passed through if possible?  So eg. if my input file is mkv/mpeg2/dts then it'll pass through the audio and end up with mkv/h264/dts rather than mkv/h264/aac?

  • moonshinemoonshine Posts: 82Members, Plex Pass Plex Pass

    I'm not sure how you plan to implement the direct play/transcode selection, but maybe you can have a default list and have a "simple" config file in /storage/.config with which the user can customize the behavior ?

    PMSCouchPotato/SickBeard/Transmission  Hackintosh | 3.5GHz i7 | 16GB | 240GB SSD  Drobo 5D 17TB  RasPlex2/iPad clients  Denon AVR 2310  42" Pioneer PDP-427XG  Wharfedale DIA10  Harmony Ultimate Home  1Gb/500Mbps OpticFiber  

     

  • LongChairLongChair Plex Dev Team Posts: 669Members, Plex Pass, Plex Ninja Plex Ninja

    Well I am not sure yet on what the final implementation will be. Though I am not sure that a configuration file is required as choosing wether the RPi should use transcoding or not does not depend really on the user.

    Its more depending on RPi capabilities, so i would think that this has to be static somehow.

    The only thing that could still be configuable is the remote/local playback transcoding bitrate which can depend on the user configuration. There are already configuration fields for this in current PHT and i will keep these settings for whenever RasPlex would think it has to use transcoding.

    Plex Dev Team

  • the_belgainthe_belgain Posts: 70Members, Plex Pass Plex Pass

    I think non-configurable logic for transcoding is right, if it takes into account:

    • Whether the user has MPEG2/VC1 licences installed
    • Whether the user has an AC3/DTS capable receiver
  • scott451scott451 Posts: 107Members, Plex Pass Plex Pass

    hi,

    i play mostly 1080P files with h264 and dd codec. i have experimented with dts (and dts-hd ma) but they only seem to cause me worry. mostly because dts has a tendancy to push the total file bandwidth over 20mbps and then it stutters.

    if possible i would have pms transcode video if over 18mbps and transcode audio if over 1.5mbps. in an ideal world audio would be transcoded to something that supports 5.1, and in my particular case DTS at 640 kbps would be perfect.

    thanks for lisenting !

    - scott

  • LongChairLongChair Plex Dev Team Posts: 669Members, Plex Pass, Plex Ninja Plex Ninja
    the_belgain wrote on March 1 2014, 10:57 AM: »

    The list looks good I think.  A couple of things:

    • What output container are you specifying?  I think MKV is probably best - it definitely works and supports all video/audio combinations.
    • I can confirm that video using the "old" DivX codec (codec ID DIVX3) doesn't work and therefore needs transcoding (but more recent MPEG4 implementations, eg. codec ID DIVX or XVID are fine).
    • FLAC multi-channel audio works fine too.  Maybe we should just always directplay audio - are there any audio formats which are unsupported?

    When transcoding video the audio stream is presumably passed through if possible?  So eg. if my input file is mkv/mpeg2/dts then it'll pass through the audio and end up with mkv/h264/dts rather than mkv/h264/aac?

    Seems that most other clients use mpegts as container.

    Yeah i can also confirm that flac is supported natively, although as ofnow , PMS will not use transcoding for audio, at least on PHT client.

    It seems possible to only transcode the video or audio stream rather than transcode it all. If so that would be the best to avoid useless transcoding on audio streams.

    Plex Dev Team

  • LongChairLongChair Plex Dev Team Posts: 669Members, Plex Pass, Plex Ninja Plex Ninja
    scott451 wrote on March 2 2014, 9:46 PM: »

    hi,

    i play mostly 1080P files with h264 and dd codec. i have experimented with dts (and dts-hd ma) but they only seem to cause me worry. mostly because dts has a tendancy to push the total file bandwidth over 20mbps and then it stutters.

    if possible i would have pms transcode video if over 18mbps and transcode audio if over 1.5mbps. in an ideal world audio would be transcoded to something that supports 5.1, and in my particular case DTS at 640 kbps would be perfect.

    thanks for lisenting !

    - scott

    Well from my investigations, it seems that we can specifiy maximum bitrates for audio transcoding as for video transcoding. The main thing is going to define the threshold.

    Thanks for sharign the values which are working nicely for you that will help defining the proper values i shold use.

    Also one thing i didnt mention, if you can provide me some samples video links on files that would need to be transcoded that would be helpful to build up a test set.

    Feel free to PM me some links to some media samples if you can :)

    Plex Dev Team

  • treboR2RoberttreboR2Robert Posts: 252Members, Plex Pass Plex Pass

    I use a ReadyNas NV+v2 as my server which cannot transcode anything (cpu not powerfull enough)

    All of my files though play natively on rasplex absolutely fine.

    The highest bitrate video I have is 17mb with 1.5mb DTS audio track (plays perfectly)

    I do have a DTS capable receiver though.

    Most of my videos are h264 or x264 with either DTS or DolbyDigital soundtracks but I do have a few old xvid videos that also play perfectly.

    Also I have it all run through a gigabit wired network.

    Thanks

    treboR2Robert    AKA    Mr. Grumpy


    PMS ( FreeNAS 9.10.2-U5 ) ( manual jail )    Rasplex ( Raspberry Pi 3 model B ) ¦ ( Raspberry Pi 2 model B x2¦ ( Raspberry Pi model B x2 )     PS3 & PS4

  • moonshinemoonshine Posts: 82Members, Plex Pass Plex Pass

    Can't we just create a profile configuration for rasplex and place it in the Profiles folder of the PMS ?

    How does rasplex identifies itself? Would the PMS recognize it as the correct client platform and load the appropriate profile ? 

    A profile looks like this and seams to be exactly what this thread is about... 

    <?xml version="1.0" encoding="utf-8"?>
    <Client name="iPhone 5 (GSM)">
      <TranscodeTargets>
        <VideoProfile container="mp4" codec="h264" audioCodec="aac" context="all">
          <!-- Inspired by Handbrake's profiles -->
          <Setting name="VideoEncodeFlags" value="-x264opts bframes=3:cabac=1" />
        </VideoProfile>
        <VideoProfile protocol="hls" container="mpegts" codec="h264" audioCodec="aac,mp3" context="streaming">
          <Setting name="VideoEncodeFlags" value="-x264opts bframes=3:cabac=1" />
        </VideoProfile>
        <MusicProfile container="mp3" codec="mp3" />
        <PhotoProfile container="jpeg" />
      </TranscodeTargets>
      <DirectPlayProfiles>
        <VideoProfile container="mp4" codec="h264" audioCodec="aac" subtitleFormat="ttxt" />
        <MusicProfile container="mp3" codec="mp3" />
        <PhotoProfile container="jpeg" />
      </DirectPlayProfiles>
      <CodecProfiles>
        <VideoCodec name="h264">
          <Limitations>
            <UpperBound name="video.width" value="1920" />
            <UpperBound name="video.height" value="1080" />
            <UpperBound name="video.bitDepth" value="8" isRequired="false" />
          </Limitations>
        </VideoCodec>
        <VideoAudioCodec name="aac">
          <Limitations>
            <UpperBound name="audio.channels" value="2" />
          </Limitations>
        </VideoAudioCodec>
        <VideoAudioCodec name="mp3">
          <Limitations>
            <LowerBound name="audio.samplingRate" value="32000" />
            <UpperBound name="audio.samplingRate" value="48000" />
            <Match name="audio.samplingRate" regex="32000|44100|48000" />
          </Limitations>
        </VideoAudioCodec>
      </CodecProfiles>
    </Client>
    
    

    PMSCouchPotato/SickBeard/Transmission  Hackintosh | 3.5GHz i7 | 16GB | 240GB SSD  Drobo 5D 17TB  RasPlex2/iPad clients  Denon AVR 2310  42" Pioneer PDP-427XG  Wharfedale DIA10  Harmony Ultimate Home  1Gb/500Mbps OpticFiber  

     

  • LongChairLongChair Plex Dev Team Posts: 669Members, Plex Pass, Plex Ninja Plex Ninja
    Yes building such a file is part of the transcoding implementation, but this is not enough as when using PHT as a client it will also require some implementation on the client side.

    Basically the client has to decide wether it will use transcoding or not. As of now in pht, the only thing that will trigger transcoding is the preference settings which will either directplay everything or transcode everything.

    So the right way to do this is to have pht decide if it should directplay or transcode. If it decides to transcode, then we need a profile on PMS to let PMS know what we want him to do.

    There will be a specific profile file for RPi that will be built according to the results of this thread :)

    Plex Dev Team

  • TheCondormanTheCondorman Posts: 33Members, Plex Pass Plex Pass
    edited March 2014

    I have problems playing back DTS-ES The audio drops out every few seconds, this is with a DTS/DTS-ES/DTS-MA receiver 

  • LongChairLongChair Plex Dev Team Posts: 669Members, Plex Pass, Plex Ninja Plex Ninja

    If you could PM me a link with some sample, i could try to test it and see what happens with transcoding :)

    Plex Dev Team

«13456710
Sign In or Register to comment.