Jump to content

iis video streaming slow?

Go to solution Solved by mariushm,

use ffmpeg if mp4box doesn't work.

 

Let me explain again

Your movie has variable bitrate... one minute could be 1 MB , the next minute could be 2 MB in the file. It's hard for a video player to know where to start downloading the file when you choose to play from some time.

To help players, the mp4 file has a small list with timings, like for example time 20 seconds and 100 milliseconds starts at 3 MB and 50 KB in the file, time 1m 30s starts at 10 MB and so on. 

To generate this list, keyframes are usually used.

Keyframes are special frames in the video ... if your video is 30fps , that means there's 30 frames per second. A video codec can look at several frames and send only one full frame and the next few frames only contain information that tell the decoder how to generate an image from the previous frames. So if there's some transmission error and one of those frames are corrupted you'd get blocks of green on the screen or player jumps frames until the next keyframe is found in the file, which contains all the needed information to create a full picture.

So that ffmpeg command  takes that list with entries and puts it at the start of the file, so that it's downloaded right at the start and then video player knows exactly where to jump in the file.

mp4 box gui should do this automatically, but if it doesn't seem to be a change, use ffmpeg

 

When i play stream videos using iis (11-12 mbps upload) (usually videos i stream are 22 minutes and 150 MB) 

but scrolling through the video takes like a minute to play and isent vary responsive can i do anything to improve?

(and yes i know i can use yt/streamable,ect but i wont for reasons :v)

Link to comment
Share on other sites

Link to post
Share on other sites

not sure i understand... are you preparing the videos and just using iis to stream them or what, are you uploading them to a site which uses iis? not sure i understand

 

When you encode the videos, encode them with keyframes at smaller interval, like every 5s or something like that. Default is often one keyframe every 250 frames (max 250 is allowed), so that's something like 10 seconds.

 

You can also use mp4box or mp4box gui to encode the mp4 file in optimized for streaming format. ffmpeg also works, you'd use something like this:

 

ffmpeg -i "x:\path\to\your\INPUT_FILE.mp4" -c copy -movflags faststart "x:\path\to\your\STREAMABLE_OUTPUT_FILE.mp4"

 

It will rearrange the internals of the mp4 file to have an index at the start of the video, which gives viewers the exact positions where to jump in video, so should allow for snappier seeks. The actual contents is copied over, there's no recompression, so it's very fast and lossless.

 

// and try setting up apache or nginx

see

https://opensource.com/article/19/1/basic-live-video-streaming-server

https://omega-coder.me/post/streaming-server-using-nginx-and-nginx-rtmp-module/

there's a windows version of nginx so you don't need to install linux, though the experience won't be as good if you leave it running like a command line application

but you can configure it as windows service

Quote

Download NSSM form http://nssm.cc/download . "Run %NSSM_HOME%\nssm.exe install “Nginx”"

Select the Nginx executable in the NSSM dialog, then OK. Go to Services and start the new created service "Nginx", done.

 

Link to comment
Share on other sites

Link to post
Share on other sites

24 minutes ago, mariushm said:

not sure i understand... are you preparing the videos and just using iis to stream them or what, are you uploading them to a site which uses iis? not sure i understand

 

When you encode the videos, encode them with keyframes at smaller interval, like every 5s or something like that. Default is often one keyframe every 250 frames (max 250 is allowed), so that's something like 10 seconds.

 

You can also use mp4box or mp4box gui to encode the mp4 file in optimized for streaming format. ffmpeg also works, you'd use something like this:

 

ffmpeg -i "x:\path\to\your\INPUT_FILE.mp4" -c copy -movflags faststart "x:\path\to\your\STREAMABLE_OUTPUT_FILE.mp4"

 

It will rearrange the internals of the mp4 file to have an index at the start of the video, which gives viewers the exact positions where to jump in video, so should allow for snappier seeks. The actual contents is copied over, there's no recompression, so it's very fast and lossless.

 

 

I don't understand most of this keyframw or path things, all i did was host a webserver using iis and tried playing a video (http://seaserver.ddns.net/Neverland/Neverland1.mp4) it plays well but when i skip to like halfway it just takes forever to load i have HandBreak if that helps 

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, mariushm said:

not sure i understand... are you preparing the videos and just using iis to stream them or what, are you uploading them to a site which uses iis? not sure i understand

 

When you encode the videos, encode them with keyframes at smaller interval, like every 5s or something like that. Default is often one keyframe every 250 frames (max 250 is allowed), so that's something like 10 seconds.

 

You can also use mp4box or mp4box gui to encode the mp4 file in optimized for streaming format. ffmpeg also works, you'd use something like this:

 

ffmpeg -i "x:\path\to\your\INPUT_FILE.mp4" -c copy -movflags faststart "x:\path\to\your\STREAMABLE_OUTPUT_FILE.mp4"

 

It will rearrange the internals of the mp4 file to have an index at the start of the video, which gives viewers the exact positions where to jump in video, so should allow for snappier seeks. The actual contents is copied over, there's no recompression, so it's very fast and lossless.

 

 

Actually, re-reading i think i will give mp4box a try

Link to comment
Share on other sites

Link to post
Share on other sites

use ffmpeg if mp4box doesn't work.

 

Let me explain again

Your movie has variable bitrate... one minute could be 1 MB , the next minute could be 2 MB in the file. It's hard for a video player to know where to start downloading the file when you choose to play from some time.

To help players, the mp4 file has a small list with timings, like for example time 20 seconds and 100 milliseconds starts at 3 MB and 50 KB in the file, time 1m 30s starts at 10 MB and so on. 

To generate this list, keyframes are usually used.

Keyframes are special frames in the video ... if your video is 30fps , that means there's 30 frames per second. A video codec can look at several frames and send only one full frame and the next few frames only contain information that tell the decoder how to generate an image from the previous frames. So if there's some transmission error and one of those frames are corrupted you'd get blocks of green on the screen or player jumps frames until the next keyframe is found in the file, which contains all the needed information to create a full picture.

So that ffmpeg command  takes that list with entries and puts it at the start of the file, so that it's downloaded right at the start and then video player knows exactly where to jump in the file.

mp4 box gui should do this automatically, but if it doesn't seem to be a change, use ffmpeg

 

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, mariushm said:

use ffmpeg if mp4box doesn't work.

 

Let me explain again

Your movie has variable bitrate... one minute could be 1 MB , the next minute could be 2 MB in the file. It's hard for a video player to know where to start downloading the file when you choose to play from some time.

To help players, the mp4 file has a small list with timings, like for example time 20 seconds and 100 milliseconds starts at 3 MB and 50 KB in the file, time 1m 30s starts at 10 MB and so on. 

To generate this list, keyframes are usually used.

Keyframes are special frames in the video ... if your video is 30fps , that means there's 30 frames per second. A video codec can look at several frames and send only one full frame and the next few frames only contain information that tell the decoder how to generate an image from the previous frames. So if there's some transmission error and one of those frames are corrupted you'd get blocks of green on the screen or player jumps frames until the next keyframe is found in the file, which contains all the needed information to create a full picture.

So that ffmpeg command  takes that list with entries and puts it at the start of the file, so that it's downloaded right at the start and then video player knows exactly where to jump in the file.

mp4 box gui should do this automatically, but if it doesn't seem to be a change, use ffmpeg

 

Thank you for explaining everything in a way i can understand it :)

Link to comment
Share on other sites

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

×