Nginx搭建hls流媒体服务器
2013-10-23 11:34
483 查看
作者:康林(QQ:16614119)
第一种方案:ffmpeg+nginx
新的ffmpeg已经支持HLS。(本人也参与了代码供献,给自己做个广告:))
点播:
生成hls分片:
ffmpeg -i <媒体文件> -c:v libx264 -c:a aac -f hls /usr/local/nginx/html/test.m3u8
直播:
ffmpeg -i udp://@:1234 -c:v libx264 -c:a aac -f hls -hls_list_size 5 -hls_wrap 5 /usr/local/nginx/html/test.m3u8
建立web服务器:
默认配置就可以。
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
}
启动nginx。
客户端访问:http://IP/test.m3u8
在windows上可以用vlc播放。
第二个方案,用nginx-rtmp-module
第一种方案:ffmpeg+nginx
新的ffmpeg已经支持HLS。(本人也参与了代码供献,给自己做个广告:))
点播:
生成hls分片:
ffmpeg -i <媒体文件> -c:v libx264 -c:a aac -f hls /usr/local/nginx/html/test.m3u8
直播:
ffmpeg -i udp://@:1234 -c:v libx264 -c:a aac -f hls -hls_list_size 5 -hls_wrap 5 /usr/local/nginx/html/test.m3u8
建立web服务器:
默认配置就可以。
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
}
启动nginx。
客户端访问:http://IP/test.m3u8
在windows上可以用vlc播放。
第二个方案,用nginx-rtmp-module
rtmp { server { listen 1935; chunk_size 4000; #HLS # For HLS to work please create a directory in tmpfs (/tmp/app here) # for the fragments. The directory contents is served via HTTP (see # http{} section in config) # # Incoming stream must be in H264/AAC. For iPhones use baseline H264 # profile (see ffmpeg example). # This example creates RTMP stream from movie ready for HLS: # # ffmpeg -loglevel verbose -re -i movie.avi -vcodec libx264 # -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1 # -f flv rtmp://localhost:1935/hls/movie # # If you need to transcode live stream use 'exec' feature. # application hls { live on; hls on; hls_path /tmp/app; hls_fragment 5s; } } } http { server { listen 80; location /hls { # Serve HLS fragments types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } alias /tmp/app; expires -1; } } }
相关文章推荐
- nginx上搭建HLS流媒体服务器
- 基于nginx和ffmpeg搭建HLS流媒体服务器
- rtmp与hls流媒体服务器搭建:ubuntu下Nginx搭建初探与rtmp-module的添加
- 网易视频云:用Nginx搭建flv,mp4,hls流媒体服务器
- nginx上搭建HLS流媒体服务器
- nginx上搭建HLS流媒体服务器
- 实时监控、直播流、流媒体、视频网站开发方案流媒体服务器搭建及配置详解:使用nginx搭建rtmp直播、rtmp点播、,hls直播服务配置详解
- Nginx搭建hls流媒体服务器
- nginx上搭建HLS流媒体服务器
- nginx上搭建HLS流媒体服务器
- nginx上搭建HLS流媒体服务器
- 利用nginx-rtmp-module搭建hls直播流媒体服务器
- nginx上搭建hls流媒体服务器
- rtmp与hls流媒体服务器搭建:ubuntu下Nginx搭建初探与rtmp-module的添加
- Nginx搭建HLS流媒体服务器
- nginx上搭建HLS流媒体服务器
- 通过nginx搭建hls流媒体服务器
- 实时监控、直播流、流媒体、视频网站开发方案流媒体服务器搭建及配置详解:使用nginx搭建rtmp直播、rtmp点播、,hls直播服务配置详解
- rtmp与hls流媒体服务器搭建:ubuntu下Nginx搭建初探与rtmp-module的添加
- nginx上搭建HLS流媒体服务器