简体   繁体   English

强制FFMPEG在读取RTSP流时使用TCP协议

[英]Force FFMPEG to use TCP protocol when reading a RTSP Stream

I'm running ffmpeg (Windows 7, 64bit) from command line to get a frame from a RTSP stream (second channel from my DVR): 我从命令行运行ffmpeg (Windows 7,64bit)以从RTSP流(我的DVR的第二个频道)获取帧:

ffmpeg  -i "rtsp://xxx.xxx.xxx.xxx:554/user=xxxx&password=xxxx&channel=2&stream=0.sdp" -rtsp_transport tcp -y video.jpg

After running, it waits for about 10 seconds and then i get: 运行后,等待大约10秒然后我得到:

[rtsp @ 026fd840] UDP timeout, retrying with TCP

After another long wait (2 minutes or so), i get: 经过另一个漫长的等待(2分钟左右),我得到:

[rtsp @ 028dd840] Could not find codec parameters for stream 0 (Video: h264): unspecified size

I read somewhere that I have to force using TCP, because changing from UDP to TCP will not work. 我在某处读到了我必须强制使用TCP,因为从UDP更改为TCP将无法正常工作。

I don't understand why -rtsp_transport tcp is not working. 我不明白为什么-rtsp_transport tcp无效。

I'm using ffmpeg version N-62509-g97751e1 built on Apr 17 2014 22:01:31 with gcc 4.8.2 (GCC) . 我正在使用ffmpeg version N-62509-g97751e1 built on Apr 17 2014 22:01:31 with gcc 4.8.2 (GCC)

Please help me. 请帮我。 Thank you. 谢谢。

Just put the -rtsp_transport tcp right after ffmpeg to apply it on the input stream. 只需在ffmpeg之后放置-rtsp_transport tcp即可将其应用于输入流。 Like this: 像这样:

ffmpeg -rtsp_transport tcp -i "rtsp://x.x.x.x:554/user=x&password=x&channel=2&stream=0.sdp" -y video.jpg

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM