Jump to content

Roku 3 Not Outputting DD and DTS from Emby Channel


PeteS457

Recommended Posts

the transcoding profiles should allow you to specify multiple audio codecs, comma-delimeted. try that. the first one is the one that will be used if the audio has to be re-encoded.

This isn't exactly feasible. What if I want 5.1 in DCA or AC3 to use AC3, but I want 2.0 to use AAC. Using multiple audio codecs doesn't allow this behavior.

if surroundSound then
    t = m.Codecs
    if t <> invalid then
        ' dts and ac3 are 5.1, ac3 can pass-through
        ' pass dts as ac3, pass truehd as ac3
        s = CreateObject("roRegex","dts","i")
        r = CreateObject("roRegex","ac3","i")
        q = CreateObject("roRegex","truehd","i")
        if q.isMatch(t) or r.isMatch(t) or s.isMatch(t) then
            transAudio = "ac3"
        else
            transAudio = "aac"
        end if
    else
        transAudio = "aac"
    end if
else
    transaudio = "aac"
end if
profiles.push({
    Type: "Video"
    Container: "ts"
    AudioCodec: transAudio
    VideoCodec: "h264"
    Context: "Streaming"
    Protocol: "Hls"
})

m.Codecs is my shortcut cheat of course to i.MediaName so It can be passed among functions. This logic is how the transcoding should be. You can't accomplish this any other way.

 

Also... It is wrong to transcode DIVX/XVID in all MPEG4 streams. You only need to transcode in presence of the MKV container.

t = m.Extension
if t <> invalid then
    ' mkv container with mpeg4 cannot be xvid/divx
    r = CreateObject("roRegex","mkv","i")
    if r.isMatch(t) then
        mpeg4Conditions.push({
            Condition: "NotEquals"
            Property: "CodecTag"
            Value: "DIVX"
            IsRequired: false
        })
        mpeg4Conditions.push({
            Condition: "NotEquals"
            Property: "CodecTag"
            Value: "XVID"
            IsRequired: false
        })
    end if
end if

The m.Extension is the global shortcut for i.Container which is needed for this. Only in the presence of MKV container should MPEG4 XVID/DIVX streams be transcoded, otherwise they should be remuxed. The fix for DX50 is transcode in any container.

 

The official client needs to use these methods otherwise it will introduce needless transcoding. Also, thanks for adding the codecTag attribute which allows this new detection.

Edited by speechles
Link to comment
Share on other sites

  • 1 month later...
ssmith129

@@BobbyDing

 

Good Question... Why can't emby transcode to the best available codec? Why doesn't it understand ordering preference when transcoding? Because the transcoding part doesn't work this way...

Function getTranscodingProfiles()    profiles = []        profiles.push({        Type: "Audio"        Container: "mp3"        AudioCodec: "mp3"        Context: "Streaming"        Protocol: "Http"    })    profiles.push({        Type: "Video"        Container: "ts"        AudioCodec: "aac"        VideoCodec: "h264"        Context: "Streaming"        Protocol: "Hls"    })    return profilesEnd Function
The original code for transcoding offers one codec for audio only. shucks...

 

But what if we change the code to like it is below...

Function getTranscodingProfiles()    surroundSound = SupportsSurroundSound(false, false)    audioOutput51 = getGlobalVar("audioOutput51")    surroundSoundDCA = surroundSound AND audioOutput51 'AND (RegRead("fivepointoneDCA", "preferences", "1") = "1")    surroundSound = surroundSound AND audioOutput51 'AND (RegRead("fivepointone", "preferences", "1") = "1")    profiles = []        profiles.push({        Type: "Audio"        Container: "mp3"        AudioCodec: "mp3"        Context: "Streaming"        Protocol: "Http"    })    if surroundSound then        t = m.Codecs        if t <> invalid then            r = CreateObject("roRegex","ac3","i")            if r.isMatch(t) then                    transAudio = "ac3"            else            transAudio = "aac"            end if        else        transAudio = "aac"        end if    else        transaudio = "aac"        end if        profiles.push({        Type: "Video"        Container: "ts"        AudioCodec: transAudio        VideoCodec: "h264"        Context: "Streaming"        Protocol: "Hls"    })    return profilesEnd Function
This uses a small cheat, in the way of global space to remember the codecs and then a regular expression can tell if ac3 is there. If so use that, if not, then use the normal aac. The above code isn't the entire changes. There is the part which sets m.Codecs as well. But the benefit here is that this seems to allow transcoding to retain 5.1 surround quite nicely.

 

edd84fbd220c5d23c33c649c8735c062.jpg

 

The new emby blue neon night theme at ( https://my.roku.com/account/add?channel=EmbyBlueNeon ) has this ability. It will transcode and keep surround when possible. I will submit pulls to github so the official client can adopt this too if wanted.

 

 

Thanks for this post.  I've been using Emby Blue Neon since I saw it and I'm very pleased with its ability to play AC-3 audio from .AVI files.  Nice job!

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...