回答
收藏
分享
举报
nginx rtmp 播放本地视频,如何实现目录层级查找
提问于2020-11-20 15:43

浏览 3.7k

文章标签

rtmp {

              server {
                                   listen 1935; #服务端口--默认
                                   application vod {
                                   play /opt/video/vod/;
                                }

                   }

}

当我访问:rtmp://example.com/vod/test.mp4

默认去/opt/video/vod/ 下查找, 但是视频是根据摄像头的id划分目录的,分别在不同的目录下,比如

rtmp://example.com/vod/1/test.mp4

这样的url就无法访问,如何实现自动层级查找呢





已修改于2023-03-17 02:11



写下您的回答
发表回答
全部回答(2)

按点赞数排序

按时间排序

按照官方的 rtmp 规范文档第 30 页的内容,"rtmp://example.com/vod/1/test.mp4" 这种 url 是错的,因为规范文档里写明了 tcUrl 的格式是 "protocol://servername:port/appName/appInstance",即 url 中除了协议名,主机名和端口外,只能有两层。而你的 url 是3层,所以无法访问。

解决办法有 3 种:

1. 可以将 application vod 修改为 application x (x 是数字),但是这中配置不太灵活,因为服务器无法事先知道你有多少个摄像头。

2. 摄像头生成的媒体文件带上编号,例如:1 号摄像头生成的媒体文件是 1_test.mp4,2 号摄像头生成的媒体文件是 2_test.mp4,以此类推。

3. 你这使用的是 nginx-rtmp-module 及其各种变种吧,源代码都开放了,如果有能力,可以自己修改源代码以达到要求。

赞同

1

回复举报

回答于2020-11-20 21:42



回复winshining1202
回复

不错

赞同

0

回复举报

回答于2020-11-23 21:29



回复jiangyidigital
回复
提问者
子曰
这家伙很懒还未留下介绍~
0
文章
1
问答
0
粉丝
相关问答

没看明白,描述详细点呢?

点赞 0
浏览 3.9k
解决思路:
1:这里的signal 表示的是nginx的型号,找到对应25 对应的错误标签意思
signal各个数字含义
signal.h中是如下定义的: #include <machine/signal.h>/* sigcontext; codes for SIGILL, SIGFPE */ #defineSIGHUP 1/* hangup */ #defineSIGINT 2/* interrupt */ #defineSIGQUIT 3/* quit */ #defineSIGILL 4/* illegal instruction (not reset when caught) */ #defineSIGTRAP 5/* trace trap (not reset when caught) */ #defineSIGABRT 6/* abort() */ #if  (defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE)) #defineSIGPOLL 7/* pollable event ([XSR] generated, not supported) */ #else/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #defineSIGIOT SIGABRT/* compatibility */ #defineSIGEMT 7/* EMT instruction */ #endif/* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ #defineSIGFPE 8/* floating point exception */ #defineSIGKILL 9/* kill (cannot be caught or ignored) */ #defineSIGBUS 10/* bus error */ #defineSIGSEGV 11/* segmentation violation */ #defineSIGSYS 12/* bad argument to system call */ #defineSIGPIPE 13/* write on a pipe with no one to read it */ #defineSIGALRM 14/* alarm clock */ #defineSIGTERM 15/* software termination signal from kill */ #defineSIGURG 16/* urgent condition on IO channel */ #defineSIGSTOP 17/* sendable stop signal not from tty */ #defineSIGTSTP 18/* stop signal from tty */ #defineSIGCONT 19/* continue a stopped process */ #defineSIGCHLD 20/* to parent on child stop or exit */ #defineSIGTTIN 21/* to readers pgrp upon background tty read */ #defineSIGTTOU 22/* like TTIN for output if (tp->t_local<OSTOP) */ #if  (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #defineSIGIO 23/* input/output possible signal */ #endif #defineSIGXCPU 24/* exceeded CPU time limit */ #defineSIGXFSZ 25/* exceeded file size limit */ #defineSIGVTALRM 26 /* virtual time alarm */ #defineSIGPROF 27/* profiling time alarm */ #if  (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) #define SIGWINCH 28/* window size changes */ #define SIGINFO29 /* information request */ #endif #define SIGUSR1 30/* user defined signal 1 */ #define SIGUSR2 31/* user defined signal 2 */ Exception codes In the crash log is a line that starts with the text Exception Codes: followed by one or more hexadecimal values. These are processor-specific codes that may give you more information on the nature of the crash. The exception code 0xbaaaaaad indicates that the log is a stackshot of the entire system, not a crash report. To take a stackshot, push the home button and any volume button. Often these logs are accidentally created by users, and do not indicate an error. The exception code 0xbad22222 indicates that a VoIP application has been terminated by iOS because it resumed too frequently. The exception code 0x8badf00d indicates that an application has been terminated by iOS because a watchdog timeout occurred. The application took too long to launch, terminate, or respond to system events. One common cause of this is doing synchronous networking on the main thread. Whatever operation is on Thread 0: needs to be moved to a background thread, or processed differently, so that it does not block the main thread. The exception code 0xc00010ff indicates the app was killed by the operating system in response to a thermal event. This may be due to an issue with the particular device that this crash occurred on, or the environment it was operated in. For tips on making your app run more efficiently, see iOS Performance and Power Optimization with Instruments WWDC session. The exception code 0xdead10cc indicates that an application has been terminated by iOS because it held on to a system resource (like the address book database) while running in the background. The exception code 0xdeadfa11 indicated that an application has been force quit by the user. Force quits occur when the user first holds down the On/Off button until "slide to power off" appears, then holds down the Home button. It's reasonable to assume that the user has done this because the application has become unresponsive, but it's not guaranteed - force quit will work on any application. Note: Terminating a suspended app by removing it from the multitasking tray does not generate a crash log. Once an app has suspended, it is eligible for termination by iOS at any time, so no crash log will be generated.
查看到 signal 25 表示的是exceeded file size limit 超出文件大小限制
通过排查是由于 access.log 文件太大,超过了 设置的最大值,删除文件并配置定时备份删除就可以了
点赞 0
浏览 5.2k