ALAC DirectPlay

After some years of “resistance” I’m trying to evaluate Plex for music, now that Plex has been enhanced and playlist support was made available) but I have a problem. Plex plays (DirectPlay) mp3’s but tries to transcode alac’s and my server cannot transcode. But alac’s are supported natively by the ATV (I’ve been using Synology Audio Station without problem).

Probably this could be solved by changing the Plex profile (I don’t know how, if someone could send me a working profile it would be superb), but I’m wondering why I can state in PlexConnect to force DirectPlay and this only applies to videos, and not to music files. Can this be changed ?

PlexConnect should handle it directly - see PlexAPI.py, line 1069:

            audioATVNative = \
                Media.get('audioCodec','-') in ("mp3", "aac", "ac3", "drms", "alac", "aiff", "wav")

Could you please verify, what codec is shown in the relevant PMS-XML?

Hi baa, here is the xml for one of the “problematic” files

Well, gives “alac” in audioCodec…

but - argh - bitrate is too high: bitrate="895"

Unfortunately there is no setting for that… for a quick test: Modify XMLConverter.py line 1067 to show a (for your case) more reasonable number. Like “1000” or something.

It works with 1000, thanks. Will you change git or should I keep this as local modif ?

Hm, if done right, we have to add a couple of settings - like an AudioBitrate option. Let me think about it. :smiley:

According to the ATV specs (HE-AAC (V1), AAC (16 to 320 Kbps), protected AAC (from iTunes Store), MP3 (16 to 320 Kbps), MP3 VBR, Audible (formats 2, 3, and 4), Apple Lossless, AIFF, and WAV; Dolby Digital 5.1 and Dolby Digital Plus 7.1), AAC and MP3 have a 320Kbps limit, but alac, aiff and wav have no bitrate limit at all, therefore I think that the existing limit in XMLConverter.py (384Kbps) seems to make no sense. I would go for a change in XMLConverter.py and not a new parameter in settings.

I would go for something like this

        # transcoder action setting?
        # transcoder bitrate setting [kbps] -  eg. 128, 256, 384, 512?
        maxAudioBitrate = '320'
        
        audioATVNative1 = \
            Media.get('audioCodec','-') in ("mp3", "aac", "ac3", "drms")
        # check Media.get('container') as well - mp3, m4a, ...?
        
        dprint(__name__, 2, "audio: ATVNative1 - {0}", audioATVNative1)
        
        audioATVNative2 = \
            Media.get('audioCodec','-') in ("alac", "aiff", "wav")
        # check Media.get('container') as well - mp3, m4a, ...?
        
        dprint(__name__, 2, "audio: ATVNative2 - {0}", audioATVNative2)
        
        if audioATVNative2 or audioATVNative1 and\
           int(Media.get('bitrate','0')) <= int(maxAudioBitrate):
            # direct play
            res, leftover, dfltd = self.getKey(Media, srcXML, 'Part/key')
            res = PlexAPI.getDirectAudioPath(res, AuthToken)
        else:
            # request transcoding
            res, leftover, dfltd = self.getKey(Track, srcXML, 'key')
            res = PlexAPI.getTranscodeAudioPath(res, AuthToken, self.options, maxAudioBitrate)

Hi Baa, now that you are modifying XMLConverter.py for other purposes, can you please increase maxAudioBitrateUncompressed to 1500 ?

1500? 2000?
Every number seems somewhat “random”, doesn’t it?

:))

You are right. But I don’t know the implications to other users. 2000 would be perfect.