1 综合篇 点我
2 uboot移植 点我
3 uboot lcd驱动 点我
4 kernel移植 点我
5 kernel lcd驱动 点我
6 摄像头驱动 点我
7 ubuntu base移植 点我
8 挂载网络文件系统 点我
9 qt移植 点我
10 搭建qt交叉编译 点我
11 wifi移植 点我
12 搭建nginx + rtmp服务器 点我

常见的视频监控和视频直播就是使用 RTMP 和 RTSP 流媒体协议等。
RTSP (Real-Time Stream Protocol)由 Real Networks 和 Netscape 共同提出的,基于文本的多媒体播放控制协议。 RTSP 定义流格式,流数据经由 RTP 传输; RTSP 实时效果非常好,适合视频聊天,视频监控等方向。
RTMP(Real Time Message Protocol) 由 Adobe 公司提出,用来解决多媒体数据传输流的
多路复用(Multiplexing)和分包(packetizing)的问题,优势在于低延迟,稳定性高,支持所有摄像头格式,浏览器加载 flash 插件就可以直接播放。
RTSP 和 RTMP 的区别:
RTSP 虽然实时性最好,但是实现复杂,适合视频聊天和视频监控; RTMP 强在浏览器支持好,加载 flash 插件后就能直接播放,所以非常火,相反在浏览器里播放 rtsp 就很困难了。
本文使用RTMP的方式实现视屏监控

1 准备工作

  1. 下载nginx源码:wget http://nginx.org/download/nginx-1.20.2.tar.gz
  2. 下载依赖库libpcre.a源码:wget http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.39.tar.gz
  3. 下载依赖库libz.a源码: wget https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz
  4. 下载rtmp模块源码:GitHub - arut/nginx-rtmp-module: NGINX-based Media Streaming Server
    前三个库源码下载完成后,都进行解压。

2 编译

pcre库和libz库都不用单独编译,在编译nginx时添加模块时一起编译。

2.1 编译nginx-1.20.2

进入nginx-1.20.2

song@song-machine:/home/work/third-party$ cd nginx-1.20.2/

创建安装目录

sudo mkdir arm-nginx

配置

./configure --with-cc=arm-linux-gnueabihf-gcc --with-cpp=arm-linux-gnueabihf-g++ --prefix=/opt/arm-nginx --add-module=/home/work/third-party/nginx-rtmp-module-master --with-http_ssl_module --with-debug --with-pcre=/home/work/third-party/pcre-8.39 --with-zlib=/home/work/third-party/zlib-1.2.11 --with-openssl=/home/work/third-party/openssl-1.1.1d --without-http_upstream_zone_module --without-stream_upstream_zone_module// --prefix=/opt/arm-nginx  指定安装目录,最后install时生成的程序放在这个目录下,要和开发存放的路径相同
// --add-module=/home/work/third-party/nginx-rtmp-module-master  编译rtmp模块,这个目录是上面下载源码后解压的目录
// --with-pcre=/home/work/third-party/pcre-8.39 编译pcre模块,这个目录是上面下载源码后解压的目录
// --with-zlib=/home/work/third-party/zlib-1.2.11 编译zlib模块,这个目录是上面下载源码后解压的目录
// --with-openssl=/home/work/third-party/openssl-1.1.1d 编译opessl模块


解决办法:

gedit auto/cc/name

ngx_feature_run=yes

改为

ngx_feature_run=no

重新执行

./configure --with-cc=arm-linux-gnueabihf-gcc --with-cpp=arm-linux-gnueabihf-g++ --prefix=/opt/arm-nginx --add-module=/home/work/third-party/nginx-rtmp-module-master --with-http_ssl_module --with-debug --with-pcre=/home/work/third-party/pcre-8.39 --with-zlib=/home/work/third-party/zlib-1.2.11 --with-openssl=/home/work/third-party/openssl-1.1.1d --without-http_upstream_zone_module --without-stream_upstream_zone_module


解决办法:

gedit auto/types/sizeof

(1)ngx_test="$CC 改为 ngx_test="gcc

(2)ngx_size=$NGX_AUTOTEST 改为 ngx_size=4

重新执行

./configure --with-cc=arm-linux-gnueabihf-gcc --with-cpp=arm-linux-gnueabihf-g++ --prefix=/opt/arm-nginx --add-module=/home/work/third-party/nginx-rtmp-module-master --with-http_ssl_module --with-debug --with-pcre=/home/work/third-party/pcre-8.39 --with-zlib=/home/work/third-party/zlib-1.2.11 --with-openssl=/home/work/third-party/openssl-1.1.1d --without-http_upstream_zone_module --without-stream_upstream_zone_module

编译

sudo make


解决办法:
打开options

gedit auto/options

PCRE_CONF_OPT

修改为

PCRE_CONF_OPT=--host=arm-linux-gnueabihf-gcc //修改为自己的工具链

报错

解决办法:

gedit auto/lib/openssl/make

&& ./config --prefix=$ngx_prefix no-shared no-threads $OPENSSL_OPT

改为

&& ./Configure --prefix=$ngx_prefix no-shared no-threads --cross-compile-prefix=arm-linux-gnueabihf- linux-generic32 \\

注意将./config改为./Configure

gedit objs/ngx_auto_config.h
添加

#ifndef NGX_HAVE_SYSVSHM
#define NGX_HAVE_SYSVSHM 1
#endif

安装

sudo make build

安装结果

3 拷贝到armlinux的网络文件系统中

sudo cp /opt/arm-nginx/ ../../imx6ull/rootfs/ubuntu-base-armhf/opt/ -r

将nginx添加到环境变量中

vim /etc/profile

添加

export PATH=$PATH:/opt/arm-nginx/sbin

重新加载环境变量

source /etc/profile

4 运行nginx

直接执行nginx命令

查看本地ip

可以看到开发板wifi的ip是192.168.0.100
在win10 浏览器输入192.168.0.100:80
出现下面结果代表移植成功

5 添加rtmp配置

将下面内容添加到/opt/arm-nginx/conf/nginx.conf中

rtmp {server {listen 1935;chunk_size 4000;  application live {live on;}}
}

armlinux 搭建nginx + rtmp服务器相关推荐

  1. linux 搭建nginx + rtmp服务器

    linux 搭建nginx + rtmp服务器 一  环境准备 虚拟机ubuntu 装备,安装一些nginx 必要的依赖和服务 sudo apt-get install libpcre3 libpcr ...

  2. 树莓派搭建nginx+rtmp服务器

    树莓派搭建nginx+rtmp服务器 http://bbs.eeworld.com.cn/thread-506444-1-1.html 1.安装依赖包 sudo apt-get install bui ...

  3. Ubuntu18.04搭建nginx rtmp服务器

    1.前言 系统:ubuntu18.04 安装所需要软件下载地址: https://download.csdn.net/download/u010798513/22847289 2. 安装prce 安装 ...

  4. Windows上搭建Nginx RTMP服务器并使用FFmpeg实现本地视频推流

    场景 RTMP RTMP协议 (1)是流媒体协议. (2)RTMP协议是 Adobe 的私有协议,未完全公开. (3)RTMP协议一般传输的是 flv,f4v 格式流. (4)RTMP一般在 TCP ...

  5. Mac使用nginx+rtmp服务器

    一.安装Homebrow 已经安装了brow的可以直接跳过这一步. 执行命令 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/ ...

  6. 阿里云服务器搭建Nginx+rtmp推流服务器

    title: 阿里云服务器搭建Nginx+rtmp推流服务器 categories:[Centos] tags:[音视频编程] date: 2021/11/16 一.前期准备 服务器操作系统:Cent ...

  7. 宝塔 搭建 nginx rtmp 流媒体服务器

    宝塔 搭建 nginx rtmp 流媒体服务器 安装环境说明 系统环境: Centos 7 机型: DELL R540 准备工作 nginx 添加模块,编译安装 nginx ,下载 nginx-rtm ...

  8. 怎么配置搭建Nginx网站服务器

    centos系统中怎么配置搭建Nginx网站服务器针对这个问题,今天小编总结这篇有关Nginx配置的文章,可供感兴趣的小伙伴们参考借鉴,希望对大家有所帮助.  一 .Nginx服务基础Nginx (e ...

  9. 【图片服务器】搭建Nginx图片服务器

    一.安装Nginx 二.安装vsftpd 三.开始搭建Nginx图片服务器 1.效果 例如:图片通过ftp服务上传到/home/ftpuser/www/images目录下,我想通过访问Nginx服务器 ...

最新文章

  1. 无法上外网, ping网关ping不通的解决——arp命令
  2. GDLiveStreaming视频推送RTMP
  3. webpack安装和配置
  4. mogilefsd同步速度调优
  5. .计算机自动关机或重启,电脑自动关机或者重启怎么处理
  6. .net5+nacos+ocelot 配置中心和服务发现实现
  7. spring一站式开发_Spring开发人员知道的一件事
  8. 简述get 和 post 的主要区别——计算机网络
  9. aws lambda_Express.js和AWS Lambda —无服务器的爱情故事
  10. 精通android学习笔记(一)---广播
  11. 最小方差问题---------------给你出道题
  12. Raki的读paper小记:RoBERTa: A Robustly Optimized BERT Pretraining Approach
  13. 接口压测之Locust
  14. div html表格样式,table 表格 div + css 样式
  15. 高精度定位网络PAS的经济模式_RTK基站网络共享奖励模式
  16. eureka 缺点
  17. java 字符串4%3e=3,gson 生成的json字符串带\u003c,\u003d,\u003e的解决方案
  18. 守望轮回谷等待服务器响应,《守望轮回谷》即将接班自走棋?Dota2新地图再次掀起热潮...
  19. 拼写错误python能正常启动吗_拼写检查
  20. 常用面试问题50问(转载)及回答技巧

热门文章

  1. 【jquery】jquery-icheck radio的点击事件、change事件、获取当前选中的值
  2. Bootstrap的iCheck插件checkbox和radio
  3. find和findstr区别
  4. 公共信息模型(CIM)
  5. js整数向上取整(自定义取整几位)
  6. TypeError: XXX is read-only
  7. 微信群,组队学习打卡
  8. 字体大宝库:12款好看的手写艺术字体免费下载
  9. 内核spinlock raw_spin_lock spin_lock_bh
  10. Mongoose使用操作