执行 openRTSP 报错

运行live555MediaServer,提示以下信息:

**@**:~/Desktop/live555/live/mediaServer$ ./live555MediaServer 
LIVE555 Media Server
	version 0.96 (LIVE555 Streaming Media library version 2019.03.06).
Play streams from this server using the URL
	rtsp://172.16.13.163:8554/
where  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 8000 for optional RTSP-over-HTTP tunneling, or for HTTP live streaming (for indexed Transport Stream files only).)

然后运行openRTSP出现以下错误:

**@**:~/Desktop/live555/live/testProgs$ ./openRTSP -d 20 -f 20 -w 640 -h 480 -b 400000 "rtsp://172.16.13.163/stream.264"
Created new TCP socket 3 for connection
Connecting to 172.16.13.163, port 554 on socket 3...
...Connection to server failed: Connection refused
Created new TCP socket 3 for connection
Connecting to 172.16.13.163, port 554 on socket 3...
...Connection to server failed: Connection refused
Failed to get a SDP description for the URL "rtsp://172.16.13.163/stream.264": Connection to server failed: Connection refused

再次回去看 live555MediaServer 的运行信息看到:

Play streams from this server using the URL
	rtsp://172.16.13.163:8554/

突然想到用vlc播放时也是要加端口号,然后将其修改为:

./openRTSP -d 20 -f 20 -w 640 -h 480 -b 400000 "rtsp://172.16.13.163:8554/stream.264"

openRTSP 正常运行。

------------------------------------------------------------------------------------------------------------------------

live555MediaServer 申请端口的源码

  RTSPServer* rtspServer;
  portNumBits rtspServerPortNum = 554;
  rtspServer = DynamicRTSPServer::createNew(*env, rtspServerPortNum, authDB);
  if (rtspServer == NULL) {
    rtspServerPortNum = 8554;
    rtspServer = DynamicRTSPServer::createNew(*env, rtspServerPortNum, authDB);
  }
  if (rtspServer == NULL) {
    *env << "Failed to create RTSP server: " << env->getResultMsg() << "\n";
    exit(1);
  }

默认使用554端口,如果失败再使用8554端口,如果都失败则输出错误并退出,也就是说我运行 live555MediaServer 用的是8554端口,所以在使用时要指定端口号为8554。

你可能感兴趣的:(ERROR,openRTSP,live555)