nginx rtmp http_flv直播推流
安装配置nginx
yum install epel-release -y
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
yum install ffmpeg ffmpeg-devel -y
yum install gcc -y
yum install pcre pcre-devel -y
yum install openssl openssl-devel -y
yum install wget -y
mkdir -p /opt/sort/
cd /opt/soft/
wget -c http://nginx.org/download/nginx-1.25.0.tar.gz
tar -xf nginx-1.25.0.tar.gz
git clone https://github.com/winshining/nginx-http-flv-module.git
mkdir -p /usr/local/nginx
mv nginx-http-flv-module /usr/local/nginx/cd /opt/soft/nginx-1.25.0
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_secure_link_module --add-module=/usr/local/nginx/nginx-http-flv-module
make
make installcd /usr/local/nginx/conf/
mkdir -p vhosts
配置
[root@localhost conf]# cat nginx.conf|grep -ivE ‘#|$| #’
worker_processes 1;
error_log logs/error.log warn;events {worker_connections 1024;use epoll;multi_accept on;
}include flv.conf;
http {include mime.types;default_type application/octet-stream;server_names_hash_bucket_size 128;client_header_buffer_size 32k;large_client_header_buffers 4 32k;client_max_body_size 50m;log_format nginx_json '{ "time": "$time_local", ''"remote_ip": "$remote_addr", ''"remote_user": "$remote_user", ''"domain":"$host", ''"responsetime":$request_time, ''"request": "$request", ''"response": "$status", ''"bytes": $body_bytes_sent, ''"referrer": "$http_referer", ''"upstreamtime":"$upstream_response_time", ''"upstreamaddr":"$upstream_addr", ''"x_forwarded_for":"$http_x_forwarded_for", ''"agent": "$http_user_agent" }';access_log logs/access.log nginx_json;sendfile on;tcp_nopush on;server_tokens off;keepalive_timeout 65;gzip on;gzip_min_length 1k;gzip_buffers 4 16k;gzip_http_version 1.0;gzip_comp_level 2;gzip_types text/plain application/x-javascript text/css application/xml;gzip_vary on;client_header_timeout 10;client_body_timeout 10;client_body_buffer_size 10K;proxy_buffering off;reset_timedout_connection on;send_timeout 10;charset utf-8;server {listen 80;server_name localhost;location / {root html;index index.html index.htm;}error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}location /live {flv_live on;chunked_transfer_encoding on; #支持'Transfer-Encoding: chunked'方式回复add_header 'Access-Control-Allow-Origin' '*'; #添加额外的HTTP头add_header 'Access-Control-Allow-Credentials' 'true'; #添加额外的HTTP头}location /flv {flv_live on;chunked_transfer_encoding on;add_header 'Access-Control-Allow-Origin' '*';add_header 'Access-Control-Allow-Credentials' 'true'; #添加额外的HTTP头}location /stat {#推流播放和录制统计数据的配置rtmp_stat all;rtmp_stat_stylesheet stat.xsl;}location /stat.xsl {root html; #指定 stat.xsl 的位置}}
}
[root@localhost conf]# cat flv.conf |grep -vE ‘^$’
rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp_socket_dir /tmp;
rtmp {out_queue 4096;out_cork 8;max_streams 128;timeout 15s;drop_idle_publisher 15s;log_interval 5s; #interval used by log module to log in access.log, it is very useful for debuglog_size 1m; #buffer size used by log module to log in access.logserver {listen 1935;application live {live on; #开启直播record off; #可以把转完码的视频放在这个文件里,这样可以拉这个视频进行播放#play /opt/video;# 允许从任何源push流allow publish all;# 允许从任何地方来播放流allow play all;# 20秒内没有push,就断开链接。drop_idle_publisher 20s;##打开 GOP 缓存,减少首屏等待时间gop_cache on; }}
}
启动
[root@localhost conf]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost conf]#
[root@localhost conf]# /usr/local/nginx/sbin/nginx
[root@localhost conf]# netstat -tnlp|grep nginx
tcp 0 0 0.0.0.0:1935 0.0.0.0:* LISTEN 36990/nginx: master
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 36990/nginx: master
注册服务
[root@localhost conf]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost conf]#
[root@localhost conf]# /usr/local/nginx/sbin/nginx
[root@localhost conf]# netstat -tnlp|grep nginx
tcp 0 0 0.0.0.0:1935 0.0.0.0:* LISTEN 36990/nginx: master
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 36990/nginx: master vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx - web server
After=network.target remote-fs.target nss-lookup.target[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
ExecQuit=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true[Install]
WantedBy=multi-user.targetsystemctl daemon-reload
测试 - 推流
[root@localhost src]# ffmpeg -re -i 33335e4ffdce4f1f918bbde54b363a73.mp4 -c copy -f flv rtmp://192.168.1.60:1935/live/test
ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developersbuilt with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetectlibavutil 54. 31.100 / 54. 31.100libavcodec 56. 60.100 / 56. 60.100libavformat 56. 40.101 / 56. 40.101libavdevice 56. 4.100 / 56. 4.100libavfilter 5. 40.101 / 5. 40.101libavresample 2. 1. 0 / 2. 1. 0libswscale 3. 1.101 / 3. 1.101libswresample 1. 2.101 / 1. 2.101libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '33335e4ffdce4f1f918bbde54b363a73.mp4':Metadata:major_brand : mp42minor_version : 1compatible_brands: isommp41mp42creation_time : 2022-12-06 09:44:01copyright : copyright-eng : Duration: 00:00:16.93, start: 0.047891, bitrate: 494 kb/sStream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280, 447 kb/s, 25.56 fps, 29.83 tbr, 600 tbn, 1200 tbc (default)Metadata:creation_time : 2022-12-06 09:44:01handler_name : Core Media VideoStream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 41 kb/s (default)Metadata:creation_time : 2022-12-06 09:44:01handler_name : Core Media Audio
[flv @ 0x2268de0] Codec for stream 0 does not use global headers but container format requires global headers
[flv @ 0x2268de0] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, flv, to 'rtmp://192.168.1.60:1935/live/test':Metadata:major_brand : mp42minor_version : 1compatible_brands: isommp41mp42copyright-eng : copyright : encoder : Lavf56.40.101Stream #0:0(und): Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 720x1280, q=2-31, 447 kb/s, 25.56 fps, 29.83 tbr, 1k tbn, 600 tbc (default)Metadata:creation_time : 2022-12-06 09:44:01handler_name : Core Media VideoStream #0:1(und): Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, mono, 41 kb/s (default)Metadata:creation_time : 2022-12-06 09:44:01handler_name : Core Media Audio
Stream mapping:Stream #0:0 -> #0:0 (copy)Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[flv @ 0x2268de0] Failed to update header with correct duration.ate= 496.6kbits/s
[flv @ 0x2268de0] Failed to update header with correct filesize.
frame= 432 fps= 25 q=-1.0 Lsize= 1031kB time=00:00:16.99 bitrate= 496.7kbits/s
video:923kB audio:86kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.089851%
[root@localhost src]# echo $?
0
-----------------end
相关文章:
nginx rtmp http_flv直播推流
安装配置nginx yum install epel-release -y sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm yum install ffmpeg ffmpeg-devel -y yum install gcc -y yum install pcre pcre-devel -y yum install openssl open…...
Day50 算法记录| 动态规划 17(子序列)
这里写目录标题 647. 回文子串516.最长回文子序列总结 647. 回文子串 1.动态规划和2.中心扩展 这个视频是基于上面的视频的代码 方法1:动态规划 布尔类型的dp[i][j]:表示区间范围[i,j] (注意是左闭右闭)的子串是否是回文子串,如…...
RabbitMQ:概念和安装,简单模式,工作,发布确认,交换机,死信队列,延迟队列,发布确认高级,其它知识,集群
1. 消息队列 1.0 课程介绍 1.1.MQ 的相关概念 1.1.1.什么是MQ MQ(message queue:消息队列),从字面意思上看,本质是个队列,FIFO 先入先出,只不过队列中存放的内容是message 而已,还是一种跨进程的通信机制…...
小研究 - 基于解析树的 Java Web 灰盒模糊测试(二)
由于 Java Web 应用业务场景复杂, 且对输入数据的结构有效性要求较高, 现有的测试方法和工具在测试Java Web 时存在测试用例的有效率较低的问题. 为了解决上述问题, 本文提出了基于解析树的 Java Web 应用灰盒模糊测试方法. 首先为 Java Web 应用程序的输入数据包进行语法建模创…...
对于现有的分布式id发号器的思考 id生成器 雪花算法 uuid
在工作过程中接触了很多id生成策略,但是有一些问题 雪花id 强依赖时钟,对于时钟回拨无法很好解决 tinyid 滴滴开源,依赖mysql数据库,自增,无业务属性 uuid 生成是一个字符串没有顺序,数据库索引组织数据…...
jmeter中json提取器,获取多个值,并通过beanshell组成数组
jmeter中json提取器介绍 特别说明:**Compute concatenation var(suffix_ALL)😗*如果找到许多结果,则插件将使用’ , 分隔符将它们连接起来,并将其存储在名为 _ALL的var中 json提取器调试 在查看结果树中选择JSON Pat…...
通过nvm工具快捷切换node.js版本、以及nvm的安装
使用nvm可以实现多个Node.js版本之间切换 步骤目录: 先卸载掉本系统中原有的node版本 去github上下载nvm安装包 安装node 常用的一些nvm命令 1、先卸载掉本系统中原有的node版本 2、去github上下载nvm安装包 https://github.com/coreybutler/nvm-windows/re…...
企业如何搭建矩阵内容,才能真正实现目的?
当下,新媒体矩阵营销已成为众多企业的营销选择之一,各企业可以通过新媒体矩阵实现扩大品牌声量、维持用户关系、提高销售业绩等不同的目的。 而不同目的的矩阵,它的内容运营模式会稍有差别,评价体系也会大不相同。 企业在运营某类…...
Arduino驱动MQ5模拟煤气气体传感器(气体传感器篇)
目录 1、传感器特性 2、硬件原理图 3、驱动程序 MQ5气体传感器,可以很灵敏的检测到空气中的液化气、天然气、煤气等气体,与Arduino结合使用,可以制作火灾液化气、天然气、煤气泄露报警等相关的作品。 1、传感器特性 MQ5用于消费和工业行业中气体泄漏检测设备,该传感器适…...
Mongodb安装(Centos7)
1. 下载 MongoDB: The Developer Data Platform | MongoDB 2. 安装 上传至服务器 解压 tar -zxvf mongodb-linux-x86_64-rhel70-5.0.19.tgz 移动 mv mongodb-linux-x86_64-rhel70-5.0.19 /usr/local/mongodb 3. 配置 vim /etc/profile # set mongodb configuration expor…...
Python 批量处理JSON文件,替换某个值
Python 批量处理JSON文件,替换某个值 直接上代码,替换key TranCode的值 New 为 Update。输出 cancel忽略 import json import os import iopath D:\\Asics\\850\\202307 # old path2 D:\\test2 # new dirs os.listdir(path) num_flag 0 for file…...
凯迪正大—SF6泄漏报警装置的主要特点
SF6泄漏报警系统主要特点 ① 系统采用声速原理,可定量、实时在线测量SF6泄漏气体含量,克服了传统测量方法如负电晕放电法和卤素传感器法只能定性判别是否越限的缺陷,能够准确得到气体中SF6含量。 ② 系统采用双差分处理方法,有效…...
适配器模式与装饰器模式对比分析:优雅解决软件设计中的复杂性
适配器模式与装饰器模式对比分析:优雅解决软件设计中的复杂性 在软件设计中,我们常常面临着需要将不同接口或类协调工作的情况,同时还要满足灵活性和可扩展性的需求。为了应对这些挑战,适配器模式和装饰器模式应运而生,…...
idea使用protobuf
本文参考:https://blog.csdn.net/m0_37695902/article/details/129438549 再次感谢分享 什么是 protobuf ? Protocal Buffers(简称protobuf)是谷歌的一项技术,用于结构化的数据序列化、反序列化。 由于protobuf是跨语言的,所以用…...
【深度学习_TensorFlow】误差函数
写在前面 搭建完网络层后,在每层网络中都要进行前向计算,下一步就是选择合适的误差函数来计算误差。其中均方差函数和交叉熵函数在深度学习中比较常见,均方差函数主要用于回归问题,交叉熵函数主要用于分类问题。 写在中间 均方差…...
mysql按照日期分组统计数据
目录 前言按天统计按周统计按月统计按年统计date_format参数 前言 mysql的date_format函数想必大家都使用过吧,一般用于日期时间转化 # 例如 select DATE_FORMAT(2023-01-01 08:30:50,%Y-%m-%d %H:%i:%s) # 可以得出 2023-01-01 08:30:50# 或者是 select DATE_FOR…...
19 | 分类模型评估指标
文章目录 Python分类模型评估指标准确率(Accuracy)精确率(Precision)召回率(Recall)F1值(F1 Score)混淆矩阵(Confusion Matrix)ROC曲线和AUC值1. 准备数据集2. 初始化并训练逻辑回归模型3. 获取预测概率并计算ROC曲线和AUC值4. 绘制ROC曲线5. 整合代码结论Python分类…...
【Pycharm2022.2.1】python编辑器最新版安装教程(包含2017-2022的所有版本win/mac/linux)
前言 嗨喽~大家好呀,这里是魔王呐 ❤ ~! 永久安装 Pycharm(2017-2022的win/mac/linux所有版本)/ IntelliJ IDEA也可以, 按照本文教程所写的,具体步骤跟着下面的图文教程一步一步来就行,一分钟即可搞定,过…...
深度学习-相关概念
Adam优化器 Adam,Adaptive Moment Estimation,自适应矩估计。是2014年提出的一种万金油式的优化器,使用起来非常方便,梯度下降速度快,但是容易在最优值附近震荡。竞赛中性能会略逊于SGD,毕竟最简单的才是最…...
眼科医生推荐的台灯 护眼台灯买什么好?
我家孩子需要一个护眼灯,就请教了我的一个医生朋友。大家都知道医生白天对着电脑长时间的工作,晚上还要看书,查文献,写论文,选一个对眼睛友好的高质量护眼台灯对他们是刚需,同时又是医生,所以他…...
科研党福音:用Python+NoteExpress搞定Pubmed文献批量下载(附避坑指南)
科研效率革命:PythonNoteExpress自动化文献下载全攻略 在科研工作中,文献收集是最基础却最耗时的环节之一。想象一下,当你从PubMed检索出200篇相关文献,却要手动逐一点击下载,这种重复劳动不仅消磨时间,更消…...
前端可视化方案
前端可视化方案:数据之美触手可及 在当今数据驱动的时代,前端可视化已成为连接用户与复杂数据的桥梁。无论是企业级的数据看板,还是个人项目中的动态图表,优秀的前端可视化方案能让枯燥的数据变得生动直观。通过JavaScript生态中…...
7种Prompt优化技巧实现大模型输出精度提升
在大模型应用落地的过程中,很多使用者会遇到输出质量不稳定的问题:明明输入了需求,却得到偏离主题、逻辑混乱或不符合格式的结果。这背后的核心原因往往不是模型能力不足,而是提示词(Prompt)的设计没有精准…...
GLM-4.1V-9B-Base赋能运维:AI智能日志分析与故障预警系统构建
GLM-4.1V-9B-Base赋能运维:AI智能日志分析与故障预警系统构建 1. 运维场景的痛点与机遇 在传统IT运维工作中,工程师们每天需要面对海量的服务器日志和监控数据。这些数据通常以两种形式存在:一种是纯文本格式的日志文件,另一种是…...
基于File-Based App开发MVP项目员
Issue 概述 先来看看提交这个 Issue 的作者是为什么想到这个点子的,以及他初步的核心设计概念。?? 本 PR 实现了 Apache Gravitino 与 SeaTunnel 的集成,将其作为非关系型连接器的外部元数据服务。通过 Gravitino 的 REST API 自动获取表结构和元数据&…...
拆穿名词诈骗!用大白话理解晦涩难懂的AI概念谒
1. 架构背景与演进动力 1.1 从单体到碎片化:.NET 的开源征程 在.NET Framework 时代,构建系统主要围绕 Windows 操作系统紧密集成,采用传统的封闭式开发模式。然而,随着.NET Core 的推出,微软开启了彻底的开源与跨平台…...
ADS1220_WE库详解:工业级24位ADC驱动与高精度传感器采集实现
1. ADS1220_WE 库深度技术解析:面向工业级高精度采集的 24 位四通道 ADC 驱动实现1.1 芯片级定位与工程价值ADS1220 是德州仪器(TI)推出的低功耗、高精度、24 位 Δ-Σ 型模数转换器,专为工业传感器信号调理场景设计。其核心价值不…...
【紧急预警】传统音视频微服务架构将在2026Q3大规模失效——SITS2026原生处理标准已强制嵌入工信部信创目录
第一章:SITS2026分享:AI原生音视频处理 2026奇点智能技术大会(https://ml-summit.org) AI原生音视频处理正从“AI辅助”迈向“AI驱动”的范式跃迁——模型不再仅作为后处理模块嵌入传统管线,而是从采集、编码、传输到渲染的全链路深度重构。…...
分享 种 .NET 桌面应用程序自动更新解决方案檀
一、Actor 模型:不是并发技巧,而是领域单元 Actor 模型的本质是: Actor 是独立运行的实体 Actor 之间只通过消息交互 Actor 内部状态不可被外部直接访问 Actor 自行决定如何处理收到的消息 Actor 模型真正解决的是: 如何在不共享状…...
把近万个源文件喂给AI之前,我先做了一件事耙
插件化架构 v3 版本最大的变化是引入了模块化插件系统。此前版本中集成在核心包里的原生功能,现在被拆分成独立的插件。 每个插件都是一个独立的 Composer 包,包含 Swift 和 Kotlin 代码、权限清单以及原生依赖。开发者只需安装实际用到的插件࿰…...
