当前位置: 首页>后端>正文

vlc取nginx rtmp流速度慢 nginx rtmp延迟

• 遇到的问题

  5). OpenSSL 

 

  # wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz 

 

  # tar -zxvf openssl-1.0.1c.tar.gz 

 

  # ./config 

 

  # make 

 

  # make install 

 
 
 
 

  make[1]: 离开目录“/root/nginx/openssl-1.0.1c/tools” 

 

  installing man1/asn1parse.1 

 

  installing man1/CA.pl.1 

 

  installing man1/ca.1 

 

  installing man1/ciphers.1 

 

  installing man1/cms.1 

 

  cms.pod around line 457: Expected text after =item, not a number 

 

  cms.pod around line 461: Expected text after =item, not a number 

 

  cms.pod around line 465: Expected text after =item, not a number 

 

  cms.pod around line 470: Expected text after =item, not a number 

 

  cms.pod around line 474: Expected text after =item, not a number 

 
POD document had syntax errors at /usr/bin/pod2man line 69.
 
make: *** [install_docs] 错误 1
 
 
 
 
[root@localhost openssl-1.0.1c]# 
 
由于版本太低导致
 
wget http://www.openssl.org/source/openssl-1.0.1u.tar.gz
 
 
 
 
 
 
 
 

 
• 遇到的问题
 
 
 

  6). libvpx 

 

  # git clone http://git.chromium.org/webm/libvpx.git 

 

  # cd libvpx 

 

  # ./configure  --enable-shared 

 

  # make 

 

  # make install 

 

  # cd .. 

 

  [root@localhost nginx]# git clone http://git.chromium^Crg/webm/libvpx.git 

 

  [root@localhost nginx]# git clone http://git.chromium.org/webm/libvpx.git 

 

  正克隆到 'libvpx'... 

 
fatal: unable to access 'http://git.chromium.org/webm/libvpx.git/': Failed to connect to 2404:6800:4008:c01::52: Network is unreachable
 
 
 
 
[root@localhost nginx]# git clone https://github.com/webmproject/libvpx.git
 
正克隆到 'libvpx'...
 
remote: Counting objects: 132976, done.
 
remote: Compressing objects: 100% (683/683), done.
 
remote: Total 132976 (delta 479), reused 8 (delta 8), pack-reused 132285
 
接收对象中: 100% (132976/132976), 54.26 MiB | 95.00 KiB/s, done.
 
处理 delta 中: 100% (108325/108325), done.
 
[root@localhost nginx]# 
 
 
 
 

  [DOXYGEN] doxyfile 

 

  [root@localhost libvpx]# make install 

 

  [INSTALL] /usr/local/include/vpx/vp8.h 

 

  [INSTALL] /usr/local/include/vpx/vp8cx.h 

 

  [INSTALL] /usr/local/include/vpx/vp8dx.h 

 

  [INSTALL] /usr/local/include/vpx/vpx_codec.h 

 

  [INSTALL] /usr/local/include/vpx/vpx_frame_buffer.h 

 

  [INSTALL] /usr/local/include/vpx/vpx_image.h 

 

  [INSTALL] /usr/local/include/vpx/vpx_integer.h 

 

  [INSTALL] /usr/local/include/vpx/vpx_decoder.h 

 

  [INSTALL] /usr/local/include/vpx/vpx_encoder.h 

 

  [INSTALL] /usr/local/lib/libvpx.a 

 

  [LN] libvpx.so.4.0.0 /usr/local/lib/libvpx.so 

 

  [LN] libvpx.so.4.0.0 /usr/local/lib/libvpx.so.4 

 

  [LN] libvpx.so.4.0.0 /usr/local/lib/libvpx.so.4.0 

 

  [INSTALL] /usr/local/lib/libvpx.so.4.0.0 

 

  [INSTALL] /usr/local/lib/pkgconfig/vpx.pc 

 

  [INSTALL] /usr/local/bin/vpxdec 

 

  [INSTALL] /usr/local/bin/vpxenc 

 
make[1]: 对“install”无需做任何事。
 
make[1]: 对“install”无需做任何事。
 

  [root@localhost libvpx]# 

 
 
 
 
• 遇到的问题,已解决

  8). FAAC 

 

  # wget http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.gz 

 

  # tar zxvf faac-1.28.tar.gz 

 

  # cd faac-1.28 

 

  # ./configure 

 

  # make 

 

  # make install 

 

  # cd .. 

 
 
 
 

  In file included from mp4common.h:29:0, 

 

  from 3gp.cpp:28: 

 
mpeg4ip.h:126:58: 错误:对‘char* strcasestr(const char*, const char*)’的新声明
 
char *strcasestr(const char *haystack, const char *needle);
 
^
 
In file included from mpeg4ip.h:107:0,
 
from mp4common.h:29,
 
from 3gp.cpp:28:
 
/usr/include/string.h:365:26: 错误:使旧的声明‘const char* strcasestr(const char*, const char*)’出现歧义
 
extern "C++" const char *strcasestr (const char *__haystack,
 
^
 
make[3]: *** [3gp.o] 错误 1
 

  make[3]: 离开目录“/root/nginx/faac-1.28/common/mp4v2” 

 

  make[2]: *** [all-recursive] 错误 1 

 

  make[2]: 离开目录“/root/nginx/faac-1.28/common” 

 

  make[1]: *** [all-recursive] 错误 1 

 

  make[1]: 离开目录“/root/nginx/faac-1.28” 

 

  make: *** [all] 错误 2 

 
 
 
 

  [root@localhost faac-1.28]# vim ./common/mp4v2/mpeg4ip.h 

 
 
 
 

  修改前: 

 

  #ifdef __cplusplus 

 
extern "C" {
 

  #endif 

 
char *strcasestr(const char *haystack, const char *needle);
 

  #ifdef __cplusplus 

 

  } 

 

  #endif 

 

    

 

  修改后: 

 
#ifdef __cplusplus
 
extern "C++" {
 
#endif
 
const char *strcasestr(const char *haystack, const char *needle);
 
#ifdef __cplusplus
 
}
 
#endif
 
• 遇到的问题

  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 .. 

 

  [root@localhost nginx]# git clone git://source.ffmpeg.org/ffmpeg 

 

  正克隆到 'ffmpeg'... 

 

  remote: Counting objects: 489762, done. 

 

  remote: Compressing objects: 100% (106844/106844), done. 

 
fatal: read error: Connection reset by peer | 17.00 KiB/s 
 
fatal: 过早的文件结束符(EOF)
 
fatal: index-pack failed
 
[root@localhost nginx]# 
 
 
 
 
[root@localhost nginx]# git clone https://github.com/FFmpeg/FFmpeg.git
 
正克隆到 'FFmpeg'...
 
remote: Counting objects: 489762, done.
 
remote: Compressing objects: 100% (34/34), done.
 
remote: Total 489762 (delta 8), reused 0 (delta 0), pack-reused 489728
 
接收对象中: 100% (489762/489762), 163.01 MiB | 156.00 KiB/s, done.
 
处理 delta 中: 100% (382545/382545), done.
 
[root@localhost nginx]# 
 
或自己下载一个放到上面去
 
 
 
 

  [root@localhost FFmpeg-master]# ./configure --prefix=/opt/ffmpeg/ --enable-version3 --enable-libvpx --extra-libs=-lfaac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads 

 
提示缺少 --enable-libfaac时(已解决):
 

  修改/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
 
 
 
 

  [root@localhost FFmpeg-master]# ./configure --prefix=/opt/ffmpeg/ --enable-version3 --enable-libvpx --extra-libs=-lfaac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads 

 
ERROR: libmp3lame >= 3.98.3 not found
 
 
 
 

  If you think configure made a mistake, make sure you are using the latest 

 

  version from Git. If the latest version fails, report the problem to the 

 

  ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net. 

 

  Include the log file "config.log" produced by configure as this will help 

 
 
 
 
: wget  
 http://kakola.googlecode.com/files/lame-3.98.4.tar.gz 
 (google需要翻墙)
 
wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
 
 lame-3.98.4.tar.gz
 
 lame-3.98.4
 

  # ./configure 

 

  # make 

 

  # make install 

 

  # cd .. 

 
         
 
WARNING: using libx264 without pkg-config
 

  libavcodec/bsf_list.c is unchanged 

 

  libavformat/protocol_list.c is unchanged 

 

  License: nonfree and unredistributable 

 

  Creating config.mak, config.h, and doc/config.texi... 

 

  libavutil/avconfig.h is unchanged 

 

  [root@localhost FFmpeg-master]# 

 
 
 
 
 
 
 

  2. 创建用户和组 

 

  # groupadd www 

 

  # useradd -g www www 

 
 
 
 
[root@localhost nginx]# groupadd wwww
 
[root@localhost nginx]# useradd -g www www
 
useradd:“www”组不存在
 
[root@localhost nginx]# useradd -g www www
 
useradd:“www”组不存在
 
[root@localhost nginx]# groupadd www
 
[root@localhost nginx]# useradd -g www www
 
[root@localhost nginx]# 
 

  [root@localhost nginx]# useradd -g www www 

 

  useradd:用户“www”已存在 

 
 
 
 
 
 
 

  4.编译安装nginx 

 

  在nginx-1.6.0目录下新建文件:nginx_configure.sh 

 
如果没有gedit,可以用vim
 
 
 
 

  # chmod +x nginx_configure.sh 

 

  # ./nginx_configure.sh 

 

  # make 

 

  # make install 

 
 
 
 
POD document had syntax errors at /usr/bin/pod2man line 69.
 
make[2]: *** [install_docs] 错误 1
 
make[2]: 离开目录“/root/nginx/openssl-1.0.1c”
 
make[1]: *** [../openssl-1.0.1c/.openssl/include/openssl/ssl.h] 错误 2
 
make[1]: 离开目录“/root/nginx/nginx-1.6.0”
 
make: *** [build] 错误 2
 
 
 
 
rm /usr/bin/pod2man
 
 
 
 
 
 
 
In file included from ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_h264_streaming_module.c:2:0:
 
../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c: 在函数‘ngx_streaming_handler’中:
 
../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c:158:8: 错误:‘ngx_http_request_t’没有名为‘zero_in_uri’的成员
 
if (r->zero_in_uri)
 
 
 
 

  [root@localhost nginx-1.6.0]# vim ../nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c 

 

  [root@localhost nginx-1.6.0]# 

 
那么将src/ngx_http_streaming_module.c文件中以下代码删除或者是注释掉就可以了:
 
/* TODO: Win32 */
 
if (r->zero_in_uri)
 
{
 
return NGX_DECLINED;
 
}
 
 
 
 
 
 
 
 
 
 
1.
 

  安装好了之后终端进入 nginx安装的目录 : /usr/local/nginx/html/ 

 

  然后新建目录:nginx-rtmp-module 

 

  然后拷贝 之前用于存放下载 nginx 所需资源包的目录 :/root/nginx/nginx-rtmp-module/ 

 

  拷贝 目录 test 到/usr/local/nginx/html/ 目录下: 

 
 cp /root/nginx-rtmp-module/test /usr/local/nginx/html/nginx-rtmp-module/
 
 cp /root/nginx-rtmp-module/stat.xsl /usr/local/nginx/html/nginx-rtmp-module/
 
 
 
 
[root@localhost nginx-rtmp-module]# cp /root/nginx/nginx-rtmp-module/test/ /usr/local/nginx/html/nginx-rtmp-module/
 
cp: 略过目录"/root/nginx/nginx-rtmp-module/test/"
 
 
 
 
[root@localhost nginx-rtmp-module]# cp -r /root/nginx/nginx-rtmp-module/test/ /usr/local/nginx/html/nginx-rtmp-module/
 
[root@localhost nginx-rtmp-module]# ls
 
stat.xsl test
 
 
 
 
四、启动Nginx相关模块
 
1.
 

  配置好之后就可以开启nginx服务器了。 

 

  可以在终端执行: 

 
service nginx start
 
注:可能会出现一下错误:
 
nginx: unrecognized service
 

  解决方法: 

 

  下载nginx的启动脚本: 

 
# wget -O init-deb.sh  
 http://library.linode.com/assets/660-init-deb.sh 

 

  将脚本添加到init.d目录和生成可执行: 

 
# sudo mv init-deb.sh /etc/init.d/nginx
 
# sudo chmod +x /etc/init.d/nginx
 

  加的nginx到系统启动: 

 
# sudo /usr/sbin/update-rc.d -f nginx defaults //没有update-rc.d 这个文件,没有加到系统启动,但是还可以手动执行
 
 
 
 

  现在我们可以使用nginx的控制: 

 
sudo service nginx stop 
 
sudo service nginx start 
 
sudo service nginx restart
 
sudo service nginx reload
 
 
 
 
推 ffmpeg -re -i 1.flv -f flv rtmp://192.168.1.96/live/stream
 
播 ffplay rtmp://192.168.1.96/live/stream
 
 
 
 
 
 
 
可以推不同地址,然后不同的播放
 
ffmpeg -re -i 1.flv -f flv rtmp://192.168.1.96/live/st
 
ffplay rtmp://192.168.1.96/live/st

https://www.xamrdz.com/backend/3vs1961555.html

相关文章: