Luke 40077 Posted September 9, 2012 Posted September 9, 2012 ApiClient now has a method called GetVideoStreamUrl, which you can use to construct a url for audio playback. The idea is you specify as many output formats as your device can handle, so that we can try and avoid encoding whenever possible, since that's put a load on your server's cpu. When we can avoid encoding, we can just serve the original file directly, which will allow the user to seek during playback. The more params you specify, the greater the chances are that we'll have to encode, so try to omit as many of them as possible.
Luke 40077 Posted September 9, 2012 Author Posted September 9, 2012 Recommended Settings: WP7: Output formats - asf Audio Channels - 2 Audio Sample Rate - Omit Max Width - 800 Max Height - 400 Metro: Output formats - (Ts?), asf, (more? specify as many as you can) Audio Channels - Device dependant Audio Sample Rate - Omit Max Width - Device dependant Max Height - Device dependant Android: Output formats - webm, ts, (more? specify as many as you can) Audio Channels - 2 Audio Sample Rate - Omit Max Width - Device dependant Max Height - Device dependant iOS: Output formats - (Ts?), (more? specify as many as you can) Audio Channels - 2 Audio Sample Rate - Omit Max Width - Device dependant Max Height - Device dependant
Luke 40077 Posted September 9, 2012 Author Posted September 9, 2012 Please note, out of the following supported output formats: /// /// These are the video output formats that the api is cabaple of streaming /// This does not limit the inputs, only the outputs. /// public enum VideoOutputFormats { Avi, Asf, M4v, Mkv, Mov, Mp4, Ogv, ThreeGP, Ts, Webm, Wmv } The server is only capable of encoding on the fly to asf, ogv, ts and webm. That means you MUST always specify at lease one of those four, in addition to any others.
MongooseMan 31 Posted September 9, 2012 Posted September 9, 2012 iOS supports the following: .mov .mp4 .mpv .3gp Encoding must be done using either H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. or MPEG-4 Part 2 video (Simple Profile) (Reference) Is that going to be a problem?
Luke 40077 Posted September 9, 2012 Author Posted September 9, 2012 iOS supports the following:.mov .mp4 .mpv .3gp Encoding must be done using either H.264 Baseline Profile Level 3.0 video, up to 640 x 480 at 30 fps. or MPEG-4 Part 2 video (Simple Profile) (Reference) Is that going to be a problem? I haven't tried encoding to mpv. I'll see if we can do that on the fly. iOS also supports the HLS protocol, so that's what you'll be using anyway once I've added support for it. https://developer.apple.com/resources/http-streaming/
Luke 40077 Posted September 9, 2012 Author Posted September 9, 2012 But in the meantime you should try ts and let me know how that goes.
Redshirt 1487 Posted September 15, 2012 Posted September 15, 2012 I'm just starting on this now. I've noticed that the GetVideoStreamUrl and GetAudioStreamUrl aren't adding the ItemId to the url string. Am I missing something
Luke 40077 Posted September 15, 2012 Author Posted September 15, 2012 Yes, that's a problem! Thanks, I'll fix it.
MongooseMan 31 Posted September 16, 2012 Posted September 16, 2012 If I try to play a file that is formatted as .mp4, and pass it only mp4 as an option, then I get an error. (This is expected as you told us we need to pass at least one of the compatible formats through as an option). However, if I pass it "mp4,webm", then it still converts it to webm, and doesn't just pass it through as mp4. Is this behaviour expected?
Luke 40077 Posted September 16, 2012 Author Posted September 16, 2012 It is currently hardcoded to not let mp4, mkv and m4v. I haven't had a chance to go back and clean that up. Does webm even work on ios? What about ts?
MongooseMan 31 Posted September 16, 2012 Posted September 16, 2012 webm works in the browser, not in app. I haven't managed to get ts to work in either.
Luke 40077 Posted September 16, 2012 Author Posted September 16, 2012 Ok, unfortunately you might have to wait until I implement HLS. But today I'll take another look at the pass-through.
MongooseMan 31 Posted September 16, 2012 Posted September 16, 2012 No worries, I've got enough other stuff to keep me occupied in the meanwhile
Luke 40077 Posted September 16, 2012 Author Posted September 16, 2012 Fyi, with the new build I just posted, nothing has changed with the api. You still need to supply at least one of the supported encoding formats. But now, mkv and mp4 will sometimes be allowed to pass-through. We may have to work a little to improve that decision-making.
Luke 40077 Posted September 16, 2012 Author Posted September 16, 2012 Mark - with my changes today, you may want to try "webm,mp4,m4v" as your output formats. Or possibly even "webm,mp4,m4v,mkv" Basically in this scenario, it will allow mp4,m4v and mkv to pass right through if it thinks your device can play it natively. It determines that based on the params you send - resolution, audio channels, etc. If it needs to be encoded, the output will still be webm.
Redshirt 1487 Posted September 16, 2012 Posted September 16, 2012 Testing it now. Does the order of the supported formats have any bearing on what format is chosen by the server, or is it purely the extension of the media requested.
Luke 40077 Posted September 16, 2012 Author Posted September 16, 2012 There are four formats we can currently encode to - asf, ogv, ts, and webm The order only matters when encoding is required. When this is the case, the first of those four that appear in your outputformats list will be used. Long story short - list everything you can handle and put them in order of output preference.
MongooseMan 31 Posted September 17, 2012 Posted September 17, 2012 I'm trying to stream with the following URL: http://mongoose-pc.local:8096/mediabrow ... formats=ts, but getting an error: Log: 9:45:44.735 PM 17/9/2012 , Info , Responding with status code 200 for url http://mongoose-pc.local:8096/mediabrowser/api/video?id=54c0d25e4c8292a62d877e718ca3fea4&outputformats=ts , 10 9:45:44.735 PM 17/9/2012 , Error , ( Exception. Type=System.NullReferenceException Msg=Object reference not set to an instance of an object. StackTrace= [n] at MediaBrowser.Api.HttpHandlers.VideoHandler.RequiresVideoConversion() [n] at MediaBrowser.Api.HttpHandlers.VideoHandler.GetVideoCodec(VideoOutputFormats outputFormat) [n] at MediaBrowser.Api.HttpHandlers.VideoHandler.GetVideoArguments(VideoOutputFormats outputFormat) [n] at MediaBrowser.Api.HttpHandlers.VideoHandler.GetCommandLineArguments() [n] at MediaBrowser.Api.HttpHandlers.BaseMediaHandler`2.d__c.MoveNext() [n] --- End of stack trace from previous location where exception was thrown --- [n] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) [n] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [n] at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() [n] at MediaBrowser.Common.Net.Handlers.BaseHandler.d__c.MoveNext() in d:\Others\Development\MediaBrowserServer\MediaBrowser.Common\Net\Handlers\BaseHandler.cs:line 295 [n] --- End of stack trace from previous location where exception was thrown --- [n] at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) [n] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [n] at System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult() [n] at MediaBrowser.Common.Net.Handlers.BaseHandler.d__3.MoveNext() in d:\Others\Development\MediaBrowserServer\MediaBrowser.Common\Net\Handlers\BaseHandler.cs:line 221 ) , 10
Luke 40077 Posted September 17, 2012 Author Posted September 17, 2012 You'll have to wait on this for now. I'll update once it's fixed. I disabled ffprobe until eric checks in his database and provider changes. Once that's back in, this error won't occur anymore.
MongooseMan 31 Posted November 8, 2012 Posted November 8, 2012 Out of interest, has this been fixed? Just investigating whether I could potentially just download a single .ts file (for the play-it-later functionality) instead of reimplementing HLS from the app.
Luke 40077 Posted November 8, 2012 Author Posted November 8, 2012 This particular issue has been, yes.
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