我有脚本,从wifi摄像头用ffmpeg捕捉图像。它可以正常工作,直到摄像头由于网络故障无法到达为止。脚本卡在ffmpeg捕获和永不退出。有可能出现某种超时吗?-stimeout (毫秒)似乎不起作用。
脚本中有一部分可以捕获图像。(在那之后有一些操纵)
#!/bin/bash
week="$(date '+%Y_%U')"
ts="$(date '+%Y-%m-%d_%H:%M:%S')"
ffmpeg -rtsp_transport tcp -y -i "rtsp://192.168.64.101" -frames:v 1 $week/$ts.jpg -stimeout 3000 -y
我在其他相机上做了测试,结果如下:
ffmpeg -y -i "rtsp://192.168.64.112:8554/profile0" -frames:v 1 Ilatest.jpg
工作正常,但超时时间为5秒
ffmpeg -timeout 5000000 -y -i "rtsp://192.168.64.112:8554/profile0" -frames:v 1 Ilatest.jpg
我得到了错误报告,因为:
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
...
...
[rtsp @ 0x55d250488740] Unable to open RTSP for listening
rtsp://192.168.64.112:8554/profile0: Cannot assign requested address
发布于 2022-02-12 20:50:43
RTSP协议文档表示有timeout
选项。我试着:
ffmpeg -rtsp_transport tcp -stimeout 3000 -y -i "rtsp://192.168.64.101" ...
https://stackoverflow.com/questions/71095477
复制相似问题