Saya mencoba membangun server streaming pribadi (RTMP/HLS) dengan Go. Konsep dasarnya mirip dengan Twitch. Pengguna dapat menyiarkan video secara langsung menggunakan OBS (dan kunci unik).
Saya menemukan kerangka kerja Go yang disebut Seal, yang sepertinya melakukan apa yang saya inginkan. https://github.com/calabashdad/seal
Namun, OBS tidak dapat terhubung ke server jarak jauh meskipun Seal-framework menyatakan bahwa ia mencantumkan port streaming (rtmp.myserver.com:1935).
Tautan Streaming OBS:
rtmp://rtmp.myserver.com/live/test
Log pengoperasian segel (./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
Konfigurasi Apache VirtualHost:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName rtmp.myserver.com
ServerAlias rtmp.myserver.com
ServerAdmin [email protected]
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>
Kesalahan OBS: Gagal terhubung ke server. Waktu koneksi berakhir.
Saya bahkan mencoba mengganti RTMP dengan HTTP di file Apache Conf dan sepertinya koneksi dapat dibuat, tetapi ada kesalahan Timeout.
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
Sedangkan xx.xx.xx.105
adalah server jarak jauh saya
Tahu kesalahan apa yang saya lakukan?
Edit Aturan Firewall (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)
hasil 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