Of course, you may think all these problems are easy to solve. Just store video files (for example, mp4 files) on your http server and use your favourite CDN service to serve them anywhere in the world.
This is far from the best solution for a few reasons, efficiency being one of them. If you store original video files in full resolution, users in rural areas or parts of the world with poor connectivity will have a hard time enjoying them. Their video players will struggle to download enough data to play it in runtime.
Sample M3u8 .ts Files
HTTP Live Streaming is an adaptive bitrate streaming protocol introduced by Apple in 2009. It uses m3u8 files to describe media streams and it uses HTTP for the communication between the server and the client. It is the default media streaming protocol for all iOS devices, but it can be used on Android and web browsers.
These are called variants of the same video prepared for different network speeds and screen resolutions. This specific M3U8 file (640x360_1200.m3u8) contains the video file chunks of the video resized to 640x360 pixels and prepared for bitrates of 1296kbps. Note that the reported bitrate must take into account both the video and audio streams in the video.
Note, the latest version of HLS allows for fragmented .mp4 files, too. Since this is a still a new thing, and some video players still need to implement it, the examples in this article will use .ts files.
There are a few changes in your M3U8 files. First, there must be a #EXT-X-MEDIA-SEQUENCE:1 tag in the variant M3U8 file. Then, the M3U8 file must not end the with #EXT-X-ENDLIST (which otherwise must always be placed at the end).
While you record your stream you will constantly have new .ts files. You need to append them in the M3U8 playlist and each time you add a new one the counter in the #EXT-X-MEDIA-SEQUENCE: must be increased by 1.
The video player will check the counter. If changed from the last time it knows if there are new chunks to be downloaded and played. Make sure that the M3U8 file is served with the no-cache headers, because clients will keep reloading M3U8 files waiting for new chunks to play.
Another interesting feature for HLS streams is that you can embed Web Video Text Track (VTT) files in them. VTT files can be used for various uses. For example, for a web HLS player you can specify image snapshots for various parts of the video. When the user moves the mouse over the video timer area (below the video player), the player can show snapshots from that position in the video.
In addition to VTT files, Apple recently announced HLS will feature support for IMSC1, a new subtitle format optimized for streaming delivery. Its most important advantage is that it can be styled using CSS.
mp4split generates all files required for HLS streaming using MP4 audio/videofiles as input. To enable the HLS packaging mode with Transport Streams (TS),the first option on the command-line must be --package-hls.
The following example creates two MP4's that each contain audio and video, withthe bitrate for the video being different for each. Then, those MP4's are usedas input files for packaging multiplexed HLS.
I am evaluating the Wowza to stream VOD and Live content to iPhones/IPad. By reading Wowza docs, i came to know that to do HLS (HTTP Live Streaming), one only needs to have .mp4 file because on getting request from iPhone, Wowza automatically converts the .mp4 into .ts file and create .m3u8 file.
if I have a live streamschedule.smil file corresponding to .mp4 files to stream as a channel i assume the requested .m3u8 and corresponding .ts segment would be created on the fly as well. Is this right? and what would be the correct URL for iOS to playback the playlist.m3u8?
If you want to learn more about HLS playlists, check out our collection of HLS m3u8 files to see examples from different vendors with different use-cases. And, if you are new to HLS (HTTP Live Streaming), please read our basic tutorial to HLS Streaming and why you should use ABR streaming.
This is so useful. Is there any way we can add cue markers in the child manifest files while packaging? Shaka packager adds cue markers but splits audio and video manifests. Any open source tool which supports this functionality?
The first problem is it creates an unplayable video because the stream .m3u8 files are put into the same directory as master.m3u8, but their .ts files are in stream_x directories. I fixed this by changing -var_stream_map argument:
I followed the article and tried to generate HSL packing for audio. It was successful as well because I was able to generate 3 different m3u8 bit-ranged variants for the raw mp3 and I have to manually create the master playlist.
In this solution, you will use HTTP Live Streaming (HLS) and Amazon CloudFront. HLS is a protocol that segments media files optimizing them for streaming. HLS enables media players to play segments with the highest quality resolution that is supported by their network connection during playback. Amazon CloudFront is a fast content delivery network (CDN) service that securely delivers data to end-users globally with low latency and high transfer speeds.
To securely serve your private content, you can configure CloudFront to require that your users access your files using CloudFront signed URLs. A signed URL includes additional information, such as an expiration date and time, that gives you more control over access to your content. This additional information appears in a policy statement which is based on a custom policy.
The last step in protecting your media files with CloudFront trust key group is to associate the media-files.api.myapp.com and my-content.s3.amazonaws.com behavior. To learn how to add a signer to your CloudFront distribution, see Adding a signer to a distribution using the CloudFront console.
For illustration purposes, also assume that the request URI is /content/media/signurl?movie=1. The Lambda function will get the query parameter movie=1 from the event object then query your data store to identify the s3 bucket name and the path to the index.m3u8 file. Once again, assume query result return movies/movie_1/index.m3u8 as the path to the movie=1 media content. Knowing the path to the index.m3u8 file, Lambda function has all the required information to sign a URL.
The video player in your client application receives the signed URL as request response, and makes the request to the _1/index.m3u8 URL to get the main manifest. To authorize the request, CloudFront looks at all attributes in the JSON policy object. The Resource attribute in the policy verifies that the resource pattern in the Resources attributes matches with the request URL. The wildcard in _1/* means that the policy allows access to any file in the movie_1 directory, as indicated by the * wildcard character. In this example, requests to _1/index.m3u8 and _1/sequence_01.ts will be authorized by CloudFront. To learn more about the policy statement, see Values that you specify in the policy statement for a signed URL that uses a custom policy.
To securely stream content from your S3 bucket to CloudFront, use a special CloudFront user called an origin access identity (OAI), associate it with your distribution, configure your S3 bucket permissions so that CloudFront can use the OAI to access the files in your bucket and serve them to your users. To learn more about how to create OAI and configure S3 bucket permissions, see Restricting Access to Amazon S3 Content by Using an Origin Access Identity. 2ff7e9595c
Comments