日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > c/c++ >内容正文

c/c++

C/C++音视频高级开发-开源流媒体服务器SRS环境搭建

發布時間:2024/3/12 c/c++ 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C/C++音视频高级开发-开源流媒体服务器SRS环境搭建 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、環境搭建

1.1 C++環境

sudo apt-get update# 更新軟件包 sudo apt-get install build-essential -y # 安裝C++開發環境 sudo apt-get install gdb -y#安裝gdb sudo apt-get install libtool -y sudo apt-get install pkg-config -y sudo apt-get install automake -y sudo apt-get install autoconf -y

1.2 golang環境

  • 下載go二進制包
    下載地址,如果懶得去找最新的版本,或者使用go1.16.5就行的也可以直接執行下列命令下載。

  • wget https://dl.google.com/go/go1.16.5.linux-amd64.tar.gz -O ~/go1.16.5.linux-amd64.tar.gz

    相關視頻

    SRS4.0與WebRTC一對一音視頻通話

    解壓并重命名文件夾,方便不同版本區分

    cd ~ tar -xvf go1.16.5.linux-amd64.tar.gz mv go go1.16.5

    配置環境變量

    tee -a $HOME/.bashrc <<'EOF' # Go envs export GOVERSION=go1.16.5 # Go 版本設置 export GO_INSTALL_DIR=$HOME/go1.16.5 # Go 安裝目錄 export GOROOT=$GO_INSTALL_DIR # GOROOT 設置 export GOPATH=~/workspace/golang # GOPATH 設置 export PATH=$GOROOT/bin:$GOPATH/bin:$PATH # 將 Go 語言自帶的和通過 go install 安裝的二進制文件加入到 PATH 路徑中 export GO111MODULE="on" # 開啟 Go moudles 特性 export GOPROXY=https://goproxy.cn,direct # 安裝 Go 模塊時,代理服務器設置 EOF

    驗證配置

    go version

    二、編譯和啟動srs

    git clone -b v4.0.146 https://gitee.com/winlinvip/srs.oschina.git srs.4.0.146 cd srs.4.0.146/trunk ./configure make -j4 ./objs/srs -c conf/rtc.conf

    三、啟動信令服務器

    cd 3rdparty/signaling make -j4 cd objs ./signaling

    四、啟動web服務器

    cd 3rdparty/httpx-static make -j4 ./objs/httpx-static -http 80 -https 443 -ssk server.key -ssc server.crt \-proxy http://127.0.0.1:1989/sig -proxy http://127.0.0.1:1985/rtc \-proxy http://127.0.0.1:8080/

    音視頻免費學習地址:FFmpeg/WebRTC/RTMP/NDK/Android音視頻流媒體高級開發

    分享一個音視頻高級開發交流群,群文件有最新音視頻學習文件和視頻~點擊788280672加入自取(或者聯系管理員領取最新資料)。部分音視頻開發資料一覽圖

    ?

    參數說明:

    -http: http監聽的端口

    -https: https監聽的端口

    -domain: https域名

    -root: 萬維網根路徑

    -cache: letsencrypt緩存

    lets:

    -ssk: https key

    -ssc: https cert

    proxy: 代理服務器地址 -> srs

    sdomain: ssl域名

    skey: 域名的SSLkey

    scert: 域名證書
    生成證書:
    ?

    openssl genrsa -out server.key 2048 openssl req -new -x509 -key server.key -out server.crt -days 3650

    端口說明

    1935: rtmp服務

    1985: http api服務

    8080: http-flv、hls服務

    1989: 信令服務

    五、rtc.conf說明

    # RTMP監聽端口,使用ip:port分割 # eg. 192.168.3.249:1935 10.10.10.100:1935 # 默認0.0.0:1935 listen 1935; # 最大連接數,如果超出最大連接數,服務器將會拒絕新的連接,默認值1000 max_connections 1000; # 是否啟動守護進程,默認開啟 daemon off; # # the log tank, console or file. # if console, print log to console. # if file, write log to file. requires srs_log_file if log to file. # default: file. # 日志輸出的目標,console或者file,如果設置成file需要配置srs_log_file srs_log_tank console;# HTTP配置 http_server {enabled on;listen 8080;dir ./objs/nginx/html; }# srs api配置 # the http api config, export for external program to manage srs. # user can access http api of srs in browser directly, for instance, to access by: # curl http://192.168.1.170:1985/api/v1/reload # which will reload srs, like cmd killall -1 srs, but the js can also invoke the http api, # where the cli can only be used in shell/terminate. http_api {# 是否啟用HTTP api,默認offenabled on;listen 1985; }stats {network 0; } rtc_server {enabled on;# Listen at udp://8000listen 8000;## The $CANDIDATE means fetch from env, if not configed, use * as default.## The * means retrieving server IP automatically, from all network interfaces,# @see https://github.com/ossrs/srs/wiki/v4_CN_RTCWiki#config-candidate#candidate $CANDIDATE;candidate 42.192.181.115; }vhost __defaultVhost__ {rtc {enabled on;}http_remux {enabled on;mount [vhost]/[app]/[stream].flv;} }

    總結

    以上是生活随笔為你收集整理的C/C++音视频高级开发-开源流媒体服务器SRS环境搭建的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。