怎么在 Linux 下运行 smart_rtmpd
怎么在 Linux 下运行 smart_rtmpd
操作系统的准备
我们知道比较流行的 Linux 操作系统基本上分为两类,一类是以 Redhat 为基线的 Redhat, CentOS;另一类是 Debian 为基线的 Debian,Ubuntu。当然现在还有一些新兴势力 Arch Linux,但大家都是基于 Linux 内核进行封装运作的。主要表现是包管理器不同,面向的用户场景不同,有的往桌面方面发展,有的往嵌入式方向发展。这些系统大家可以根据自己的喜好进行选择,本文不做过多阐述,差异不大。建议大家采用操作系统最新版本,这样系统性能更好,功能更强大,兼容性更好,性能也是最佳。
smart_rtmpd 服务器软件的准备
软件的下载
访问 https://github.com/superconvert/smart_rtmpd , 下载 https://github.com/superconvert/smart_rtmpd/blob/master/rtmpd.zip 或 https://github.com/superconvert/smart_rtmpd/releases
访问 https://gitee.com/superconvert/smart_rtmpd , 下载 https://gitee.com/superconvert/smart_rtmpd/blob/master/rtmpd.zip软件包的介绍
下载的软件包 rtmpd.zip 里面包含不同平台的安装运行包smart_rtmpd.coroutines.centos7.7.1908.x64.tar.gz CentOS 系统的协程版本 (x64)
smart_rtmpd.multithread.centos7.7.1908.x64.tar.gz CentOS 系统的多线程版本 (x64) --- 推荐
smart_rtmpd.coroutines.ubuntu16.04LTS.x64.tar.gz Ubuntu 系统的协程版本 (x64)
smart_rtmpd.multithread.ubuntu16.04LTS.x64.tar.gz Ubuntu 系统的多线程版本 (x64)
smart_rtmpd.multithread.generic.aarch64.tar.gz ARM-v8 架构的多线程版本 (arm)
软件包的准备
我们下载 rtmpd.zip 后进行解压,把 smart_rtmpd.multithread.centos7.7.1908.x64.tar.gz 上传到我们的 Linux 操作系统内,进行解压[root@localhost ~]# mkdir smart_rtmpd
[root@localhost ~]# tar zxvf smart_rtmpd.multithread.centos7.7.1908.x64.tar.gz -C smart_rtmpd
[root@localhost ~]# cd smart_rtmpd
[root@localhost smart_rtmpd]# ls -alh
total 8.0M
drwxr-xr-x. 3 root root 167 Aug 15 05:34 .
drwxr-xr-x. 4 root root 28 Aug 15 05:34 ..
-rw-r--r--. 1 root root 9.7K Aug 14 18:12 config.xml
-rw-r--r--. 1 root root 378 Jul 23 12:24 gb28181.xml
drwxr-xr-x. 4 root root 100 Aug 15 03:43 html
-rw-r--r--. 1 root root 234 Aug 17 2021 ice_server.json
-rw-r--r--. 1 root root 173 Feb 17 2023 mime.xml
-rw-r--r--. 1 root root 2.8K Jul 4 2021 policy.xml
-rw-r--r--. 1 root root 1.6K Aug 9 2021 server.crt
-rw-r--r--. 1 root root 1.7K Aug 9 2021 server.key
-rwxr-xr-x. 1 root root 8.0M Aug 15 04:08 smart_rtmpd // 确保 smart_rtmpd 是可执行的
为什么选用 smart_rtmpd.multithread.centos7.7.1908.x64.tar.gz 版本,这个应该是通用版本,应该适用用大部分 Linux 系统,无论是 CentOS, Ubuntun, Arch Linux
运行 smart_rtmpd
我们准备运行 smart_rtmpd 流媒体服务器问题1 :smart_rtmpd 没有可执行权限,通过 chmod 赋权
[root@localhost smart_rtmpd]# ./smart_rtmpd
-bash: ./smart_rtmpd: Permission denied // 大部分这种情况是 smart_rtmpd 拷贝复制过程中丢失了可执行权限
[root@localhost smart_rtmpd]# chmod +x ./smart_rtmpd 问题2 :端口被其它程序占用,需要通过 config.xml 更改端口,或者停止其它的程序
[root@localhost bin]# ./smart_rtmpd
EAB7D740 [24-12-31 14:15:02.161] I: smart_rtmpd --- build time : 2024-08-15 04:06:58
EAB7D740 [24-12-31 14:15:02.161] I: website url : http://www.qiyicc.com/download/rtmpd.zip
EAB7D740 [24-12-31 14:15:02.161] I: gitee url : https://gitee.com/mirrors/smart-rtmpd
EAB7D740 [24-12-31 14:15:02.161] I: github url : https://github.com/superconvert/smart_rtmpd
EAB7D740 [24-12-31 14:15:02.161] I: liveshow url : https://github.com/superconvert/smart_rtmpd/blob/master/liveshow.md
EAB7D740 [24-12-31 14:15:02.161] I: development url : https://github.com/superconvert/smart_rtmpd/blob/master/web_dev.md
EAB7D740 [24-12-31 14:15:02.161] I: examples url : https://github.com/superconvert/smart_rtmpd/tree/master/example
EAB7D740 [24-12-31 14:15:02.161] I: email : cwf12345@sina.com
EAB7D740 [24-12-31 14:15:02.161] I: webchat : 99766553, qq : 99766553
EAB7D740 [24-12-31 14:15:02.161] I: 192.168.161.136 ens33
EAB7D740 [24-12-31 14:15:02.221] I: ssl client no config.
EAB7D740 [24-12-31 14:15:02.221] I: ssl server no config.
EAB7D740 [24-12-31 14:15:02.306] I: the rtmp server ip: 0.0.0.0, port is: 1935
EAB7D740 [24-12-31 14:15:04.101] I: the http server ip: 0.0.0.0, port is: 8080
generating new self-signed cert for smart_rtmpd@qiyicc.com
EAB7D740 [24-12-31 14:15:04.125] I: rtc-manager build self-signed certificate.
EAB7D740 [24-12-31 14:15:04.125] I: the rtsp server ip: 0.0.0.0, port is: 8554
EAB7D740 [24-12-31 14:15:04.345] I: the srt server ip: 0.0.0.0, port is: 9000
EAB7D740 [24-12-31 14:15:04.346] I: srt bind socket failed(Connection setup failure: unable to create/configure SRT socket) // 端口被别的程序占用了
EAB7D740 [24-12-31 14:15:04.346] I: srt bind socket failed.
EAB7D740 [24-12-31 14:15:04.449] I: the rtmp server stop
EAB7D740 [24-12-31 14:15:04.597] I: the http server stop
EAB7D740 [24-12-31 14:15:04.597] I: the rtsp server stop 正常运行日志打印
[root@localhost bin]# ./smart_rtmpd
48AEE740 [24-12-31 13:40:10.361] I: smart_rtmpd --- build time : 2024-08-15 04:06:58
48AEE740 [24-12-31 13:40:10.361] I: website url : http://www.qiyicc.com/download/rtmpd.zip
48AEE740 [24-12-31 13:40:10.361] I: gitee url : https://gitee.com/mirrors/smart-rtmpd
48AEE740 [24-12-31 13:40:10.361] I: github url : https://github.com/superconvert/smart_rtmpd
48AEE740 [24-12-31 13:40:10.361] I: liveshow url : https://github.com/superconvert/smart_rtmpd/blob/master/liveshow.md
48AEE740 [24-12-31 13:40:10.361] I: development url : https://github.com/superconvert/smart_rtmpd/blob/master/web_dev.md
48AEE740 [24-12-31 13:40:10.361] I: examples url : https://github.com/superconvert/smart_rtmpd/tree/master/example
48AEE740 [24-12-31 13:40:10.361] I: email : cwf12345@sina.com
48AEE740 [24-12-31 13:40:10.361] I: webchat : 99766553, qq : 99766553
48AEE740 [24-12-31 13:40:10.361] I: 192.168.1.102 ens33 // 我们的服务器地址
48AEE740 [24-12-31 13:40:10.404] I: ssl client no config.
48AEE740 [24-12-31 13:40:10.404] I: ssl server no config.
48AEE740 [24-12-31 13:40:10.528] I: the rtmp server ip: 0.0.0.0, port is: 1935
48AEE740 [24-12-31 13:40:11.097] I: the http server ip: 0.0.0.0, port is: 8080
generating new self-signed cert for smart_rtmpd@qiyicc.com
48AEE740 [24-12-31 13:40:11.366] I: rtc-manager build self-signed certificate.
48AEE740 [24-12-31 13:40:11.594] I: the rtsp server ip: 0.0.0.0, port is: 8554
48AEE740 [24-12-31 13:40:11.972] I: the srt server ip: 0.0.0.0, port is: 9000
48AEE740 [24-12-31 13:40:12.004] I: the sip server ip: 0.0.0.0, port is: 5060
48AEE740 [24-12-31 13:40:12.244] I: the ims server ip: 0.0.0.0, port is: 6666
这样 smart_rtmpd 就表示正确运行起来了!!!
推流拉流的验证
推流例子
RTMP 推流ffmpeg -re -stream_loop -1 -i 33.mp4 -vcodec libx264 -acodec aac -f flv rtmp://192.168.1.102:1935/rec/stream
RTMP 推流 ( HEVC )
ffmpeg -re -i 1.mp4 -c:a copy -c:v libx265 -f flv rtmp://192.168.1.102:1935/live/hevc
怎么让 ffmpeg 支持 hevc 推流 怎么编译 ffmpeg 让其支持 hevc(h265) - superconvert的个人空间 - OSCHINA - 中文开源技术交流社区
RTSP 推流
ffmpeg -re -stream_loop -1 -i 1.mp4 -vcodec libx264 -acodec aac -f rtsp rtsp://192.168.1.102:8554/live/stream
RTSP 推流 ( HEVC )
ffmpeg -re -stream_loop -1 -i video-h265.mkv -vcodec libx265 -acodec aac -f rtsp rtsp://192.168.1.102:8554/live/stream
SRT 推流
ffmpeg -re -i 22.mp4 -vcodec libx264 -acodec aac -f mpegts srt://192.168.1.102:9000?streamid=192.168.1.102:9000/live/stream,role=publisher
SRT 推流 ( HEVC )
ffmpeg -stream_loop -1 -re -i video-h265.mkv -vcodec libx265 -acodec aac -f mpegts srt://192.168.1.102:9000?streamid=192.168.1.102:9000/live/stream,role=publisher
拉流例子
RTMP 拉流ffplay rtmp://192.168.1.102:1935/live/stream
HTTP-HLS 拉流
ffplay http://192.168.1.102:8080/live/stream.m3u8
HTTP-DASH 拉流
ffplay http://192.168.1.102:8080/live/stream.mpd
RTSP 拉流
ffplay rtsp://192.168.1.102:8554/live/stream
SRT 拉流 ( ffplay )
ffplay srt://192.168.1.102:9000?streamid=192.168.1.102:9000/live/stream,role=player
更多的推拉流例子请参阅博客 https://blog.csdn.net/freeabc/article/details/117403471?spm=1001.2014.3001.5501
对于支持 Enhanced-rtmp 的 HEVC 推流,需要使用 smart_rtmpd 的收费版本,目前 ffmpeg 从版本 6.1 开始就支持 Enhanced-rtmp 的 HEVC 推流和拉流!!!
- smart_rtmpd 的日志查看
[root@localhost smart_rtmpd]# ./smart_rtmpd
4F136740 [24-12-31 13:58:36.864] I: smart_rtmpd --- build time : 2024-08-15 04:06:58
4F136740 [24-12-31 13:58:36.864] I: website url : http://www.qiyicc.com/download/rtmpd.zip
4F136740 [24-12-31 13:58:36.864] I: gitee url : https://gitee.com/mirrors/smart-rtmpd
4F136740 [24-12-31 13:58:36.864] I: github url : https://github.com/superconvert/smart_rtmpd
4F136740 [24-12-31 13:58:36.864] I: liveshow url : https://github.com/superconvert/smart_rtmpd/blob/master/liveshow.md
4F136740 [24-12-31 13:58:36.864] I: development url : https://github.com/superconvert/smart_rtmpd/blob/master/web_dev.md
4F136740 [24-12-31 13:58:36.864] I: examples url : https://github.com/superconvert/smart_rtmpd/tree/master/example
4F136740 [24-12-31 13:58:36.864] I: email : cwf12345@sina.com
4F136740 [24-12-31 13:58:36.864] I: webchat : 99766553, qq : 99766553
4F136740 [24-12-31 13:58:36.864] I: 192.168.161.136 ens33
4F136740 [24-12-31 13:58:36.892] I: ssl client no config.
4F136740 [24-12-31 13:58:36.893] I: ssl server no config.
4F136740 [24-12-31 13:58:37.027] I: the rtmp server ip: 0.0.0.0, port is: 1935
4F136740 [24-12-31 13:58:37.589] I: the http server ip: 0.0.0.0, port is: 8080
generating new self-signed cert for smart_rtmpd@qiyicc.com
4F136740 [24-12-31 13:58:37.601] I: rtc-manager build self-signed certificate.
4F136740 [24-12-31 13:58:37.601] I: the rtsp server ip: 0.0.0.0, port is: 8554
4F136740 [24-12-31 13:58:37.852] I: the srt server ip: 0.0.0.0, port is: 9000
4F136740 [24-12-31 13:58:37.882] I: the sip server ip: 0.0.0.0, port is: 5060
4F136740 [24-12-31 13:58:38.169] I: the ims server ip: 0.0.0.0, port is: 6666
1FFFF700 [24-12-31 13:59:34.490] I: rtmp-none(obj: 0x7f8534000900, ip: 192.168.161.1:60252) set in_chunk_size to 60000
1FFFF700 [24-12-31 13:59:34.491] I: rtmp-publisher(obj: 0x7f8534000900, ip: 192.168.161.1:60252) stream connected.
1FFFF700 [24-12-31 13:59:34.491] I: rtmp-manager add application(obj: 0x7f8518001e40, url: rtmp://192.168.161.136/live/stream)!
1FFFF700 [24-12-31 13:59:34.507] I: rtmp-app(obj:0x7f8518001e40, url: rtmp://192.168.161.136/live/stream) add http-hls(0x7f8518004de0)
1FFFF700 [24-12-31 13:59:34.507] I: rtmp-app(obj:0x7f8518001e40, url: rtmp://192.168.161.136/live/stream) add http-dash(0x7f8518005f30)
1FFFF700 [24-12-31 13:59:34.507] I: rtsp-manager add application(obj: 0x7f851800bd60, url: rtsp://192.168.161.136:8554/live/stream)!
1FFFF700 [24-12-31 13:59:34.507] I: rtsp-manager add publisher(obj: 0x7f851800b480, url: rtsp://192.168.161.136:8554/live/stream)!
1FFFF700 [24-12-31 13:59:34.507] I: rtmp-app(obj:0x7f8518001e40, url: rtmp://192.168.161.136/live/stream) add rtsp(0x7f851800b480)
1FFFF700 [24-12-31 13:59:34.507] I: srt-manager add application(obj: 0x7f851800f950, url: srt://192.168.161.136:9000/live/stream)!
1FFFF700 [24-12-31 13:59:34.507] I: srt-manager add publisher(obj: 0x7f851800e610, url: srt://192.168.161.136:9000/live/stream)!
1FFFF700 [24-12-31 13:59:34.507] I: rtmp-app(obj:0x7f8518001e40, url: rtmp://192.168.161.136/live/stream) add srt(0x7f851800e610)
1FFFF700 [24-12-31 13:59:34.507] I: rtmp-manager add publisher(obj: 0x7f8534000900, url: rtmp://192.168.161.136/live/stream)!
1FFFF700 [24-12-31 13:59:34.507] I: rtmp-publisher(obj: 0x7f8534000900, ip: 192.168.161.1:60252) build elapse 142 ms.
1FFFF700 [24-12-31 13:59:34.507] I: rtmp-publisher(obj: 0x7f8534000900, ip: 192.168.161.1:60252) amf_cmd unsupport _checkbw
1FFFF700 [24-12-31 13:59:34.548] I: rtmp-publisher(obj: 0x7f8534000900, ip: 192.168.161.1:60252) publish stream
4D4F8700 [24-12-31 13:59:34.616] I: rtmp-app(obj:0x7f8518001e40, url: rtmp://192.168.161.136/live/stream) inital video(h264 size:1000x562 fps:15)
4D4F8700 [24-12-31 13:59:34.673] I: rtmp-app(obj:0x7f8518001e40, url: rtmp://192.168.161.136/live/stream) inital audio(aac sample:44100 channel:2 bit:16) // 推流成功
3D7FA700 [24-12-31 13:59:51.374] I: rtmp-none(obj: 0x7f85340211d0, ip: 192.168.161.1:60259) amf_cmd unsupport _checkbw
3D7FA700 [24-12-31 13:59:51.414] I: rtmp-manager add player(obj: 0x7f85340211d0, url: rtmp://192.168.161.136/live/stream)!
3D7FA700 [24-12-31 13:59:51.414] I: rtmp-player(obj: 0x7f85340211d0, ip: 192.168.161.1:60259) build elapse 84 ms
3D7FA700 [24-12-31 13:59:51.414] I: rtmp-player(obj: 0x7f85340211d0, ip: 192.168.161.1:60259) play stream
4D4F8700 [24-12-31 13:59:52.158] I: rtmp-player(obj: 0x7f85340211d0, ip: 192.168.161.1:60259) inital video meta(sps) // 拉流成功
收尾工作
通过上述工作,我们的 smart_rtmpd 流媒体服务器能正常工作了,让我们来真正运行它吧,是不是操作特别简单,下载,解压,运行即可!
[root@localhost smart_rtmpd]# ./smart_rtmpd -d // 参数 -d 表示以后台模式运行
[root@localhost smart_rtmpd]# tail -f log/20241231.log // 可以查看日志
Good luck!
怎么在 Linux 下运行 smart_rtmpd的更多相关文章
- Linux下运行memcached失败
Linux下运行memcached失败 1.错误信息如下 [root@localhost ~]# memcached can't run as root without the -u switch 2 ...
- Java项目打包在CMD或者Linux下运行
Java项目打包在CMD或者Linux下运行 1.在CMD下运行 在eclipse中将项目export成jar包,然后用压缩软件解压
- Demo+在Linux下运行(CentOS7+dotnetcore sdk)
来份ASP.NET Core尝尝 0x01.前言 学习ASP.NET Core也有一段时间了,虽说很多内容知识点还是处于一知半解的状态,但是基本的,还是 略懂一二.如果有错误,还望见谅. 本文还是和之 ...
- Linux下运行jmeter
• 我们在做测试的时候,有时候要运行很久,公司用的测试服务器一般都是linux,就可以运行在linux下面,linux下面不能像windows一样有图形化界面,那怎么运行脚本呢,就先在windows上 ...
- windows下的java项目打jar分别编写在windows与linux下运行的脚本( 本人亲测可用!)
前言: 最近公司做了一个工具,要将这个工具打包成一个可运行的程序,编写start.bat和start.sh在windows和linux下都可以运行. 在网上找了很多资料,最后终于找到一个可靠的资料,记 ...
- 终于解决了Linux下运行OCCI程序一直报Error while trying to retrieve text for error ORA-01804错误
终于解决了Linux下运行OCCI程序一直报Error while trying to retrieve text for error ORA-01804错误 http://blog.csdn.net ...
- Kali Linux下运行Sniffjoke出错的解决
Kali Linux下运行Sniffjoke出错的解决 由于Kali Linux版本的更新和Sniffjoke发布时间久远等问题,Sniffjoke在新版本的Kali Linux中运行存在各种问题.下 ...
- Linux下运行scala语言的jar包
1.新建project 2.打包 3.linux下运行jar包 #First.jar为jar包名,Test为主类名 [root@FI-2 Desktop]# spark-submit First.ja ...
- jmeter压测、操作数据库、分布式、 linux下运行的简单介绍
一.jmeter压测 1.如何压测 常规性能压测:10-15分钟 稳定性测试:一周.2天等 如果想要压测10分钟,勾选永远,勾选调度器,填写600秒.也可以使用固定启动时间. 2.tps.响应时间 ( ...
- windows下和linux下运行jar
需要在windows下运行jar,首先需要我们打包出来可执行jar idea打包可执行jar可以参考我的另一篇博客[https://mp.csdn.net/postedit/88653200] 一.w ...
随机推荐
- Linux 7安装Mysql5.7版本
Mysql 5.7的安装搭建 首先去到官方网站的下载链接中找到对应你Linux服务器版本的mysql软件包 https://dev.mysql.com/downloads/repo/yum/ 我使用的 ...
- 如何阅读 CPU 电路图(以 6502 为例)
开篇 你是否曾对 CPU 的工作原理充满好奇,以及简单的晶体管又是如何组成逻辑门,进而构建出复杂的逻辑电路实现?本文将以知名的 6502 CPU 的电路图为例,介绍如何阅读 CPU 电路图,并向你演示 ...
- 如果让你处理hbase 怎么保证数据的安全性可靠性 不需要具体的设置 要一套方案
有关数据安全及可靠我们认为大体上分为存储安全和使用安全 1 数据存储安全 hbase是基于hdfs的一种数据存储解决方案,所以有关数据的安全性可靠性可以利用hdfs自身的副本机制保障.另外原生的hba ...
- GPU 环境搭建指南:如何在裸机、Docker、K8s 等环境中使用 GPU
本文主要分享在不同环境,例如裸机.Docker 和 Kubernetes 等环境中如何使用 GPU. 跳转阅读原文:GPU 环境搭建指南:如何在裸机.Docker.K8s 等环境中使用 GPU 1. ...
- 汉文博士 0.5.9 测试版发布:增加统一码中日韩表意文字扩展 G 区的构型检索和 GB/T2312、GBK字表
之前我们采用的构型数据库在 2019 年起未见更新,但我最近在该数据库的页面找到了该数据库的基础数据源(CHISE),而该数据源上提供了中日韩表意文字扩展 G 区的构型数据.这样,在构型检索中支持扩展 ...
- Python预安装包制作
预编译安装包 在Linux服务器上,经常会安装Python.Redis.Nginx等服务,不管离线.在线都需要编译.编译之前还需要安装一些依赖的环境,比如,openssl.gcc.g++等,但是mak ...
- python 3.7环境安装并使用csv
因为调换需要,进了另外一个维护组,需要用python解析excel csv,所以就下载了一下他们需要的python3.7 如何做呢,看步骤 1.去官网 2.找版本 3.下源码 4.解压出来进入文件夹 ...
- laravel之model
记录laravel 中model常用方法 1.keyBy() 指定数据的某个字段作为该条数据的key 2.like操作 $model->where('goods', 'like', '%test ...
- 网站安全锁-SSL证书
为了安全起见,现在开发微信服务号和IOS客户端等访问服务器端都要求使用https加密传输. SSL证书是数字证书的一种,类似于驾驶证.护照和营业执照的电子副本.因为配置在服务器上,也称为SSL服务器证 ...
- C#获取用户客户端系统版本设备名称浏览器
C#获取用户客户端系统版本设备名称浏览器 先看效果 使用 Neget引用包UAParser 在这里插入代码片 项目的github :https://github.com/ua-parser/uap-c ...