<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ![](https://source.unsplash.com/random/1024x200) ## 服務與模塊 1、Openresty下載 ```bash https://openresty.org/download/openresty-1.11.2.3.tar.gz ``` 2、nginx-ts-module下載 ```bash git clone https://github.com/arut/nginx-ts-module.git ``` 3、ffmpeg 下載安裝 ### 動態編譯安裝 1、Openresty環境配置 ```bash apt-get install libreadline-dev libncurses5-dev libpcre3-dev \ libssl-dev perl make build-essential ``` 2、動態編譯安裝 ```bash ./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module \ --with-http_iconv_module --add-dynamic-module=/root/nginx-ts-module ... make -j4 ... sudo make install ``` 3、配置文件 `nginx.conf` ```bash # vim /opt/openresty/nginx/conf/nginx.conf error_log logs/error.log; pid logs/nginx.pid; load_module "/opt/openresty/nginx/modules/ngx_http_ts_module.so"; # 加載模塊 events { } http { server { listen 8000; location / { root html; } location /publish/ { ts; ts_hls path=/var/media/hls segment=10s; ts_dash path=/var/media/dash segment=10s; client_max_body_size 0; } location /play/ { add_header Cache-Control no-cache; add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; add_header 'Access-Control-Allow-Headers' 'Range'; types { application/x-mpegURL m3u8; application/dash+xml mpd; video/MP2T ts; video/mp4 mp4; } alias /var/media/; } } } ``` + 流媒體存放文件夾建立 ```bash cd /var & makedir media cd media & makedir hls & makedir dash ``` 4、FFmpeg推流 ```bash ffmpeg -re -i rtmp://live.hkstv.hk.lxdns.com/live/hks -bsf:v h264_mp4toannexb \ -c copy -f mpegts http://127.0.0.1:8000/publish/sintel ``` 5、客戶端播放 ```html <script src="http://cdn.dashjs.org/latest/dash.all.min.js"></script> <style> video { width: 640px; height: 360px; } </style> <div> <video data-dashjs-player autoplay src="http://1127.0.0.1:8000/play/dash/sintel/index.mpd" controls></video> </div> ``` 6、如果不使用 ffmpeg 直接拉流到`http://127.0.0.1:8000/publish/sintel` 服務的解決方案? * nginx-rtmp-module下載 ``` git clone https://github.com/arut/nginx-rtmp-module.git ``` * 和安裝`nginx-ts-module`模塊一樣動態編譯安裝既可以,最后別忘記了的在配置文件load `nginx-rtmp-module.so`文件 * 按照這個順序:`OBS => nginx-rtmp => nginx-ts`推流,OBS也可以是別的網絡推流設備 * 通過以上我們可以不直接使用ffmpeg 去推流了,而是在Windows端口可以通過OBS很簡單的去推流了 * 使用VLC播放器測試,結果OK! 7、總結,一切順利通過。 ### NGINX-RTMP-TS-DASH 直播方案 1、HLS、MPEG-DASH多路輸入/輸出流(HLS、MPEG-DASH) ![Markdown](./image/rtmp-republishing-hls-dash_big.png) 2、編譯安裝 + 1、下載nginx-rtmp-module模塊: ```bash git clone https://github.com/arut/nginx-rtmp-module.git ``` + 2、配置 --with-http_xslt_module 時提示 the HTTP XSLT module requires the libxml2/libxslt libraries,安裝以下: ? ```bash sudo apt-get install libxml2 libxml2-dev libxslt-dev sudo apt-get install libgd2-xpm libgd2-xpm-dev ``` + 3、通過configure命令生成Makefile文件,為下一步的編譯做準備: ```bash ./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module \ --with-http_stub_status_module --with-http_xslt_module --add-dynamic-module=/root/nginx-ts-module \ --add-dynamic-module=/root/nginx-rtmp-module ``` + 4、如果報下面的錯誤 ```bash platform: linux (linux) you need to have ldconfig in your PATH env when enabling luajit. ``` > 是因為找不到命令ldconfig, 這個命令一般是在/sbin/目錄下的,所以先執行`export PATH=$PATH:/sbin` + 5、如果出現:`./configure: error: the HTTP XSLT module requires the libxml2/libxslt` 錯誤,安裝以下: ```bash sudo apt-get install libxml2 libxml2-dev libxslt-dev ``` + `nginx.conf` 配置 ```bash # vim /opt/openresty/nginx/conf/nginx.conf user www; worker_processes 1; error_log logs/error.log; pid logs/nginx.pid; load_module "/opt/openresty/nginx/modules/ngx_http_ts_module.so"; load_module "/opt/openresty/nginx/modules/ngx_rtmp_module.so"; events { worker_connections 1024; } http { server { listen 8000; # This URL provides RTMP statistics in XML location /stat { rtmp_stat all; rtmp_stat_stylesheet stat.xsl; } location /stat.xsl { root html; } location /hls { # Serve HLS fragments add_header Cache-Control no-cache; add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; add_header 'Access-Control-Allow-Headers' 'Range'; types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /tmp; } location /dash { # Serve DASH fragments add_header Cache-Control no-cache; add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range'; add_header 'Access-Control-Allow-Headers' 'Range'; types { application/dash+xml mpd; video/mp4 mp4; } root /tmp; } } } rtmp { listen 1935; chunk_size 4000; idle_streams off; ping 30s; notify_method get; server { listen 1935; chunk_size 4000; drop_idle_publisher 10s; idle_streams off; application live { live on; } application hls { live on; hls on; hls_path /tmp/hls; } # MPEG-DASH is similar to HLS application dash { live on; dash on; dash_path /tmp/dash; } } } ``` + 拷貝xml文件:`cp /root/nginx-rtmp-module/stat.xsl /opt/openresty/nginx/html` + 流狀態查看:`http://127.0.0.1:8000/stat` + OBS推流地址:`rtmp://127.0.0.1/dash/123` + VLC觀看RTMP直播流:`rtmp://127.0.0.1/dash/123` + DASH格式HTTP播放 ```html <script src="http://cdn.dashjs.org/latest/dash.all.min.js"></script> <style> video { width: 640px; height: 360px; } </style> <div> <video data-dashjs-player autoplay src="http://127.0.0.1:8000/dash/123.mpd" controls></video> </div> ``` * **功能特點** 支持RTMP、HTTP-FLV、HLS、HTML5等協議,面向Windows、iOS、Android等終端提供穩定流暢的視頻直播、點播服務,支持微信直播和微信點播, 可部署在局域網和互聯網,實現私有云和公有云應用,單設備高并發。 * **多屏播放** 支持Flash、HTML5播放,兼容Windows、Android、iOS、Mac等操作系統; * **轉碼、上傳** 轉碼、上傳一體化設計,使視頻資源轉碼后可立即面向互聯網進行發布; * **嵌入、分享** 上傳視頻后一鍵生成視頻地址,以供用戶分享、嵌入到網站、軟件系統中; * **豐富接口** 提供編程語言無關化的RESTful API接口,可以很簡單的進行二次開發; * **強大的WEB管理系統** 采用業界優秀的流媒體框架模式設計,服務運行輕量、高效、穩定、可靠、易維護,是移動互聯網時代貼近企業點播、直播需求的一款流媒體方案,可以形成一套完整的視頻直播、錄播解決方案,滿足用戶在各種行業場景的流媒體業務需求。 * 1、視頻上傳 * 2、點播管理 * 3、直播流管理 * 4、正在直播 * 5、分享集成 * 6、接口在線調試 * **應用場景** 視頻門戶網站、會議活動現場直播、網絡電視臺、遠程監控、在線實時課堂、 科研方向等。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看