HTTP Live Streaming for iPhone/iPad(HLS流媒体服务器)
2011-05-06 00:21
489 查看
最近研究了一下Http Live Streaming机制,顺便搭建了一个测试环境。
参考:http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/comment-page-1/
Step 1: 编译ffmpeg
这个就不多讲了,先要编译facc和x264
参考:http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/comment-page-1/
Step 1: 编译ffmpeg
这个就不多讲了,先要编译facc和x264
a)编译faac和faad b)编译x264 c)编译ffmpeg configure --enable-gpl --enable-nonfree --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libx264 Step2: 视频文件编码configure --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libx264
Step3: 下载和编译Segmenter
http://svn.assembla.com/svn/legend/segmenter/
需要修改一下Makefileall: gcc -Wall -g segmenter.c -o segmenter -lavformat -lavcodec -lavutil -lbz2 -lm -lz -lfaac -lmp3lame -lx264 -lfaad clean: rm segmenter
使用:segmenter <input MPEG-TS file> <segment duration in seconds> <output MPEG-TS file prefix> <output m3u8 index file> <http prefix>
例如:
segmenter sample_low.ts 10 sample_low stream_low.m3u8 http://www.ioncannon.net/
Step4:搭建HTTP Server
以Tomcat为例,修改conf/web.xml文件,增加<mime-mapping> <extension>m3u</extension> <mime-type>audio/x-mpegurl</mime-type> </mime-mapping> <mime-mapping> <extension>m3u8</extension> <mime-type>application/x-mpegurl</mime-type> </mime-mapping> <mime-mapping> <extension>ts</extension> <mime-type>video/MP2T</mime-type> </mime-mapping>
指定.m3u8和.ts的MIME类型
.m3u8 application/x-mpegURL
.ts video/MP2T
Step5: 测试流媒体服务器
a)用iPhone的Safari浏览器,注意访问的地址是服务器上以.m3u8后缀的文件
b)用支持html5的浏览器,我还没有试验<html> <head> <title>Video Test</title> <meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/> </head> <body style="background-color:#FFFFFF; " mce_style="background-color:#FFFFFF; "> <center> <video width='150' height='150' src="stream-128k.m3u8" mce_src="stream-128k.m3u8" /> </center> </body> </html>
这样在iPhone上就可以播放流媒体了。
相关文章推荐
- HTTP Live Streaming for iPhone/iPad(HLS流媒体服务器)
- HTTP Live Streaming for iPhone/iPad(HLS流媒体服务器)
- HTTP Live Streaming for iPhone/iPad(HLS流媒体服务器)
- iPhone, iPad, iPod – HTTP Live Streaming (HLS) with free tools on Windows
- iPhone, iPad, iPod – HTTP Live Streaming (HLS) with free tools on Windows
- Best Practices for Creating and Deploying HTTP Live Streaming Media for the iPhone and iPad
- iPhone, iPad, iPod – HTTP Live Streaming (HLS) with free tools on Windows
- iPhone, iPad, iPod – HTTP Live Streaming (HLS) with free tools on Windows
- HLS流媒体与其他方式的比较 http://issuu.com/andruby/docs/http_live_streaming_presentatino#download
- 【流媒体】【学习笔记】HTTP Live Streaming (HLS) 视频直播技术
- HTTP Live Streaming (HLS) 协议科普扫盲
- HLS(http live streaming) m3u8自制
- HTTP Live Streaming (HLS) 视频直播技术
- [视频]HTTP Live Streaming (HLS) 不错的视频直播技术
- Flash加载一直在更新的资源的缓存问题,比如 在hls(HTTP Live Streaming)获取m3u8的文件
- 流媒体:搭建HTTP Live Streaming直播系统
- 【Android多媒体】NuPlayer for HTTP Live Streaming【4】
- 如何使用iOS实现视频的直播、点播、缓存?-HTTP Live Streaming (HLS)
- iphone ios HTTP Live Streaming
- Http Live Streaming 实现iphone在线播放视频(1)-参考