Jump to content

Streaming Video


Recommended Posts

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.

Link to post
Share on other sites

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

Link to post
Share on other sites

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.

Link to post
Share on other sites
MongooseMan

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?

Link to post
Share on other sites
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/

Link to post
Share on other sites

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 :)

Link to post
Share on other sites
MongooseMan

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?

Link to post
Share on other sites

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?

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites

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.

Link to post
Share on other sites
MongooseMan

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

Link to post
Share on other sites

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.

Link to post
Share on other sites
  • 1 month later...
MongooseMan

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.

Link to post
Share on other sites

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...