怎么在 Linux 下运行 smart_rtmpd

操作系统的准备

我们知道比较流行的 Linux 操作系统基本上分为两类,一类是以 Redhat 为基线的 Redhat, CentOS;另一类是 Debian 为基线的 Debian,Ubuntu。当然现在还有一些新兴势力 Arch Linux,但大家都是基于 Linux 内核进行封装运作的。主要表现是包管理器不同,面向的用户场景不同,有的往桌面方面发展,有的往嵌入式方向发展。这些系统大家可以根据自己的喜好进行选择,本文不做过多阐述,差异不大。建议大家采用操作系统最新版本,这样系统性能更好,功能更强大,兼容性更好,性能也是最佳。

smart_rtmpd 服务器软件的准备

  1. 软件的下载

    访问 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

  2. 软件包的介绍

    下载的软件包 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)
  3. 软件包的准备

    我们下载 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

  4. 运行 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 就表示正确运行起来了!!!

推流拉流的验证

​

  1. 推流例子

    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
  2. 拉流例子

    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 推流和拉流!!!

  1. 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的更多相关文章

  1. Linux下运行memcached失败

    Linux下运行memcached失败 1.错误信息如下 [root@localhost ~]# memcached can't run as root without the -u switch 2 ...

  2. Java项目打包在CMD或者Linux下运行

    Java项目打包在CMD或者Linux下运行 1.在CMD下运行 在eclipse中将项目export成jar包,然后用压缩软件解压

  3. Demo+在Linux下运行(CentOS7+dotnetcore sdk)

    来份ASP.NET Core尝尝 0x01.前言 学习ASP.NET Core也有一段时间了,虽说很多内容知识点还是处于一知半解的状态,但是基本的,还是 略懂一二.如果有错误,还望见谅. 本文还是和之 ...

  4. Linux下运行jmeter

    • 我们在做测试的时候,有时候要运行很久,公司用的测试服务器一般都是linux,就可以运行在linux下面,linux下面不能像windows一样有图形化界面,那怎么运行脚本呢,就先在windows上 ...

  5. windows下的java项目打jar分别编写在windows与linux下运行的脚本( 本人亲测可用!)

    前言: 最近公司做了一个工具,要将这个工具打包成一个可运行的程序,编写start.bat和start.sh在windows和linux下都可以运行. 在网上找了很多资料,最后终于找到一个可靠的资料,记 ...

  6. 终于解决了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 ...

  7. Kali Linux下运行Sniffjoke出错的解决

    Kali Linux下运行Sniffjoke出错的解决 由于Kali Linux版本的更新和Sniffjoke发布时间久远等问题,Sniffjoke在新版本的Kali Linux中运行存在各种问题.下 ...

  8. Linux下运行scala语言的jar包

    1.新建project 2.打包 3.linux下运行jar包 #First.jar为jar包名,Test为主类名 [root@FI-2 Desktop]# spark-submit First.ja ...

  9. jmeter压测、操作数据库、分布式、 linux下运行的简单介绍

    一.jmeter压测 1.如何压测 常规性能压测:10-15分钟 稳定性测试:一周.2天等 如果想要压测10分钟,勾选永远,勾选调度器,填写600秒.也可以使用固定启动时间. 2.tps.响应时间 ( ...

  10. windows下和linux下运行jar

    需要在windows下运行jar,首先需要我们打包出来可执行jar idea打包可执行jar可以参考我的另一篇博客[https://mp.csdn.net/postedit/88653200] 一.w ...

随机推荐

  1. Games101 作业8 质点弹簧系统

    目录 1 前言 2 基础数据结构 3 欧拉 4 Verlet Integration 4.1 Constraints 1 前言 质点弹簧系统的模拟仿真,其实非常简单,核心就是牛顿第二定律 \(F = ...

  2. Machine Learning Week_1 Introduction 9-11

    目录 1.9 Who are Mentors? unfamiliar words 1.10 Get to Know Your Classmates unfamiliar words 1.11 Freq ...

  3. Java EasyExcel 导出报内存溢出如何解决

    大家好,我是 V 哥.使用EasyExcel进行大数据量导出时容易导致内存溢出,特别是在导出百万级别的数据时.你有遇到过这种情况吗,以下是V 哥整理的解决该问题的一些常见方法,分享给大家,欢迎一起讨论 ...

  4. 【问题解决】Tomcat由低于8版本升级到高版本使用Tomcat自带连接池报错无法找到表空间的问题

    问题复现 项目上历史项目为解决漏洞扫描从Tomcat 6.0升级到了9.0版本,服务启动的日志显示如下警告,数据源是通过JNDI方式在server.xml中配置的,控制台上狂刷无法找到表空间的错误(没 ...

  5. RK3568,字符设备框架:管理同主设备号、不同次设备号设备

    字符设备框架:管理同主设备号.不同次设备号设备 以下代码针对迅为开发板RK3568,开发板系统是ubuntu20.04, 正文 以下是我写的字符设备框架,实现了管理同主设备号.不同次设备号的功能. 代 ...

  6. uni app下开发AI运动小程序解决方案

    一.引言 近年来,随着AI视频识别技术的飞速发展,市场上涌现出了众多基于视觉识别的AI运动APP.这些APP凭借AI视觉识别技术的强大能力,让用户只需面对摄像头进行运动锻炼,就能享受到智能计时.精准计 ...

  7. php 超过64位进制和10进制的转换

    有时候想把一个很大的数尽量用更少的空间存储起来,那么就可以采用很大的进制来存储它,比如说,一个大于等于10小于等于16数字使用10进制就需要两位,使用16进制就只需要1位,那就等于帮程序省了一位的空间 ...

  8. ETCD存储满了如何处理?

    一.前言 当运行 ETCD 日志报 Erro: mvcc database space exceeded 时,或者查看健康状态显示 failed to commit proposal: Active ...

  9. golang之枚举类型iota

    枚举类型是一种常用的数据类型,用于表示一组有限的.预定义的.具名的常量值.在枚举类型中,每个常量都是一个枚举值,它们之间的值相等且唯一. 枚举类型通常用于表示一组相关的常量,比如星期.月份.性别等等. ...

  10. SSL免费证书之Let’s Encrypt

    官网:https://letsencrypt.org/zh-cn 官网建议使用Certbot的方式进行安装,所以首先我们需要安装Certbot Certbot) 官网:Certbot (eff.org ...