nginx安装、视频频服务器-windows

编译安装nginx

1、安装perl

安装地址: https://strawberryperl.com,选择msi安装程序即可

2、安装sed for windows

下载地址:https://sourceforge.net/projects/gnuwin32/files/sed/,执行安装程序结束后,将安装包bin目录配置到环境变量下

3、安装visual studio 2022 community版

4、从https://github.com/nginx/nginx下载1.26.1版源码,在源码中新建目录objs\lib

下载nginx-http-flv-module:https://github.com/winshining/nginx-http-flv-module (1.2.10版)

下载pcre: https://github.com/PCRE2Project/pcre2/tags (10.2.39版)

下载zlib: https://github.com/madler/zlib (1.3.1版)

下载openssl:https://www.openssl.org/source/index.html (3.0.13版)

将nginx-http-flv-module、openssl、pcre、zlib拷贝到该目录中并解压

5、查看nginx编译参数

下载nginx-1.26.1已经编译完成的版本,执行 nginx.exe -V,得到如下结果:

configure arguments: --with-cc=cl --builddir=objs.msvc8 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre2-10.39 --with-zlib=objs.msvc8/lib/zlib-1.3.1 --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-stream_realip_module --with-stream_ssl_preread_module --with-openssl=objs.msvc8/lib/openssl-3.0.13 --with-openssl-opt='no-asm no-tests -D_WIN32_WINNT=0x0501' --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module

修改部分参数:

--with-pcre=objs/lib/pcre2-10.39 --with-zlib=objs/lib/zlib-1.3.1 --with-openssl=objs/lib/openssl-3.0.13 --add-module=objs/lib/nginx-http-flv-module-1.2.10

7、configure

运行MSYS2或者MINGW64,进入nginx源码nginx-release-1.26.1中,执行命令:

auto/configure --with-cc=cl --builddir=objs.msvc8 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-stream_realip_module --with-stream_ssl_preread_module --with-openssl-opt='no-asm no-tests -D_WIN32_WINNT=0x0501' --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module --with-pcre=objs/lib/pcre2-10.39 --with-zlib=objs/lib/zlib-1.3.1 --with-openssl=objs/lib/openssl-3.0.13 --add-module=objs/lib/nginx-http-flv-module-1.2.10

修改objs.msvc8/Makefile,修改第三行:

CFLAGS =  -O2  -W4 -WX -nologo -MT -Zi -Fdobjs.msvc8/nginx.pdb -DFD_SETSIZE=1024 -DNO_SYS_TYPES_H

去掉-WX,加上-MP

CFLAGS =  -O2  -W4 -MP -nologo -MT -Zi -Fdobjs.msvc8/nginx.pdb -DFD_SETSIZE=1024 -DNO_SYS_TYPES_H

8、编译
打开Developer Command Prompt for VS 2022,进入nginx源码目录,输入命令:nmake,回车

编译时间需要10-30分钟,结束后,在objs.msvc8下的nginx.exe复制到nginx源码目录下。

新建目录logs、temp、html。

9、安装ffmpeg

下载安装,并将ffmpeg的bin目录设置为环境变量

配置nginx

修改conf/nginx.conf

worker_processes 1;events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;sendfile on;keepalive_timeout 65;server {listen 8553;server_name localhost;location / {root html;index index.html index.htm;}location /live {flv_live on;chunked_transfer_encoding on;add_header 'Access-Control-Allow-Origin' '*';add_header 'Access-Control-Allow-Credentials' 'true';add_header 'Access-Control-Allow-Methods' '*';}location /hls {add_header 'Access-Control-Allow-Origin' '*';types {application/vnd.apple.mpegurl m3u8;video/mp2t ts;}alias /test;expires -1;}location /stat {rtmp_stat all;rtmp_stat_stylesheet stat.xsl;}location /stat.xsl {root /usr/local/nginx/nginx-http-flv-module;}}
}rtmp {server {listen 1938; #nginx监听的rtmp推流/拉流端口application myapp {live on; #当推流时,rtmp路径中的app(rtmp中的一个概念)匹配myapp时,开始直播meta off;gop_cache on;allow play all;record off;hls on;hls_path /test;hls_fragment 1s;}}
}

ffmpeg推流(海康摄像头)

ffmpeg -i rtsp://用户名:密码@ip:554/H.264/ch1/main/av_stream -c:v libx264 -an -f
flv rtmp://127.0.0.1:1938/myapp/main

测试

flv.html

<html>
<head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"><title>flv.js demo</title><style>.mainContainer {display: block;width: 1024px;margin-left: auto;margin-right: auto;}.urlInput {display: block;width: 100%;margin-left: auto;margin-right: auto;margin-top: 8px;margin-bottom: 8px;}.centeredVideo {display: block;width: 100%;height: 576px;margin-left: auto;margin-right: auto;margin-bottom: auto;}.controls {display: block;width: 100%;text-align: center;margin-left: auto;margin-right: auto;}</style>
</head><body><p class="mainContainer"><video name="videoElement" id="videoElement" class="centeredVideo" controls muted autoplay width="1024"height="576">Your browser is too old which doesn't support HTML5 video.</video>
</p><script src="flv.min.js"></script><script>function start() {if (flvjs.isSupported()) {var videoElement = document.getElementById('videoElement');var flvPlayer = flvjs.createPlayer({type: 'flv',url: 'http://ip:8553/live?port=1938&app=myapp&stream=main'});flvPlayer.attachMediaElement(videoElement);flvPlayer.load();flvPlayer.play();}}document.addEventListener('DOMContentLoaded', function () {start();});
</script>
</body></html>

flv.min.js 下载地址: http://flv.jnyzh.cn/flv.min.js

效果如下:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://xiahunao.cn/news/3226564.html

如若内容造成侵权/违法违规/事实不符,请联系瞎胡闹网进行投诉反馈,一经查实,立即删除!

相关文章

hutool ScriptUtil Script for [js] not support !

导入一个旧项目&#xff0c;发现项目中ScriptUtil 报错 检查后发现jdk没有配置—_—!!!&#xff0c;用的是idea默认的jdk&#xff0c;换回jdk1.8就可以了 查阅资料后Java 8中引入的Nashorn JavaScript引擎在Java 9中被移除了。Nashorn是一个基于JVM的轻量级JavaScript引擎&…

KNIME 5.2.5 版本界面切换

1、安装完KNIME后&#xff0c;点击“Create workflow in your local space.” 2、发现是这个样子 4、进行切换。点击“menu”&#xff0c;最后点击“Switch to classic user interfaceto” 5、最终显示结果&#xff1a;

小公司是如何染上大公司病的

小公司&#xff0c;顾名思义就是小&#xff0c;船小好调头。​本应该是最具拼搏精神和灵活性的小公司却不幸染上了大公司病。创业难&#xff0c;守业更难&#xff0c;这些小公司是如何染上大公司病的&#xff1f; 一、管理过度 某公司规定&#xff0c;员工出差&#xff0c;到…

Qt基础控件总结—多页面切换(QStackWidget类、QTabBar类和QTabWidget类)

QStackedWidget 类 QStackedWidget 类是在 QStackedLayout 之上构造的一个便利的部件,其使用方法与步骤和 QStackedLayout 是一样的。QStackedWidget 类的成员函数与 QStackedLayout 类也基本上是一致的,使用该类就和使用 QStackedLayout 一样。 使用该类可以参考QStackedL…

论文学习——基于双重变异的动态多目标优化进化算法,具有不可检测的变化

论文题目&#xff1a;A Dual Mutation Based Evolutionary Algorithm for Dynamic Multi-Objective Optimization with Undetectable Changes 基于双重变异的动态多目标优化进化算法&#xff0c;具有不可检测的变化&#xff08;Yuanchao Liu, Lixin Tang, Fellow, IEEE, Jinli…

Multi-Concept Customization of Text-to-Image Diffusion # 论文阅读

URL https://arxiv.org/pdf/2212.04488 TL;DR 2022 年 12 月 CMU 清华 adobe 的文章。提出一种基于几张图片做 ip 保持的方法&#xff0c;可以支持多个 ip 出现的同一张图片里面。 Model & Method 框架整体如下图。训练数据除了特定的角色和场景&#xff0c;还额外…

基于Android平台开发,购物商城

1. 项目功能思维导图 2. 项目涉及到的技术点 使用SQLite数据库实现数据存储使用CountDownTimer实现启动页倒计时使用SharedPreferences实现记住密码登录使用BottomNavigationView实现底部导航栏使用ActivityFragment实现底部导航栏页面之间切换使用RecyclerViewadapter实现商品…

仕考网:非应届生可以参加公务员考试吗?

往届生有资格参加国家公务员考试。根据《公务员录用规定》&#xff0c;只要满足一系列资格条件&#xff0c;就符合报考资格。 1、年龄在18到35岁之间。 2、具备良好的品德&#xff0c;身体健康且心理素质稳定&#xff0c;拥有拟任职位所需的工作能力。 3、至少为大学专科以上…

提示词工程(Prompt Engineering)是什么?

一、定义 Prompt Engineering 提示词工程&#xff08;Prompt Engineering&#xff09;是一项通过优化提示词&#xff08;Prompt&#xff09;和生成策略&#xff0c;从而获得更好的模型返回结果的工程技术。 二、System message 系统指令 System message可以被广泛应用在&am…

【聚星文社】Ai小说推文一键生成工具功能预览极速版:一键出图、一键改文、一键关键帧、MJ+SD推文神器

功能预览极速版&#xff1a; 【三连】【关注】即可免费激活软件哦&#xff01; 自动生成精彩推文&#xff1a;使用AI技术&#xff0c;一键生成精彩的小说推文&#xff0c;吸引读者的注意力。快速裁剪段落&#xff1a;根据输入的小说文本&#xff0c;快速裁剪出最精彩的段落&am…

Quartus快速绑定引脚

0.准备工作 首先在工程文件夹下创建pin文件夹&#xff0c;将生成的引脚文件保存在该文件夹下。 生成 .csv文件和 .tcl文件&#xff1a; &#xff08;1&#xff09;Pin Planner&#xff08;引脚分配器&#xff09; &#xff08;2&#xff09;File&#xff08;文件&#xff09…

Ubuntu20.04系统非root用户安装GAMIT10.71

&#xff08;测试环境&#xff1a;20240701升级包和20240701数据&#xff0c;解算通过&#xff09; QQ:8212714 群&#xff1a;302883438群文件&#xff08;source安装包20240701升级包&#xff09; 1、首先在计算机中安装VMware Workstation 16 Pro。建议&#xff1a;分配…

纯CSS瀑布流

<!DOCTYPE html> <html lang"en"> <head> <meta charset"UTF-8"> <meta name"viewport" content"widthdevice-width, initial-scale1.0"> <title>瀑布流布局</title> <style>/* 瀑布…

迅狐矩阵系统:一键式剪辑神器,引领矩阵运营新潮流!

在数字化浪潮汹涌的当下&#xff0c;视频内容已经成为人们获取信息、娱乐休闲的重要方式。然而&#xff0c;面对海量的视频素材和日益增长的用户需求&#xff0c;如何高效、高质量地剪辑和分发视频内容&#xff0c;成为了摆在众多内容创作者和运营团队面前的难题。幸运的是&…

【Excel】3D技术人员相见恨晚的使用技巧大全

本期作者&#xff1a;尼克 易知微3D引擎技术负责人 在项目开发或者3D创作的过程中&#xff0c;我们经常会用到Excel&#xff0c;也处理、应对了许多随之产生的突发状况&#xff0c;我把他们记录下来&#xff0c;希望能帮到更多技术人员&#xff0c;以便大家在遇到难题时&#…

昇思学习打卡-11-SSD目标检测

文章目录 模型介绍模型的特点数据采样网络结构损失函数公式实现 NMS训练过程 模型介绍 SSD是单阶段的目标检测算法&#xff0c;通过卷积神经网络进行特征提取&#xff0c;取不同的特征层进行检测输出&#xff0c;所以SSD是一种多尺度的检测方法。在需要检测的特征层&#xff0…

SQL Server 用户应当如何防范 Mallox (.hmallox) 勒索软件袭击

勒索软件领域的特点是随着时间的流逝&#xff0c;参与者群体和恶意软件家族都会大量流失&#xff0c;只有少数参与者表现出相对长寿的寿命。曾经令人担忧的威胁&#xff0c;如 REvil 和 Conti&#xff0c;要么被铲除&#xff0c;要么被解散&#xff0c;而其他威胁——例如 ALPH…

SpringBoot使用RedisTemplate、StringRedisTemplate操作Redis

前言 本文实现了在SpringBoot中集成Redis&#xff0c;使用RedisTemplate对象操作并编写了一些常用方法的工具类。 RedisTemplate和StringRedisTemplate的区别&#xff1a; 1. 两者的关系是StringRedisTemplate继承RedisTemplate。 // // Source code recreated from a .cl…

电脑突然出现“由于找不到msvcp140.dll”要怎么处理?教你科学的msvcp140.dll修复方法

电脑出现由于找不到msvcp140.dll的程序故障&#xff0c;请不要紧张&#xff0c;要解决这个问题还是比较简单的&#xff0c;当然前提是你要了解msvcp140.dll这个文件&#xff0c;只有了解了你解决起这个msvcp140.dll才会更简单&#xff01;下面我们一起来聊聊找不到msvcp140.dll…

springboot定制化书籍销售系统-计算机毕业设计源码71193

摘要 随着电子商务的快速发展和图书市场的不断变革&#xff0c;定制化书籍销售系统的需求日益凸显。本文介绍了一种基于SpringBoot框架的定制化书籍销售系统的设计与实现。该系统旨在满足用户对于个性化、专业化的书籍需求&#xff0c;为用户提供高效、便捷的定制化购书体验。 …