DASH Adaptive Streaming for HTML 5 Video

From:https://developer.mozilla.org/en-US/docs/Web/HTML/DASH_Adaptive_Streaming_for_HTML_5_Video

今天在家需要充电,就看了这篇文章,顺便把他翻译下来。



Dynamic Adaptive Streaming over HTTP (DASH) is an adaptive streaming protocol. This means that it allows for a video stream to switch between bit rates on the basis of network performance, in order to keep a video playing.

DASH是一个自适应流媒体协议。为了保证连续播放,这可允许视频流根据网络带宽选择一个适当的比特率进行播放。


Browser Support (浏览器支持情况)EDIT

Firefox 21 includes an implementation of DASH for HTML5 WebM video which is turned off by default. It can be enabled via "about:config" and the "media.dash.enabled" preference.

Firefox 21 包括了对HTML5 WebM 视频的支持,但是默认是关闭的。你可以通过"about:config"标签里的"media.dash.enabled"开关来设置。

Firefox 23 removed support for DASH for HTML5 WebM video.  It will be replaced by an implementation of the Media Source Extensions API which will allow support for DASH via Javascript libraries such as dash.js. See bug 778617 for details.

Firefox 23 移除了通过HTML5 WebM视频对Dash的支持。对Dash支持被一个新的实现--MSE代替了,MSE通过Javascript库(例如dash.js库)来提供对DASH的支持。

Using DASH - Server Side 使用DASH-服务端EDIT

First you'll need to convert your WebM video to a DASH manifest with the accompanying video files in various bit rates. To start with you'll need:

1. Use your existing WebM file to create one audio file and multiple video files.

For example:

Create the audio using:

ffmpeg -i my_master_file.webm -vn -acodec libvorbis -ab 128k my_audio.webm

And create the video files using:

ffmpeg -i my_master_file.webm -vcodec libvpx -vb 250k -keyint_min 150 -g 150 -an my_video-250kbps.webm
ffmpeg -i my_master_file.webm -vcodec libvpx -vb 100k -keyint_min 150 -g 150 -an my_video-100kbps.webm
ffmpeg -i my_master_file.webm -vcodec libvpx -vb 50k -keyint_min 150 -g 150 -an my_video-50kbps.webm

2. Align the clusters to enable switching at cluster boundaries.

For video:

samplemuxer -i my_video-250kbps.webm -o my_video-250kbps-final.webm
etc.

Although we don't switch audio streams, it's still necessary to run it through samplemuxer to ensure a cues element is added. Note: to be compatible with playing on Chrome, it is suggested to change the track number to something other than the one in the video files, most likely 0.

samplemuxer -i my_audio.webm -o my_audio-final.webm -output_cues 1 -cues_on_audio_track 1 -max_cluster_duration 2 -audio_track_number

3. Create the manifest file:

webm_dash_manifest -o my_video_manifest.mpd \
  -as id=0,lang=eng \
  -r id=0,file=my_video-250kbps-final.webm \
  -r id=1,file=my_video-100kbps-final.webm \
  -r id=2,file=my_video-50kbps-final.webm \
  -as id=1,lang=eng \
  -r id=4,file=my_audio-final.webm

Put the manifest and the associated video files on your web server or CDN. DASH works via HTTP, so as long as your HTTP server supports byte range requests, and it's set up to serve .mpd files with mimetype="application/dash+xml", then you're all set.

Using DASH - Client SideEDIT

You'll want to modify your web page to point to the DASH manifest first, instead of directly to a particular video file:

<video>
  <source src="movie.mpd">
  <source src="movie.webm">
  Your browser does not support the video tag.
</video>

That's it! If DASH is supported by the browser, your video will now stream adaptively.

WebM DASH Specification at The WebM Project

DASH Industry Forum



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值