我正在从命令行运行 ffmpeg
(Windows 7、64 位)以从 RTSP 流(来 self 的 DVR 的第二个 channel )获取帧:
ffmpeg -i "rtsp://xxx.xxx.xxx.xxx:554/user=xxxx&password=xxxx&channel=2&stream=0.sdp" -rtsp_transport tcp -y video.jpg
运行后,它等待大约 10 秒,然后我得到:
[rtsp @ 026fd840] UDP timeout, retrying with TCP
又等了很久(2 分钟左右),我得到:
[rtsp @ 028dd840] Could not find codec parameters for stream 0 (Video: h264): unspecified size
我在某处读到我必须强制使用 TCP,因为从 UDP 更改为 TCP 将不起作用。
我不明白为什么 -rtsp_transport tcp
不工作。
我正在使用 ffmpeg version N-62509-g97751e1 build on Apr 17 2014 22:01:31 with gcc 4.8.2 (GCC)
。
请帮帮我。 谢谢。
最佳答案
只需将 -rtsp_transport tcp
放在 ffmpeg
之后,即可将其应用于输入流。像这样:
ffmpeg -rtsp_transport tcp -i "rtsp://x.x.x.x:554/user=x&password=x&channel=2&stream=0.sdp" -y video.jpg
关于tcp - 强制 FFMPEG 在读取 RTSP 流时使用 TCP 协议(protocol),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23238295/