TeamB 2353 Posted June 15, 2020 Share Posted June 15, 2020 @Luke @ebr How is Internet streaming bitrate limit (Mbps): enforced for clients? In EmbyCon I build the Direct HTTP Streaming URL and the Trans-code URL manually, does the above setting get overridden when you do this? Link to comment Share on other sites More sharing options...
ebr 14925 Posted June 16, 2020 Share Posted June 16, 2020 When you call for PlaybackInfo, that options object has a max bitrate on it. That value is compared against the server setting (if remote) and, if higher, it is lowered to the server setting. So, depending on exactly how you are building your own urls, yes, you may be overriding this. Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 16, 2020 Author Share Posted June 16, 2020 So it is up to the client to enforce this not the server? What about static streaming where you use static=true? that would bypass it all together as that is just passing the media file over http. Link to comment Share on other sites More sharing options...
ebr 14925 Posted June 16, 2020 Share Posted June 16, 2020 Just now, TeamB said: So it is up to the client to enforce this not the server? No. The server enforces it by delivering you a proper response from the PlaybackInfo call... Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 16, 2020 Author Share Posted June 16, 2020 So if the client request a higher bitrate then the server will limit it correctly? Link to comment Share on other sites More sharing options...
ebr 14925 Posted June 16, 2020 Share Posted June 16, 2020 4 minutes ago, TeamB said: So if the client request a higher bitrate then the server will limit it correctly? Yes, in its response to that call - but you said you are building your own urls so it is possible you are circumventing that. Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 16, 2020 Author Share Posted June 16, 2020 (edited) 9 hours ago, ebr said: Yes, in its response to that call - Which call, the playbackinfo call or the streaming url call? If it is the playbackinfo call then that is just a suggestion the client can ignore. The server is not enforcing the limit. If it is the streaming request that gets adjusted by the server then the server is enforcing the limit. But then what happens to static=true streaming requests? What I am trying to work out here is what does EmbyCon have to do this this to work and be enforced correctly, if the server does the enforcing and work then EmbyCon as a client does nothing. But if EmbyCon needs to add a bunch of logic to the request then I need to do that because currently I am not. Edited June 16, 2020 by TeamB Link to comment Share on other sites More sharing options...
Luke 37099 Posted June 17, 2020 Share Posted June 17, 2020 It all happens in the playbackinfo requests. If you make an actual video request there won't be any enforcement at that stage. Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 17, 2020 Author Share Posted June 17, 2020 So with EmbyCon since I am constructing the streaming URL's manually I will need to look at the PlayBackInfo response and make sure I take into account the max bit rate that is returned and use that in my streaming URL. This also means the server is not enforcing this in a returned stream, it is up to the client to make sure they either use the returned stream URL from the PlayBackInfo or construct a URL that is complaint with the max bit rate, any client that does not do that can just bypass the max bitrate server side setting correct? Link to comment Share on other sites More sharing options...
ebr 14925 Posted June 17, 2020 Share Posted June 17, 2020 It is expected that the client will use the playback info call to get the proper urls. I don't think you can infer the max bitrate from the return from that call either. I think it just impacts how the urls are constructed before they are sent back. Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 17, 2020 Author Share Posted June 17, 2020 Oh ok, I will have to perhaps query the server config to get this and also the user config as there are user settings for this also... Hmm, or just switch to use the response streaming urls from the playbackinfo call. This would change how EmbyCon works currently. I need to have a think about this to see if I am able to support this server set max bit rate or not. Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 18, 2020 Author Share Posted June 18, 2020 (edited) @Luke Every time I look at the PlaybackInfo request and response I get confused, I know I have asked this a bunch of times but do you have any documentation on this yet? For examples I looked in the request/responce for the Web Client and see there are more than one TranscodingProfiles, they is there more than one, I would think I client would supply just one so the server can produce transcoding for the target. I want to switch to using it for EmbyCon and stop manually creating the streaming URLs but I dont know what I can override or how I can limit things. I want to try to map as many of the current options I have in the transcoding settings in EmbyCon to a streaming profile but dont know if they exist in the TranscodingProfiles, for example I want to set MaxWidth but dont see any examples of that in the Web Client. What are the triggers for going from Static direct streaming to transcoding streaming? Is it just bit rate or are there other factors as well. For example if I set up my DirectPlayProfiles to accept ALL video then what will trigger a transcode? Edited June 18, 2020 by TeamB Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 21, 2020 Author Share Posted June 21, 2020 @Luke Whats the difference between "stream.m3u8" and "master.m3u8" with trans coding URLs? My original manual trans-code urls are using master.m3u8 and are working but the PlaybackInfo TranscodingUrl returns stream.m3u8 and for some reason that wont work with Kodi. I remember a page on this somewhere but cant find it now. Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 21, 2020 Author Share Posted June 21, 2020 @Luke I think I fixed this by adding "Container": "ts", "Protocol": "hls", To the TranscodingProfiles Does that sound like it is the correct way? Is the PlaybackInfo secret or something, I am not really getting much feedback on this so not sure if I should even be using it? Link to comment Share on other sites More sharing options...
speechles 1920 Posted June 22, 2020 Share Posted June 22, 2020 "Context": "Streaming" You already have this? The rest is correct you are doing. Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 22, 2020 Author Share Posted June 22, 2020 is the "Context": "Streaming" for source media streaming like from a IPTV or Live TV or should it be used for streaming from static files like transcoding MKV etc? Link to comment Share on other sites More sharing options...
speechles 1920 Posted June 22, 2020 Share Posted June 22, 2020 For everything using HLS. Link to comment Share on other sites More sharing options...
speechles 1920 Posted June 22, 2020 Share Posted June 22, 2020 (edited) It should be used for both. It isn't required as I believe without it "streaming" is the assumed context with HLS but it is better to have all fields/parameters present and exposed and accounted for IMO. I feel your pain that some things are not documented and half the battle is finding what you need in objects via hunting through it by hand to see if what you want is even possible (at the time..lol). I think we all do this the same way and share info and that is the documentation. The "I've been there" sharing with the "Haven't been there yet". Sharing is caring. Edited June 22, 2020 by speechles Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 22, 2020 Author Share Posted June 22, 2020 Yeah most of the time I can work out the API using various investigative approaches like swagger or looking at what the Web Client does. Its just this PlaybackInfo request and how each block is interpreted by the server that has me confused and it is not easy to check or verify you have your approach correct without a heap of testing and trial and error. Anyway I think I am close now, making the switch to using the Transcode and Direct Stream URLs from the PlaybackInfo request has been on my todo list for over a year now. Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 22, 2020 Author Share Posted June 22, 2020 @Luke Can I set the AudioBitrate in a Transcoding block like this? { "Container": "ts", "Protocol": "hls", "Type": "Video", "AudioCodec": audio_codec, "AudioBitrate": audio_bitrate, "VideoCodec": "h264", "MaxAudioChannels": audio_max_channels }, I can not get my transocing url to use any of the audio bitrate settings Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 22, 2020 Author Share Posted June 22, 2020 this is why I have no idea what the hell is going on here, looking at a request by the Web client it issues a PlaybackInfo request : { "DeviceProfile": { "MaxStaticBitrate": 140000000, "MaxStreamingBitrate": 140000000, "MusicStreamingTranscodingBitrate": 192000, "DirectPlayProfiles": [{ "Container": "mp4,m4v", "Type": "Video", "VideoCodec": "h264,vp8,vp9", "AudioCodec": "aac,opus,flac,vorbis" }, { "Container": "flv", "Type": "Video", "VideoCodec": "h264", "AudioCodec": "aac,mp3" }, { "Container": "mov", "Type": "Video", "VideoCodec": "h264", "AudioCodec": "aac,opus,flac,vorbis" }, { "Container": "opus", "Type": "Audio" }, { "Container": "mp3", "Type": "Audio", "AudioCodec": "mp3" }, { "Container": "mp2,mp3", "Type": "Audio", "AudioCodec": "mp2" }, { "Container": "m4a", "AudioCodec": "aac", "Type": "Audio" }, { "Container": "flac", "Type": "Audio" }, { "Container": "webma,webm", "Type": "Audio" }, { "Container": "wav", "Type": "Audio", "AudioCodec": "PCM_S16LE" }, { "Container": "ogg", "Type": "Audio" }, { "Container": "webm", "Type": "Video", "AudioCodec": "vorbis,opus", "VideoCodec": "VP8" }, { "Container": "webm", "Type": "Video", "AudioCodec": "vorbis,opus", "VideoCodec": "VP9" }], "TranscodingProfiles": [{ "Container": "aac", "Type": "Audio", "AudioCodec": "aac", "Context": "Streaming", "Protocol": "hls", "MaxAudioChannels": "2", "MinSegments": "1", "BreakOnNonKeyFrames": true }, { "Container": "aac", "Type": "Audio", "AudioCodec": "aac", "Context": "Streaming", "Protocol": "http", "MaxAudioChannels": "2" }, { "Container": "mp3", "Type": "Audio", "AudioCodec": "mp3", "Context": "Streaming", "Protocol": "http", "MaxAudioChannels": "2" }, { "Container": "opus", "Type": "Audio", "AudioCodec": "opus", "Context": "Streaming", "Protocol": "http", "MaxAudioChannels": "2" }, { "Container": "wav", "Type": "Audio", "AudioCodec": "wav", "Context": "Streaming", "Protocol": "http", "MaxAudioChannels": "2" }, { "Container": "opus", "Type": "Audio", "AudioCodec": "opus", "Context": "Static", "Protocol": "http", "MaxAudioChannels": "2" }, { "Container": "mp3", "Type": "Audio", "AudioCodec": "mp3", "Context": "Static", "Protocol": "http", "MaxAudioChannels": "2" }, { "Container": "aac", "Type": "Audio", "AudioCodec": "aac", "Context": "Static", "Protocol": "http", "MaxAudioChannels": "2" }, { "Container": "wav", "Type": "Audio", "AudioCodec": "wav", "Context": "Static", "Protocol": "http", "MaxAudioChannels": "2" }, { "Container": "ts", "Type": "Video", "AudioCodec": "aac", "VideoCodec": "h264", "Context": "Streaming", "Protocol": "hls", "MaxAudioChannels": "2", "MinSegments": "1", "BreakOnNonKeyFrames": true, "ManifestSubtitles": "vtt" }, { "Container": "webm", "Type": "Video", "AudioCodec": "vorbis", "VideoCodec": "vpx", "Context": "Streaming", "Protocol": "http", "MaxAudioChannels": "2" }, { "Container": "mp4", "Type": "Video", "AudioCodec": "aac,opus,flac,vorbis", "VideoCodec": "h264", "Context": "Static", "Protocol": "http" }], "ContainerProfiles": [], "CodecProfiles": [{ "Type": "VideoAudio", "Codec": "aac", "Conditions": [{ "Condition": "Equals", "Property": "IsSecondaryAudio", "Value": "false", "IsRequired": "false" }] }, { "Type": "VideoAudio", "Conditions": [{ "Condition": "Equals", "Property": "IsSecondaryAudio", "Value": "false", "IsRequired": "false" }] }, { "Type": "Video", "Codec": "h264", "Conditions": [{ "Condition": "EqualsAny", "Property": "VideoProfile", "Value": "high|main|baseline|constrained baseline", "IsRequired": false }, { "Condition": "LessThanEqual", "Property": "VideoLevel", "Value": "52", "IsRequired": false }] }], "SubtitleProfiles": [{ "Format": "vtt", "Method": "Hls" }, { "Format": "vtt", "Method": "External" }, { "Format": "ass", "Method": "External" }, { "Format": "ssa", "Method": "External" }], "ResponseProfiles": [{ "Type": "Video", "Container": "m4v", "MimeType": "video/mp4" }] } } I can see no mention of max audio bitrate but in the return the Transcode url has a max audio bitrate set { "MediaSources": [{ "Protocol": "File", "Id": "ad872155be8cf95e30aa97d7bf6e685b", "Path": "C:\\Data\\media\\MoviesMedia\\Crouching Tiger Hidden Dragon (2000)\\Crouching Tiger Hidden Dragon (2000).mkv", "Type": "Default", "Container": "mkv", "Size": 4364819379, "Name": "Crouching Tiger, Hidden Dragon", "IsRemote": false, "RunTimeTicks": 69090000000, "SupportsTranscoding": true, "SupportsDirectStream": false, "SupportsDirectPlay": false, "IsInfiniteStream": false, "RequiresOpening": false, "RequiresClosing": false, "RequiresLooping": false, "SupportsProbing": false, "MediaStreams": [{ "Codec": "mpeg2video", "Language": "eng", "TimeBase": "1/1000", "CodecTimeBase": "1/25", "VideoRange": "SDR", "DisplayTitle": "576i MPEG2VIDEO", "DisplayLanguage": "English", "IsInterlaced": true, "BitRate": 5054067, "BitDepth": 8, "RefFrames": 1, "IsDefault": false, "IsForced": false, "Height": 576, "Width": 720, "AverageFrameRate": 25, "RealFrameRate": 25, "Profile": "Main", "Type": "Video", "AspectRatio": "16:9", "Index": 0, "IsExternal": false, "IsTextSubtitleStream": false, "SupportsExternalStream": false, "Protocol": "File", "PixelFormat": "yuv420p", "Level": 8, "IsAnamorphic": true }, { "Codec": "ac3", "Language": "chi", "TimeBase": "1/1000", "CodecTimeBase": "1/48000", "Title": "Surround 5.1", "DisplayTitle": "Chinese AC3 5.1 (Default)", "DisplayLanguage": "Chinese", "IsInterlaced": false, "ChannelLayout": "5.1", "BitRate": 448000, "Channels": 6, "SampleRate": 48000, "IsDefault": true, "IsForced": false, "Type": "Audio", "Index": 1, "IsExternal": false, "IsTextSubtitleStream": false, "SupportsExternalStream": false, "Protocol": "File" }, { "Codec": "ac3", "Language": "eng", "TimeBase": "1/1000", "CodecTimeBase": "1/48000", "Title": "Surround 5.1", "DisplayTitle": "English AC3 5.1", "DisplayLanguage": "English", "IsInterlaced": false, "ChannelLayout": "5.1", "BitRate": 448000, "Channels": 6, "SampleRate": 48000, "IsDefault": false, "IsForced": false, "Type": "Audio", "Index": 2, "IsExternal": false, "IsTextSubtitleStream": false, "SupportsExternalStream": false, "Protocol": "File" }, { "Codec": "DVDSUB", "Language": "eng", "TimeBase": "1/1000", "CodecTimeBase": "0/1", "DisplayTitle": "English (Default DVDSUB)", "DisplayLanguage": "English", "IsInterlaced": false, "IsDefault": true, "IsForced": false, "Height": 576, "Width": 720, "Type": "Subtitle", "Index": 3, "Score": 11211, "IsExternal": false, "DeliveryMethod": "Encode", "IsTextSubtitleStream": false, "SupportsExternalStream": false, "Protocol": "File" }, { "Codec": "srt", "Language": "eng", "DisplayTitle": "English (SRT)", "DisplayLanguage": "English", "IsInterlaced": false, "IsDefault": false, "IsForced": false, "Type": "Subtitle", "Index": 4, "IsExternal": true, "DeliveryMethod": "Hls", "IsTextSubtitleStream": true, "SupportsExternalStream": true, "Path": "C:\\Data\\media\\MoviesMedia\\Crouching Tiger Hidden Dragon (2000)\\Crouching Tiger Hidden Dragon (2000).eng.srt", "Protocol": "File" }], "Formats": [], "Bitrate": 5054067, "RequiredHttpHeaders": {}, "DirectStreamUrl": "/videos/79/master.m3u8?DeviceId=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NDsgcnY6NjAuMCkgR2Vja28vMjAxMDAxMDEgRmlyZWZveC82MC4wfDE1MjcyOTM5NzY5NzE1&MediaSourceId=ad872155be8cf95e30aa97d7bf6e685b&PlaySessionId=2e20ad2f3ebb42ff800a4487c575e4b8&api_key=4021a647bf2f4920aae5cabf3e02dc30&VideoCodec=h264&AudioCodec=aac&VideoBitrate=192000&AudioBitrate=128000&AudioStreamIndex=1&SubtitleStreamIndex=3&SubtitleMethod=Encode&TranscodingMaxAudioChannels=2&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=True&ManifestSubtitles=vtt&h264-profile=high,main,baseline,constrainedbaseline&h264-level=52&TranscodeReasons=SubtitleCodecNotSupported", "TranscodingUrl": "/videos/79/master.m3u8?DeviceId=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NDsgcnY6NjAuMCkgR2Vja28vMjAxMDAxMDEgRmlyZWZveC82MC4wfDE1MjcyOTM5NzY5NzE1&MediaSourceId=ad872155be8cf95e30aa97d7bf6e685b&PlaySessionId=2e20ad2f3ebb42ff800a4487c575e4b8&api_key=4021a647bf2f4920aae5cabf3e02dc30&VideoCodec=h264&AudioCodec=aac&VideoBitrate=192000&AudioBitrate=128000&AudioStreamIndex=1&SubtitleStreamIndex=3&SubtitleMethod=Encode&TranscodingMaxAudioChannels=2&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=True&ManifestSubtitles=vtt&h264-profile=high,main,baseline,constrainedbaseline&h264-level=52&TranscodeReasons=SubtitleCodecNotSupported", "TranscodingSubProtocol": "hls", "TranscodingContainer": "ts", "ReadAtNativeFramerate": false, "DefaultAudioStreamIndex": 1, "DefaultSubtitleStreamIndex": 3 }], "PlaySessionId": "2e20ad2f3ebb42ff800a4487c575e4b8" } TranscodingUrl from above /videos/79/master.m3u8 ?DeviceId=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NDsgcnY6NjAuMCkgR2Vja28vMjAxMDAxMDEgRmlyZWZveC82MC4wfDE1MjcyOTM5NzY5NzE1 &MediaSourceId=ad872155be8cf95e30aa97d7bf6e685b &PlaySessionId=2e20ad2f3ebb42ff800a4487c575e4b8 &api_key=4021a647bf2f4920aae5cabf3e02dc30 &VideoCodec=h264 &AudioCodec=aac &VideoBitrate=192000 &AudioBitrate=128000 &AudioStreamIndex=1 &SubtitleStreamIndex=3 &SubtitleMethod=Encode &TranscodingMaxAudioChannels=2 &SegmentContainer=ts &MinSegments=1 &BreakOnNonKeyFrames=True &ManifestSubtitles=vtt &h264-profile=high,main,baseline,constrainedbaseline &h264-level=52 &TranscodeReasons=SubtitleCodecNotSupported So how do I drive this thing. Link to comment Share on other sites More sharing options...
TeamB 2353 Posted June 24, 2020 Author Share Posted June 24, 2020 (edited) it looks like there is some sort of internal server limiting that occurs with bitrates, if you set the Stream Bitrate low enough then the audio streams start to have their Bitrates lowered too. It does not look like you can specify the audio bitrate but have to rely on the server limiting it based on your total stream bitrate. This looks like it is true for the video resolution as well, if you start lowering the stream bitrate eventually the video resolution gets reduced as well. So it looks like the server has a bunch of logic to chose the audio bitrate and the video resolution based on your stream bitrate. This means I should probably remove some of the custom manual settings for audio and leave it for the server to determine, it looks like the best proctice would be to specify what codes you want and the stream bitrate you want and let the server work out the video resolution and audio bitrate that it thinks it should use. Does that sound correct? Edited June 24, 2020 by TeamB Link to comment Share on other sites More sharing options...
Luke 37099 Posted June 25, 2020 Share Posted June 25, 2020 On 6/17/2020 at 8:54 PM, TeamB said: @Luke Every time I look at the PlaybackInfo request and response I get confused, I know I have asked this a bunch of times but do you have any documentation on this yet? For examples I looked in the request/responce for the Web Client and see there are more than one TranscodingProfiles, they is there more than one, I would think I client would supply just one so the server can produce transcoding for the target. I want to switch to using it for EmbyCon and stop manually creating the streaming URLs but I dont know what I can override or how I can limit things. I want to try to map as many of the current options I have in the transcoding settings in EmbyCon to a streaming profile but dont know if they exist in the TranscodingProfiles, for example I want to set MaxWidth but dont see any examples of that in the Web Client. What are the triggers for going from Static direct streaming to transcoding streaming? Is it just bit rate or are there other factors as well. For example if I set up my DirectPlayProfiles to accept ALL video then what will trigger a transcode? Apologies for the delay. I can help you with this. Yes you're right about multiple transcoding profiles. Only one should be needed for video, and then one for audio. The web app sends multiple only because it's putting together a list of supported transcoding profiles for the current browser and then the first one gets used. Link to comment Share on other sites More sharing options...
Luke 37099 Posted June 25, 2020 Share Posted June 25, 2020 On 6/21/2020 at 6:53 AM, TeamB said: @Luke Whats the difference between "stream.m3u8" and "master.m3u8" with trans coding URLs? My original manual trans-code urls are using master.m3u8 and are working but the PlaybackInfo TranscodingUrl returns stream.m3u8 and for some reason that wont work with Kodi. I remember a page on this somewhere but cant find it now. There shouldn't be a stream.m3u8, are you sure that was it? master.m3u8 is the hls master manifest. Inside it contains variant playlists, for example, main.m3u8, which points to a playable video stream. So if you're putting together urls manually, master.m3u8 is what to use. Link to comment Share on other sites More sharing options...
Luke 37099 Posted June 25, 2020 Share Posted June 25, 2020 On 6/22/2020 at 1:22 AM, TeamB said: @Luke Can I set the AudioBitrate in a Transcoding block like this? { "Container": "ts", "Protocol": "hls", "Type": "Video", "AudioCodec": audio_codec, "AudioBitrate": audio_bitrate, "VideoCodec": "h264", "MaxAudioChannels": audio_max_channels }, I can not get my transocing url to use any of the audio bitrate settings AudioBitrate on TranscodingProfile is actually obsolete, so that's no longer used. We'll have to update the code that puts it there. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now