SRS搭建自己的直播、点播系统
使用ffmpeg推流
ffmpeg -i /media/Movies/goog_video.mp4 -vcodec copy -acodec copy -y -f flv rtmp:127.0.0.1:2935/live/test
#本地播放
ffplay http://127.0.0.1:8081/live/test.m3u8
HLS配置文件
这里给出了HLS
使用的配置文件http.hls.conf
listen 2935; max_connections 1000; daemon on; srs_log_tank file; srs_log_level error; srs_log_file ./objs/srs.log; http_server { enabled on; listen 8081; dir ./objs/nginx/html; } vhost __defaultVhost__ { hls { enabled on; hls_fragment 10; hls_window 60; hls_path ./objs/nginx/html; hls_m3u8_file [app]/[stream].m3u8; hls_ts_file [app]/[stream]-[seq].ts; hls_cleanup on; hls_dispose 30; hls_on_error continue; hls_storage disk; hls_wait_keyframe on; hls_acodec aac; hls_vcodec h264; } }
启动服务
配置文件搞定了,就可以正式启动流媒体服务了
./objs/srs -c conf/http.hls.conf
reload
如果srs
正在正常运行,但是配置文件又有了更新,想要服务无缝重启,可以使用reload
操作
killall -1 srs
参考资料
- https://github.com/ossrs/srs
- https://github.com/ossrs/srs-bench
- http://www.ossrs.net/srs.release/releases/
- https://xugaoxiang.com/2019/12/06/hls-srs/