HLS视频服务器srs

/

软硬件环境

  • ubuntu 16.04 64bit
  • srs 2.0release

SRS简介

SRS,即Simple-RTMP-Server,是一个开源的视频服务器,出自国人之手。release版本下载地址https://github.com/ossrs/srs/releases,目前的最高版本是v2.0-r2。

源码编译

  1. tar xvf v2.0-r2.tar.bz2
  2. cd srs-2.0-r2/trunk
  3. mkdir build
  4. ./configure --prefix=/home/longjing/srs/srs-2.0-r2/trunk/build --with-http-api --with-hls --with-http-server --with-ssl --with-stat --with-research --with-dvr --with-http-callback
  5. make
  6. make install

配置文件

  1. listen 2935;
  2. max_connections 1000;
  3. daemon on;
  4. # srs_log_tank console;
  5. http_server {
  6. enabled on;
  7. listen 8081;
  8. dir ./objs/nginx/html;
  9. }
  10. vhost __defaultVhost__ {
  11. hls {
  12. enabled on;
  13. hls_fragment 10;
  14. hls_window 60;
  15. hls_path ./objs/nginx/html;
  16. hls_m3u8_file [app]/[stream].m3u8;
  17. hls_ts_file [app]/[stream]-[seq].ts;
  18. hls_cleanup on;
  19. hls_dispose 30;
  20. # hls_on_error disconnect;
  21. hls_storage disk;
  22. hls_wait_keyframe on;
  23. hls_acodec aac;
  24. hls_vcodec h264;
  25. }
  26. #http_hooks {
  27. # enabled on;
  28. # on_connect http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
  29. # on_close http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
  30. # on_publish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
  31. # on_unpublish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
  32. # on_play http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
  33. # on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
  34. # on_dvr http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs;
  35. #}
  36. }

启动服务

  1. ./objs/srs -c conf/http.hls.conf

reload

  1. killall -1 srs

参考资料

https://github.com/ossrs/srs

http://www.ossrs.net/srs.release/releases/

转载请注明作者和出处,并添加本页链接。
原文链接:http://xugaoxiang.com/post/15

给我留言