Amazon ec2 无法连接到VLC RTSP服务器

Amazon ec2 无法连接到VLC RTSP服务器,amazon-ec2,video-streaming,vlc,rtsp,Amazon Ec2,Video Streaming,Vlc,Rtsp,我使用的是基于AWS EC2 CentOS的系统。我也有一个网站在域名mydomain.com上运行 我已成功为我的服务器安装VLC。我可以对我的服务器进行SSH和远程访问(我可以将GUI应用程序与gnome一起使用) 我使用以下命令启动vlc服务器: vlc --ttl 34 -vvv --color -I telnet --telnet-password vlc --rtsp-host 0.0.0.0 --rtsp-port=554 并通过以下方式在其上设置流: root@whm [~]#

我使用的是基于AWS EC2 CentOS的系统。我也有一个网站在域名mydomain.com上运行

我已成功为我的服务器安装VLC。我可以对我的服务器进行SSH和远程访问(我可以将GUI应用程序与gnome一起使用)

我使用以下命令启动vlc服务器:

vlc --ttl 34 -vvv --color -I telnet --telnet-password vlc --rtsp-host 0.0.0.0 --rtsp-port=554
并通过以下方式在其上设置流:

root@whm [~]#  telnet localhost 4212
Trying ::1...
Connected to localhost.
Escape character is '^]'.
VLC media player 2.0.8 Twoflower
Password:
Welcome, Master
> new sample01 vod enabled
new
> setup sample01 input file:///home/myuser/public_html/mywebsite/folder/video.mp4
setup
日志输出良好

[0x7f24a002c5b8] stream_out_rtp vod server debug: RTSP stream at /sample01
[0x7f24a002c5b8] main vod server debug: net: listening to 0.0.0.0 port 554
[0x7f24a002c5b8] stream_out_rtp vod server debug: RTSP: adding /sample01/trackID=0
[0x7f24a002c5b8] stream_out_rtp vod server debug: RTSP: adding /sample01/trackID=1 


[0x7fce4802d8c8] [Media: vod] main input debug: `file:///home/myuser/public_html/video.mp4' successfully opened 
如果我自己留在服务器上,使用GUI,我可以使用VLC播放器打开网络流URL:

rtsp://localhost:554/sample01 (it works)
如果我使用另一个网络的vlc播放器通过下面的URL连接到流
rtsp://mydomain.com:554/sample01
(这是为我的网站工作的域)

rtsp://my-server-public-ip.com:554/sample01
(也不起作用)

我猜这个端口有问题,然后我转到AWS控制台,在我的实例的安全组的入站列表中添加了更多的端口554和4212(就像我对其他端口所做的那样),但这没有帮助

vlc客户端的错误是:

[000000010050e4c8] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000000010022a7e8] [http] lua interface: Lua HTTP interface
[0000000104a00978] live555 demux error: Failed to connect with rtsp://mydomain.com:554/sample01
[00000001002b2dc8] core access error: connection failed: Connection refused
[00000001002b2dc8] access_realrtsp access error: cannot connect to mydomain.com:554
[0000000100618e58] core input error: open of `rtsp://mydomain.com:554/sample01' failed
CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces.

请帮我解决这个问题。

我的问题解决了。我做了以下事情来解决它,但我不确定哪一个是正确的。如果有人遇到同样的问题,你可以试试这些

  • 我启用Amazon的弹性负载平衡服务,并为端口554(RTSP默认端口)添加端口转发
  • 流式服务器在服务器本身的本地主机上运行良好,但从外部无法访问,我想这是关于防火墙和端口的
  • 我扫描mydomain.com以查看端口是否打开

    nmap -v -Pn -sT mydomain.com
    
    暂时禁用AWS EC2实例上的防火墙,或在iptables中添加一行以打开端口554。 按打开和编辑文件

    vi /etc/sysconfig/iptables
    
    将下面的行添加到其中

    -A cP-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dpport 554 -j ACCEPT
    
    或者完全关闭防火墙

    sudo service iptables save
    sudo service iptables stop
    sudo chkconfig iptables off
    
    可选,如果您使用的是Cpanel的防火墙,则必须使用该防火墙允许的端口进行检查