2022年nginx搭建rtmp协议流媒体服务器总结 .pdf
《2022年nginx搭建rtmp协议流媒体服务器总结 .pdf》由会员分享,可在线阅读,更多相关《2022年nginx搭建rtmp协议流媒体服务器总结 .pdf(10页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、nginx 搭建 rtmp 协议流媒体服务器总结最近在ubuntu12.04 上搭建了一个rtmp 服务器,感觉还挺麻烦的,所以记录下。大部分都是参考网络上的资料。前提:在 linux 下某个目录中新建一个nginx 目录。然后进入该目录去下载搭建环境所需要的一些资源包。此处在/root/ 目录下新建一个nginx 目录即:/root/nginx/ = 1、安装依赖包 : #yum -y install gcc glibc glibc-devel make nasm pkgconfig lib-devel openssl-devel expat-devel gettext-devel libt
2、ool mhash.x86_64 perl-Digest-SHA1.x86_64 2、安装相关工具包1). git # mkdir soft-source # cd soft-source # wget :/codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.xz # xz -d git-latest.tar.xz # tar xzvf git-latest.tar # cd git-2014-06-27 # autoconf # ./configure # make & make install # git -version
3、 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 :/exim.mirror.fr/pcre/pcre-8.12.tar.gz # tar zxvf pcre-8.12.tar.gz # cd pcre-8.12 # ./configure # make & make install # cd . 4). yadmi yadmi 的作用是为fl
4、v 文件添加关键帧,才能实现拖动播放# wget :/ # tar xzvf download # cd yamdi-1.4 # make & make install # cd . 使用方法:# yamdi -i input.flv -o out.flv 给 input.flv 文件添加关键帧,输出为out.flv 文件5). OpenSSL # wget :/.openssl.org/source/openssl-1.0.1c.tar.gz # tar -zxvf openssl-1.0.1c.tar.gz # ./config # make # make install 3、安装 ffm
5、peg 及其依赖包:1). Yasm # wget :/ # tar xzvf yasm-1.2.0.tar.gz 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 10 页 - - - - - - - - - # cd yasm-1.2.0 # ./configure # make # make install # cd . 2). x264 # git clone git:/git.videolan.org/x264 # cd x264 # ./configure -e
6、nable-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 :/downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz # tar xzvf libogg-1.3.0.tar.gz # cd libogg-1.3.0 # ./configure #
7、make # make install # cd . 5). libvorbis # wget :/downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz # tar xzvf libvorbis-1.3.3.tar.gz # cd libvorbis-1.3.3 # ./configure # make # make install # cd . 6). libvpx # git clone :/git.chromium.org/webm/libvpx.git # cd libvpx # ./configure -enable-sh
8、ared # 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、- - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 10 页 - - - - - - - - - mpeg4ip.h:126: error: new declar ation char* strcasestr(const char*, const char*)解决方法:从 123 行开始修改此文件mpeg4ip.h,到 129 行结束。修改前:#ifdef _cplusplus extern C #endif char *strcasestr(const char *haystack, const char *needle); #ifdef _cplusp
10、lus #endif 修改后:#ifdef _cplusplus extern C+ #endif const char *strcasestr(const char *haystack, const char *needle); #ifdef _cplusplus #endif 9). Xvid # wget :/downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz # tar zxvf xvidcore-1.3.2.tar.gz # cd xvidcore/build/generic # ./configure # make # make i
11、nstall # 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-
12、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 :/h264.code- # tar zxvf nginx_mod_h264_streaming-2.2.7.tar.gz # git clone
13、 git:/ 2. 创建用户和组# groupadd # useradd -g 3. nginx 安装# wget :/nginx.org/download/nginx-1.6.0.tar.gz # tar zxvf nginx-1.6.0.tar.gz # cd nginx-1.6.0 4.编译安装nginx 在 nginx-1.6.0 目录下新建文件:nginx_configure.sh 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 10 页 - - - - - -
14、 - - - 然后使用gedit 打开进行编辑:#!/bin/sh echo configure start . ./configure -prefix=/usr/local/nginx -sbin-path=/usr/local/nginx/nginx -conf-path=/usr/local/nginx/nginx.conf -pid-path=/usr/local/nginx/nginx.pid -error-log-path=/usr/local/nginx/logs/error.log -add-module=./nginx_mod_h264_streaming-2.2.7 -wi
15、th-pcre=./pcre-8.12 -with-zlib=./zlib-1.2.8 -with-_dav_module -with-_flv_module -with-_stub_status_module -without-_scgi_module -without-_uwsgi_module -without-_gzip_module -without-_ssi_module -without-_proxy_module -without-_memcached_module -without-_empty_gif_module -without-mail_pop3_module -wi
16、thout-mail_imap_module -without-mail_smtp_module -with-_ssl_module -with-openssl=./openssl-1.0.1c -add-module=./nginx-rtmp-module -with-cc-opt=-I/opt/ffmpeg/include -with-ld-opt=-L/opt/ffmpeg/lib -Wl, -rpath=/opt/ffmpeg/lib echo configure end! 【保存并退出】# chmod +x nginx_configure.sh # ./nginx_configure
17、.sh # make # make install 备注:在执行 make 的时候可能出现错误1:adding module in ./nginx_mod_h264_streaming-2.2.7 + ngx_h264_streaming_module was configured adding module in ./nginx-rtmp-module + ngx_rtmp_module was configured checking for OpenSSL library . not found ./configure: error: SSL modules require the Ope
18、nSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using -with-openssl= option. configure end! rootubuntu:/home/song/nginx-t/nginx-1.6.0# make make: * No rule to make target bui
19、ld, needed by default. Stop. 解决方法:a)可以安装ssl apt-get install openssl apt-get install libssl-dev b)也可以添加-with-openssl= 在执行 make 的时候可能出现错误2:/root/nginx_mod_h264_streaming-2.2.7/src/ngx_streaming_module.c: In function ngx_streaming_handler:/root/nginx_mod_h264_streaming-2.2.7/src/ngx_streaming_module.c:
20、158: error: ngx_request_t has no member named zero_in_urimake1: * objs/addon/src/ngx_h264_streaming_module.o Error 1 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 10 页 - - - - - - - - - make1: Leaving directory /root/nginx-0.8.54 make: * build Error 2 解决方法:那么将
21、 src/ngx_streaming_module.c 文件中以下代码删除或者是注释掉就可以了:/* TODO: Win32 */ if (r-zero_in_uri) return NGX_DECLINED; 在执行 make 的时候可能出现错误3:./nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c: 在函数 esds_read 中: ./nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:377:16: 错误:变量 stream_priority被设定但未被使用-Werror=unused-but-
22、set-variable ./nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:376:12: 错误:变量 stream_id被设定但未被使用-Werror=unused-but-set-variable ./nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c: 在函数 stsd_parse_vide中: ./nginx_mod_h264_streaming-2.2.7/src/mp4_reader.c:529:22: 错误:变量 level_indication被设定但未被使用-Werror=unuse
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年nginx搭建rtmp协议流媒体服务器总结 2022 nginx 搭建 rtmp 协议 流媒体 服务器 总结
限制150内