live555 media server rtsp 流媒体服务器搭建成功经验分享

live555 media server 可以用来搭建 rtsp 流媒体服务器,开源免费的产品,支持的音视频格式非常多,也非常好用,windows的就是一个文件,下载之后运行,就可以自动将它所在的目录和子目录下的所有音视频通过rtsp协议访问,linux下也是下载一个文件,运行就可以将它所在目录和子目录下所有音视频通过rtsp协议访问。我用的centos6.5,搭建 rtsp 流媒体服务器的时候遇到诸多问题,现在记录下来以方便其它同学少走弯路。

首先建立目录:

mkdir -p /home/live555mediaserver/video

cd /home/live555meidaserver

下载live555mediaserver:

wget http://www.live555.com/mediaServer/linux/live555MediaServer

可能需要添加可执行权限:

chmod +x live555MediaServer

ll

看到名字变成绿色,并且有x这个权限,说明可以执行。

拷贝一个电影到子目录video下:

cp /home/test.mkv /home/live555mediaserver/video/test.mkv

启动 rtsp 流媒体服务:

./live555MediaServer&

后面加&表示后台运行,这样不中断 rtsp 流媒体服务的情况下,你还可以运行别的操作。

但是此时你可能看到的信息如下:

LIVE555 Media Server
        version 0.88 (LIVE555 Streaming Media library version 2015.07.31).
Play streams from this server using the URL
        rtsp://0.0.0.0/<filename>
where <filename> is a file present in the current directory.
Each file's type is inferred from its name suffix:
        ".264" => a H.264 Video Elementary Stream file
        ".265" => a H.265 Video Elementary Stream file
        ".aac" => an AAC Audio (ADTS format) file
        ".ac3" => an AC-3 Audio file
        ".amr" => an AMR Audio file
        ".dv" => a DV Video file
        ".m4e" => a MPEG-4 Video Elementary Stream file
        ".mkv" => a Matroska audio+video+(optional)subtitles file
        ".mp3" => a MPEG-1 or 2 Audio file
        ".mpg" => a MPEG-1 or 2 Program Stream (audio+video) file
        ".ogg" or ".ogv" or ".opus" => an Ogg audio and/or video file
        ".ts" => a MPEG Transport Stream file
                (a ".tsx" index file - if present - provides server 'trick play' support)
        ".vob" => a VOB (MPEG-2 video with AC-3 audio) file
        ".wav" => a WAV Audio file
        ".webm" => a WebM audio(Vorbis)+video(VP8) file
See http://www.live555.com/mediaServer/ for additional documentation.
(We use port 80 for optional RTSP-over-HTTP tunneling, or for HTTP live streaming (for indexed Transport Stream files only).)

看到rtsp://0.0.0.0/<filename>这里了没,ip地址为0.0.0.0,说明没有正常获取到你服务器的ip,此时如果你用vlc或者mpc-hc或者potplayer播放的话,服务器上会报错:Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0

找了资料,说是要自己修改源代码然后重新编译,也有说是开放udp端口15947,还有说直接关闭防火墙就能解决。

我试了关闭防火墙重启 live555mediaserver,ip识别正常,播放正常。

开启防火墙后,放行udp端口15947,重启live555mediaserver,ip识别正常,播放不成功。我选择这个方案。

然后查了资料说是放行tcp端口554,也就是live555mediaserver 默认的rtsp端口,播放成功。

至此,用live555mediaserver搭建rtsp流媒体服务器成功。分享给大家,少走弯路。

附 live555 media server 支持的格式:

  • A MPEG Transport Stream file (with file name suffix “.ts”)
  • A Matroska or WebM file (with filename suffix “.mkv” or “.webm”)
  • An Ogg) file (with filename suffix “.ogg”, “ogv”, or “.opus”)
  • A MPEG-1 or 2 Program Stream file (with file name suffix “.mpg”)
  • A MPEG-4 Video Elementary Stream file (with file name suffix “.m4e”)
  • A H.264 Video Elementary Stream file (with file name suffix “.264”)
  • A H.265 Video Elementary Stream file (with file name suffix “.265”)
  • A VOB video+audio file (with file name suffix “.vob”)
  • A DV video file (with file name suffix “.dv”)
  • A MPEG-1 or 2 (including layer III – i.e., ‘MP3’) audio file (with file name suffix “.mp3”)
  • A WAV (PCM) audio file (with file name suffix “.wav”)
  • An AMR audio file (with file name suffix “.amr”)
  • An AC-3 audio file (with file name suffix “.ac3”)
  • An AAC (ADTS format) audio file (with file name suffix “.aac”)

《live555 media server rtsp 流媒体服务器搭建成功经验分享》有一个想法

评论已关闭。