Title says it all, I have a video (VideoClipObject) with multiple audio tracks, and I can't find in documentation how to change it.
AFAIK, the plugin framework has no control over which audio-stream is used by the client. The best you can do is label the audio streams in the MediaObject as to which language they use. The clients are then expected to automatically select the “best” one based on the user’s language preferences. I’ve never messed with plugin content which has more than one audio stream but, I believe that it should work to add multiple audio streams as long as they are differentiated by language. Other factors, such as number of audio channels or commentary, will likely not work. Here’s how the code for adding audio streams looks in the (currently non-workin) Amazon plugin.
https://github.com/plexinc-plugins/AmazonInstantVideo.bundle/blob/e6a382137f5fbc186592ec29756c204a8f7cae44/Contents/Services/URL/AmazonInstantVideo/ServiceCode.pys#L66
The best you can do is label the audio streams in the MediaObject as to which language they use.
And to do this I guess I need to use services? I still do not understand how do they work and what for are they needed :(
No documentation on AudioStreamObject is available, there is info about Locale but not much of a help, and my videos do not have location codes assigned to them or at least I think so, in VLC when I try to change audio track I get two options:
- Track 1 - [Russian]
- Track 2 - [English]
And Plex by default plays the first one, that is not suitable for me...
I tried adding line streams=[AudioStreamObject(language_code=Locale.Language.English)] into my code like this:
oc.add(VideoClipObject( url = item['url'], title = item['title'], thumb = GetThumb(item['thumb']), items = [ MediaObject( parts = [ PartObject( key = GetVideoURL(url = item['url']), #custom function, determines the protocol an sets required flags streams = [ AudioStreamObject(language_code = Locale.Language.English) ] ) ], optimized_for_streaming = True ) ] ))
Tho I have no idea what it should do, but I was hoping it would set audio track to English, but it didn't, it just made video streams unplayable on LG SmartTV :( I get no errors on desktop client, but it plays in Russian by default, I can change it by pressing keyboard shortcut A.
If there are two streams, I would try adding them both in the order they are included in the video file. You’re right, the AudioStreamObject stuff is, as yet, undocumented and that’s a pain. If I understand it correctly though, adding all the included streams in the list of streams [], should allow capable clients to select the appropriate stream or at least cycle through them.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.