nginx搭建支援http和rtmp協議的流媒體伺服器之一
實驗目的:
讓Nginx支援flv和mp4格式檔案,支援RTMP協議的直播和點播;
同時開啟RTMP的HLS功能
資料:
HTTP Live Streaming(縮寫是 HLS)是一個由蘋果公司提出的基於HTTP的流媒體網路傳輸協議。
HLS只請求基本的HTTP報文,與實時傳輸協議(RTP)不同,HLS可以穿過任何允許HTTP資料透過的防火牆或者代理伺服器。
它也很容易使用內容分發網路來傳輸媒體流。
使用ffmpeg來完成對flv、mp4、mp3等格式的轉化(點播實驗暫時不測試)
一、準備工作
Nginx:
模組:nginx_mod_h264_streaming(支援h264編碼的影片)
模組:http_flv_module 支援flv
模組:http_mp4_module 支援mp4
下載地址:
1、安裝依賴包:
#yum -y install gcc glibc glibc-devel make nasm pkgconfig lib-devel openssl-devel expat-devel gettext-devel libtool mhash.x86_64 perl-Digest-SHA1.x86_64
2、安裝相關工具包
1). git
# mkdir soft-source
# cd soft-source
# wget
# xz -d git-latest.tar.xz
# tar xzvf git-latest.tar
# cd git-2014-06-27
# autoconf
# ./configure
# make && make install
# git --version
git version 2.0.0.GIT
# cd ..
2). zlib
# wget
# tar -zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8
# ./configure
# make
# make install
# cd ..
3). pcre
# wget
# tar zxvf pcre-8.12.tar.gz
# cd pcre-8.12
# ./configure
# make && make install
# cd ..
4). yadmi
yadmi的作用是為flv檔案新增關鍵幀,才能實現拖動播放
# wget
# tar xzvf yamdi-1.4.tar.gz
# cd yamdi-1.4
# make && make install
# cd ..
使用方法:
# yamdi -i input.flv -o out.flv
給input.flv檔案 新增關鍵幀,輸出為out.flv檔案
5). OpenSSL
# wget
# tar -zxvf openssl-1.0.1c.tar.gz
# ./config
# make
# make install
3、安裝ffmpeg及其依賴包:
1). Yasm
# wget
# tar xzvf yasm-1.2.0.tar.gz
# cd yasm-1.2.0
# ./configure
# make
# make install
# cd ..
2). x264
# git clone git://git.videolan.org/x264
# cd x264
# ./configure --enable-shared
# make
# make install
# cd ..
3). LAME
# wget
# tar xzvf lame-3.99.5.tar.gz
# cd lame-3.99.5
#./configure --enable-nasm
# make
# make install
# cd ..
4). libogg
# wget
# tar xzvf libogg-1.3.0.tar.gz
# cd libogg-1.3.0
# ./configure
# make
# make install
# cd ..
5). libvorbis
# wget
# tar xzvf libvorbis-1.3.3.tar.gz
# cd libvorbis-1.3.3
# ./configure
# make
# make install
# cd ..
6). libvpx
# git clone
# cd libvpx
# ./configure --enable-shared
# make
# make install
# cd ..
7). FAAD2
# wget
# tar zxvf faad2-2.7.tar.gz
# cd faad2-2.7
# ./configure
# make
# make install
# cd ..
8). FAAC
# wget
# tar zxvf faac-1.28.tar.gz
# cd faac-1.28
# ./configure
# make
# make install
# cd ..
9). Xvid
# wget
# tar zxvf xvidcore-1.3.2.tar.gz
# cd xvidcore/build/generic
# ./configure
# make
# make install
# cd ..
10). ffmpeg
# git clone git://source.ffmpeg.org/ffmpeg
# cd ffmpeg
# ./configure --prefix=/opt/ffmpeg/ --enable-version3
--enable-libvpx --enable-libfaac --enable-libmp3lame
--enable-libvorbis --enable-libx264 --enable-libxvid
--enable-shared --enable-gpl --enable-postproc --enable-nonfree
--enable-avfilter --enable-pthreads
# make && make install
# cd ..
修改/etc/ld.so.conf如下:
include ld.so.conf.d/*.conf
/lib
/lib64
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/ffmpeg/lib
# ldconfig
二、安裝Nginx相關模組
1. 模組安裝
# wget
# tar zxvf nginx_mod_h264_streaming-2.2.7.tar.gz
# git clone git://github.com/arut/nginx-rtmp-module.git
2. 建立使用者和組
# groupadd www
# useradd -g www www
3. nginx安裝
# wget /download/nginx-1.6.0.tar.gz
# tar zxvf nginx-1.6.0.tar.gz
# cd nginx-1.6.0
讓Nginx支援flv和mp4格式檔案,支援RTMP協議的直播和點播;
同時開啟RTMP的HLS功能
資料:
HTTP Live Streaming(縮寫是 HLS)是一個由蘋果公司提出的基於HTTP的流媒體網路傳輸協議。
HLS只請求基本的HTTP報文,與實時傳輸協議(RTP)不同,HLS可以穿過任何允許HTTP資料透過的防火牆或者代理伺服器。
它也很容易使用內容分發網路來傳輸媒體流。
使用ffmpeg來完成對flv、mp4、mp3等格式的轉化(點播實驗暫時不測試)
一、準備工作
Nginx:
模組:nginx_mod_h264_streaming(支援h264編碼的影片)
模組:http_flv_module 支援flv
模組:http_mp4_module 支援mp4
下載地址:
1、安裝依賴包:
#yum -y install gcc glibc glibc-devel make nasm pkgconfig lib-devel openssl-devel expat-devel gettext-devel libtool mhash.x86_64 perl-Digest-SHA1.x86_64
2、安裝相關工具包
1). git
# mkdir soft-source
# cd soft-source
# wget
# xz -d git-latest.tar.xz
# tar xzvf git-latest.tar
# cd git-2014-06-27
# autoconf
# ./configure
# make && make install
# git --version
git version 2.0.0.GIT
# cd ..
2). zlib
# wget
# tar -zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8
# ./configure
# make
# make install
# cd ..
3). pcre
# wget
# tar zxvf pcre-8.12.tar.gz
# cd pcre-8.12
# ./configure
# make && make install
# cd ..
4). yadmi
yadmi的作用是為flv檔案新增關鍵幀,才能實現拖動播放
# wget
# tar xzvf yamdi-1.4.tar.gz
# cd yamdi-1.4
# make && make install
# cd ..
使用方法:
# yamdi -i input.flv -o out.flv
給input.flv檔案 新增關鍵幀,輸出為out.flv檔案
5). OpenSSL
# wget
# tar -zxvf openssl-1.0.1c.tar.gz
# ./config
# make
# make install
3、安裝ffmpeg及其依賴包:
1). Yasm
# wget
# tar xzvf yasm-1.2.0.tar.gz
# cd yasm-1.2.0
# ./configure
# make
# make install
# cd ..
2). x264
# git clone git://git.videolan.org/x264
# cd x264
# ./configure --enable-shared
# make
# make install
# cd ..
3). LAME
# wget
# tar xzvf lame-3.99.5.tar.gz
# cd lame-3.99.5
#./configure --enable-nasm
# make
# make install
# cd ..
4). libogg
# wget
# tar xzvf libogg-1.3.0.tar.gz
# cd libogg-1.3.0
# ./configure
# make
# make install
# cd ..
5). libvorbis
# wget
# tar xzvf libvorbis-1.3.3.tar.gz
# cd libvorbis-1.3.3
# ./configure
# make
# make install
# cd ..
6). libvpx
# git clone
# cd libvpx
# ./configure --enable-shared
# make
# make install
# cd ..
7). FAAD2
# wget
# tar zxvf faad2-2.7.tar.gz
# cd faad2-2.7
# ./configure
# make
# make install
# cd ..
8). FAAC
# wget
# tar zxvf faac-1.28.tar.gz
# cd faac-1.28
# ./configure
# make
# make install
# cd ..
9). Xvid
# wget
# tar zxvf xvidcore-1.3.2.tar.gz
# cd xvidcore/build/generic
# ./configure
# make
# make install
# cd ..
10). ffmpeg
# git clone git://source.ffmpeg.org/ffmpeg
# cd ffmpeg
# ./configure --prefix=/opt/ffmpeg/ --enable-version3
--enable-libvpx --enable-libfaac --enable-libmp3lame
--enable-libvorbis --enable-libx264 --enable-libxvid
--enable-shared --enable-gpl --enable-postproc --enable-nonfree
--enable-avfilter --enable-pthreads
# make && make install
# cd ..
修改/etc/ld.so.conf如下:
include ld.so.conf.d/*.conf
/lib
/lib64
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/opt/ffmpeg/lib
# ldconfig
二、安裝Nginx相關模組
1. 模組安裝
# wget
# tar zxvf nginx_mod_h264_streaming-2.2.7.tar.gz
# git clone git://github.com/arut/nginx-rtmp-module.git
2. 建立使用者和組
# groupadd www
# useradd -g www www
3. nginx安裝
# wget /download/nginx-1.6.0.tar.gz
# tar zxvf nginx-1.6.0.tar.gz
# cd nginx-1.6.0
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/196700/viewspace-2125811/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 1.RTMP流媒體伺服器搭建伺服器
- 影片直播原始碼開發中的流媒體協議:rtmp協議原始碼協議
- 基於SRS搭建RTMP直播流媒體伺服器伺服器
- 使用Nginx搭建流媒體伺服器Nginx伺服器
- Ubuntu 中使用 Nginx+rtmp 搭建流媒體直播服務.mdUbuntuNginx
- HTTP HSTS協議和 nginxHTTP協議Nginx
- 輕鬆讓你的nginx伺服器支援HTTP2協議Nginx伺服器HTTP協議
- MAC 上編譯安裝nginx-rtmp-module 流媒體伺服器Mac編譯Nginx伺服器
- Golang開源流媒體伺服器(RTMP/RTSP/HLS/FLV等協議)Golang伺服器協議
- 通過 wireshark 抓包瞭解直播流媒體 RTMP 協議基本過程協議
- Ubuntu 中使用 Nginx+rtmp 模組搭建流媒體視訊點播服務UbuntuNginx
- 淺析 HLS 流媒體協議協議
- 認識流媒體協議,從 RTSP 協議解析開始!協議
- 海康私有化影片平臺EasyCVR影片分析裝置平臺流媒體協議RTMP、HTTP-FLV、HLS的簡單對比VR協議HTTP
- ffmpeg 推流檔案,採用rtmp協議協議
- 流媒體傳輸協議之 RTP(下篇)協議
- 流媒體傳輸協議之 RTP (上篇)協議
- iOS開發 - Mac下搭建基於rtmp協議的ngnix本地伺服器iOSMac協議伺服器
- 用RUST寫流媒體伺服器實戰——rtmp chunk 深入解析Rust伺服器
- nginx配置支援websocket協議wssNginxWeb協議
- Nginx-RTMP推流(audio)Nginx
- Nginx-RTMP推流(video)NginxIDE
- nginx 轉發 rtmp 直播流Nginx
- 直播協議詳解 RTMP、HLS、HTTP-FLV、WebRTC、RTSP協議HTTPWeb
- HTTP協議和HTTPS協議的異同點?HTTP協議
- HTTP和HTTPS協議HTTP協議
- RPC和 HTTP協議RPCHTTP協議
- 用RUST寫流媒體伺服器實戰——rtmp chunk 踩坑記錄Rust伺服器
- 【開源專案】向Nginx-RTMP伺服器推流Nginx伺服器
- Go Module 支援 HTTP 協議的私有庫方案GoHTTP協議
- HTTP協議之:HTTP/1.1和HTTP/2HTTP協議
- WEB伺服器之HTTP協議Web伺服器HTTP協議
- HTTP協議和MQTT協議對比誰更好HTTP協議MQQT
- RTMP協議相關知識協議
- 支援Http3和Quic協議的Netty孵化器版本釋出HTTPUI協議Netty
- 02 前端HTTP協議(圖解HTTP) 之 簡單的HTTP協議前端HTTP協議圖解
- day122:MoFang:OSSRS流媒體直播伺服器&基於APICloud的acLive直播推流模組實現RTMP直播推流伺服器APICloud
- 如何實現IIS 7.0對非HTTP協議的支援HTTP協議
- NGINX如何實現rtmp推流服務Nginx