无法连接到VLC RTSP服务器

时间:2016-03-10 07:32:47

标签: amazon-ec2 video-streaming vlc rtsp

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

我已成功为我的服务器安装了VLC。我可以SSH和远程服务器(我可以使用gnome的GUI应用程序)

我使用以下命令启动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播放器通过以下网址连接到流 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.

请帮助我解决此问题。

1 个答案:

答案 0 :(得分:2)

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

  1. 启用Amazon的Elastic Load Balance服务并为端口554添加端口farding(RTSP默认端口)
  2. 流服务器在服务器本身的localhost上运行良好,但是从外面无法访问,我想这是关于防火墙和端口的。
  3. 我扫描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
    

    或关闭防火墙absotelutely

    sudo service iptables save
    sudo service iptables stop
    sudo chkconfig iptables off
    

    可选,如果您使用的是Cpanel防火墙,则必须使用该防火墙的允许端口进行相同检查。