当前位置: 首页 > news >正文

[直播推流] 本地创建 nginx服务器

需要将 nginx 安装在纯英文的路径,不然会报错
需要将 nginx 安装在纯英文的路径,不然会报错
需要将 nginx 安装在纯英文的路径,不然会报错
类似这个报错

[emerg] 11240#2204: CreateFile() “F:\迅雷下载\nginx\nginx/conf/nginx.conf” failed (1113: No mapping for the Unicode character exists in the target multi-byte code page)

环境搭建

参考这个文档
https://blog.csdn.net/stalin_/article/details/128968989

我下载之后本地没有 nginx.conf 文件,自己直接新建一个就行。
启动 nginx 可以使用

 start nginx.exe

本地配置好的文件:有需要可以直接下载,或者私聊我。
https://download.csdn.net/download/dss875914213/91008307

本地测试

可以使用 ffmpeg 测试
推流

ffmpeg -f dshow -video_size 1280x720 -framerate 30 -i video="Integrated Camera" -c:v libx264 -preset ultrafast -tune zerolatency -f flv rtmp://localhost:1935/live/stream_key

拉流

ffplay rtmp://localhost/live/stream_key

其他

nginx.conf 配置可以用这个,在将 nginx-rtmp-module 目录下的 stat.xsl 拷贝到 html 目录下

#user  nobody;
# multiple workers works !
worker_processes  2;#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {worker_connections  8192;# max value 32768, nginx recycling connections+registry optimization = #   this.value * 20 = max concurrent connections currently tested with one worker#   C1000K should be possible depending there is enough ram/cpu power# multi_accept on;
}rtmp {server {listen 1935;#监听端口,若被占用,可以更改chunk_size 4000;#上传flv文件块儿的大小application live { #创建一个叫live的应用live on;#开启live的应用allow publish 127.0.0.1;#allow play all;}}
}
http {server {listen 8080;location /stat {rtmp_stat all;# Use this stylesheet to view XML as web page# in browserrtmp_stat_stylesheet /stat.xsl;}location /stat.xsl {# XML stylesheet to view RTMP stats.# Copy stat.xsl wherever you want# and put the full directory path hereroot html;}}
}

这样就可以在 localhost:8080/stat 查看服务器当前的状态了
在这里插入图片描述

相关文章:

  • Spring AI Chat Tool Calling 指南
  • 微博项目(总体搭建)
  • 区间合并:区间合并问题
  • Deep Research Agent的深度与广度如何保证
  • 文件同步·使用同步软件来管理文件(外接大脑)
  • Seata的Undo Log存储机制是什么?
  • 网络代理设置
  • 模型 追蛇效应
  • 【Vue】v-model进阶+ref+nextTick
  • 基于springboot+servlet、jsp的潮服购物商城系统的设计与实现,论文7000字
  • 【Dv3Admin】系统视图API白名单配置文件解析
  • Python 继承的优缺点(处理多重继承)
  • 达梦的三权分立安全机制
  • 微信小程序实现文字逐行动画效果渲染显示
  • 快速入门:创建 Azure 数据资源管理器群集和数据库
  • golang字符串拼接
  • pytest的装饰器`pytest.mark.parametrize` 和 `@pytest.mark.smoke`区别
  • 【C++】模拟实现map和set
  • JNDI注入入门
  • 互联网大厂Java求职面试:AI大模型应用实践中的架构挑战与实战
  • 做外贸业务去哪些网站/不死鸟分享友情链接
  • 网站服务器搭建的步骤/上海有哪些优化网站推广公司
  • wordpress开发的网站/西安seo管理
  • 开发微信微网站建设/seo优化工具推荐
  • 做家旅游的视频网站/360竞价推广开户多少钱
  • 中山最好的网站建设公司哪家好/上海百度推广客服电话多少