# RV1126RemoteMonitoring **Repository Path**: shunzi20220/RV1126RemoteMonitoring ## Basic Information - **Project Name**: RV1126RemoteMonitoring - **Description**: rv1126远程拉流解码,CGI作为中间桥梁,在web页面上显示监控画面 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-01-04 - **Last Updated**: 2025-02-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CGI远程监控 ### 安装BOA服务 boa下载:http://www.boa.org ```sh sudo apt-get install bison flex tar –zxvf boa-0.94.13.tar.gz ``` 修改src/compat.h,改成: ```C #ifdef HAVE_TM_GMTOFF #define TIMEZONE_OFFSET(foo) foo->tm_gmtoff #else #define TIMEZONE_OFFSET(foo) timezone #endif #ifdef HAVE_TM_ZONE #define TIMEZONE(foo) foo->tm_zone #else #define TIMEZONE(foo) *tzname #endif ``` 修改,src/log.c,改成: ```C /*if (dup2(error_log, STDERR_FILENO) == -1) { DIE("unable to dup2 the error log"); }*/ ``` 修改,src/boa.c,改成: ```c /*if (passwdbuf == NULL) { DIE("getpwuid"); } if (initgroups(passwdbuf->pw_name, passwdbuf->pw_gid) == -1) { DIE("initgroups"); }*/ if (setgid(server_gid) == -1) { DIE("setgid"); } if (setuid(server_uid) == -1) { DIE("setuid"); } /* test for failed-but-return-was-successful setuid * http://www.securityportal.com/list-archive/bugtraq/2000/Jun/0101.html */ /*if (setuid(0) != -1) { DIE("icky Linux kernel bug!"); }*/ ``` 修改src/defines.h ,改成: ```c //修改传输文件的大小限制,默认1MB修改为16MB #define SINGLE_POST_LIMIT_DEFAULT 1024 * 1024 *16/* 16 MB */ //修改配置文件路径 #ifndef SERVER_ROOT #define SERVER_ROOT "/demo/bin/boa" #endif ``` ```makefile ./configure # 改Makefile,设置编译器路径 CC = /opt/atk-dlrv1126-toolchain/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc CPP = /opt/atk-dlrv1126-toolchain/prebuilts/gcc/linux-x86/arm/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -E make #拷贝所需文件到boa文件夹 cd .. mkdir -p ./boa ./boa/www ./boa/cgi-bin ./boa/log cp boa.conf ./boa cp src/boa ./boa cp src/boa_indexer ./boa cp /etc/mime.types ./boa ``` 把boa文件夹打包放到`src/defines.h`定义的路径下,改下boa.conf, 已经把注释去掉 ```makefile Port 88 User 0 Group 0 ErrorLog /demo/bin/boa/log/error_log AccessLog /demo/bin/boa/log/access_log DocumentRoot /demo/bin/boa/www UserDir public_html DirectoryIndex index.html DirectoryMaker /demo/bin/boa/boa_indexer KeepAliveMax 1000 KeepAliveTimeout 10 MimeTypes /demo/bin/boa/mime.types DefaultType text/plain CGIPath /bin:/usr/bin:/usr/local/bin Alias /doc /usr/doc ScriptAlias /cgi-bin/ /demo/bin/boa/cgi-bin/ ``` 小试牛刀,新建 `index.html`,放到 `/demo/bin/boa/www` ```html CGI login
name:
password:
true:
``` 运行demo ```sh cd /demo/bin/boa chmod 777 * ./boa ``` 打开网址 `http://192.168.1.105:88/`, boa安装成功了 ### 参考资料 https://www.cnblogs.com/kn-zheng/p/17125569.html https://blog.csdn.net/a1981613393/article/details/139240537 https://blog.csdn.net/m0_56145255/article/details/124562136 ### 远程监控 推流h264, 板子ip: 192.168.1.105,宽高要设置为16的整数倍 ```sh # 对视频缩放 ffmpeg -i video.mp4 -vf scale=640:480 video480P.mp4 ffmpeg -re -i video480P.mp4 -c:v libx264 -preset veryfast -maxrate 3000k -bufsize 6000k -pix_fmt yuv420p -g 30 -f h264 "udp://192.168.1.105:8080" ffmpeg -f v4l2 -i /dev/video0 -vcodec libx264 -tune zerolatency -pix_fmt nv12 -g 30 -f h264 udp://192.168.1.105:8080 # ffmpeg支持的视频编码格式 ffmpeg -hide_banner -pix_fmts ``` 目录说明: * push_stream: 用ffmpeg 推送摄像头视频流程序 * vdec_program:rv1126拉流解码程序 建立进程间通信需要先创建共享的路径 ```sh /msg_file_vdec /etc/semfile /etc/video_share_vdec /etc/video_share_param ``` 目标跟踪算法,识别时间:72ms/次 * cgic_program: CGI中间件程序 * html_file:html页面 ![112952](112952.png)