0

我正在尝试使用 Go 构建一个私有流媒体服务器(RTMP/HLS)。基本概念类似于Twitch用户可以使用OBS(和唯一密钥)直播视频。

我遇到了一个名为 Seal 的 Go 框架,它似乎完全符合我的意愿。 https://github.com/calabashdad/seal

但是,OBS 无法连接到远程服务器,尽管 Seal-framework 表示它正在列出流端口 (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 : 7001

Apache 虚拟主机配置:

<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 Conf 文件中的 RTMP 替换为 HTTP,似乎可以建立连接,但出现超时错误。

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
4

1 回答 1

0

目前尚不清楚为什么会发生此错误。超时最常见的问题是防火墙。

另一个问题,但我不确定是否需要 SWF 身份验证。

请你再调试一下好吗?

  1. 向我们展示您在 xx.xx.xx.105 服务器上的防火墙规则?
  2. 你能用这个rtmpdump程序做更多的调试吗?它将提供解决您的问题所需的大量有用信息。
rtmpdump -v -r  "rtmp://rtmp.myserver.com:1935/" [ -s swf auth ]  | vlc -
于 2021-01-12T16:00:58.500 回答