我正在尝试用Go构建一个私有流服务器(RTMP/HLS)。基本概念类似于抽筋。用户可以使用OBS (和唯一的键)直播视频。
我偶然发现了一个名为Seal的Go框架,它似乎完全符合我的意愿。https://github.com/calabashdad/seal
然而,OBS无法连接到远程服务器,尽管server表示它列出了流端口(rtmp.myserver.com:1935)。
OBS流链接:
rtmp://rtmp.myserver.com/live/test密封运行日志(./seal -c conf/seal.yaml):
2021/01/12 12:08:26.003814 seal.go:55: load conf file success, conf={System:{CPUNums:0} Rtmp:{Listen:1935 TimeOut:30 ChunkSize:60000 Atc:false AtcAuto:true TimeJitter:1 ConsumerQueueSize:5} Hls:{Enable:true HlsFragment:4 HlsWindow:20 HlsPath:/var/www/go_projects/src/seal/hls_files HttpListen:7001}}
2021/01/12 12:08:26.003961 seal.go:60: app run on auto cpu nums= 2
2021/01/12 12:08:26.004415 rtmp_server.go:29: rtmp server start liste at :1935
2021/01/12 12:08:26.004010 hls_server.go:34: start hls server, listen at : 7001Apache VirtualHost配置:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName rtmp.myserver.com
ServerAlias rtmp.myserver.com
ServerAdmin webmaster@rtmp.myserver.com
DocumentRoot /var/www/go_projects/src/seal
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / rtmp://rtmp.myserver.com:1935/
ProxyPassReverse / rtmp://rtmp.myserver.com:1935/
<Directory /var/www/go_projects/src/seal>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>OBS错误:连接到服务器失败。连接超时。
我甚至试图在Apache文件中用HTTP替换RTMP,而且似乎可以建立连接,但是出现了超时错误。
2021/01/12 13:36:23.221275 rtmp_server.go:36: one rtmp connection come in, remote= xx.xx.xx.105:44720
2021/01/12 13:36:53.222093 cycle.go:79: rtmp handshake failed.err= read tcp xx.xx.xx.105:1935->xx.xx.xx.105:44720: i/o timeout而xx.xx.xx.105是我的远程服务器
知道我做错了什么吗?
编辑 (Ubuntu)防火墙规则
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
25/tcp (Postfix) ALLOW IN Anywhere
3306 ALLOW IN Anywhere
1935/tcp ALLOW IN Anywhere
25/tcp (Postfix (v6)) ALLOW IN Anywhere (v6)
3306 (v6) ALLOW IN Anywhere (v6)
1935/tcp (v6) ALLOW IN Anywhere (v6)rtmpdump结果[rtmpdump -v -r "rtmp://rtmp.myserver.com/live/test“-s swf auth vlc -]:
VLC media player 3.0.11.1 Vetinari (revision 3.0.11.1-0-g52483f3ca2)
RTMPDump v2.4
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
WARNING: You haven't specified an output file (-o filename), using stdout
Connecting ...
[000055e60d2775b0] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
QFont::fromString: Invalid description '(empty)'
QFont::fromString: Invalid description '(empty)'
ERROR: RTMP_Connect0, failed to connect socket. 110 (Connection timed out)
[00007f6558001160] mjpeg demux error: cannot peek发布于 2021-01-12 16:00:58
这还不清楚为什么会发生此错误。超时最流行的问题是防火墙。
另一个问题,但我不确定是否需要SWF身份验证。
你能多做些调试吗?
rtmpdump程序做更多的调试吗?它将提供解决问题所需的大量有用信息。rtmpdump -v -r "rtmp://rtmp.myserver.com:1935/" [ -s swf auth ] | vlc -https://stackoverflow.com/questions/65683544
复制相似问题