Monday, August 26, 2013

Video streaming - little 'bit'

I want to show a video on my website?

There are two ways:

1. Upload it on a video hosting site and use the embed URL
2. Use your own js player and source it from a streaming server

So what is a streaming server?

There are various protocols for streaming. RTSP kind of proprietary from Adobe has ruled the world with flash players. But now we are moving back to HTTP.

In streaming what is required is, data is sent in chunks and not the whole file.

There are two ways to it:

1. The server does all the job (chunking the files and sending it)
2. There are video containers which help us doing this job. Say MP4

So if you are using a proper file format, say mp4, lot of the work is done by the file itself. And then there is encoding on the top to compress the video.

The player would seek for chunks and the server would answer the same. That is how we can jump to positions.

A 5 minute video can be compressed at different bit rates that would determine the amount of bits received in the same time and thus the quality of video.

Here is sample to use a known js video player

Where I am streaming from?

1. AWS S3 bucket (make it public and take the name. You can cname it)
2. Google drive. The trick is to use this URL format<FILE_ID>. You can easily see the file id once you open it. Of course you have to give necessary permissions to the object.

<link href="" rel="stylesheet">
<script src=""></script>
<video id="example_video_1" class="video-js vjs-default-skin"
  controls preload="auto" width="640" height="264"
 <!--source src="" type='video/mp4' /-->
 <!--source src="" type='video/mp4' /-->
 <source src="" type='video/mp4' />
<iframe src="" width="640" height="385"></iframe>

I have put the embed url for the context. You have very less, or say none, skinning control with embed url. With custom player you can rock and roll.

I have played with RED5 andn Wowza media servers. But I don't think you would need any of those unless you are upto live streaming.

If you have something to add do add a comment, as I am learning !!

No comments: