Hello, i have been stuck the last couple of days trying to solve this error. I am currently trying to capture a rtsp stream using opencv. I am using the following command to try and capture it. cv::VideoCapture capture(“rtsp://192.168.1.220:10101/stream/1”); W
When I run this line i run into the following error [ WARN:0@30.091] global cap_ffmpeg_impl.hpp:453 _opencv_ffmpeg_interrupt_callback Stream timeout triggered after 30072.553324 ms.
I have also verfied the stream can be captured running the following command ffmpeg -i rtsp://192.168.1.220:10101/stream/1 -c copy output.mp4.
I am using 4.12. After exporting the variable I am now getting this output.
[RTSP demuxer @ 0x5ed1fb95ee00] [Eval @ 0x7ffff543d260] Undefined constant or missing ‘(’ in ‘tcp’
[RTSP demuxer @ 0x5ed1fb95ee00] Unable to parse option value “tcp”
[RTSP demuxer @ 0x5ed1fb95ee00] Error setting option rtsp_flags to value tcp.
[ WARN:0@0.048] global cap.cpp:215 open VIDEOIO(FFMPEG): backend is generally available but can’t be used to capture by name
I’m confused by your error if you are able to stream using ffmpeg from the command line with the exact same string (no username/password) and it is an rtsp stream it should work in OpenCV hopefully the additional logging will shed some light on the situation.
yea i am using a container to run it. so i am just setting it when i make the container using ENV.
adding the debug logs gives me the following errors.
[ WARN:0@0.045] global cap.cpp:141 open VIDEOIO(FFMPEG): trying capture filename=‘rtsp://192.168.1.220:10101/stream/1’ …
[DEBUG:0@0.045] global cap_ffmpeg_impl.hpp:1150 open VIDEOIO/FFMPEG: using capture options from environment: rtsp_flags;tcp
[RTSP demuxer @ 0x5cbc8c8f6f40]
[Eval @ 0x7ffe8af5f9b0] Undefined constant or missing ‘(’ in ‘tcp’
[RTSP demuxer @ 0x5cbc8c8f6f40] Unable to parse option value “tcp”
[RTSP demuxer @ 0x5cbc8c8f6f40] Error setting option rtsp_flags to value tcp.
[ WARN:0@0.045] global cap.cpp:164 open VIDEOIO(FFMPEG): can’t create capture
[ WARN:0@0.045] global cap.cpp:215 open VIDEOIO(FFMPEG): backend is generally available but can’t be used to capture by name
[DEBUG:0@0.045] global cap.cpp:234 open VIDEOIO: choosen backend does not work or wrong. Please make sure that your computer support chosen backend and OpenCV built with right flags.
Also here is how i am installing open cv for my container
RUN apt-get update
RUN apt-get install -y
openssh-server
vim
net-tools
iputils-ping
iproute2
sudo
ffmpeg \
libgstreamer1.0-dev
libavcodec-dev
libavformat-dev
libswscale-dev
libv4l-dev
libx264-dev
gstreamer1.0-plugins-base
gstreamer1.0-plugins-good
gstreamer1.0-plugins-bad
gstreamer1.0-plugins-ugly
gstreamer1.0-libav
libgstreamer-plugins-base1.0-dev
libgstreamer1.0-0
RUN apt-get install -y
wget
git
unzip
RUN apt-get update &&
apt-get install -y build-essential gdb cmake libboost-all-dev &&
apt-get clean
RUN mkdir -p ~/opencv cd ~/opencv &&
wget https://github.com/opencv/opencv/archive/4.12.0.zip &&
unzip 4.12.0.zip &&
rm 4.12.0.zip &&
mv opencv-4.12.0 OpenCV &&
cd OpenCV &&
mkdir build &&
cd build &&
cmake
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=/usr/local
-DWITH_FFMPEG=ON
-DWITH_QT=ON
-DWITH_GSTREAMER=ON
-DWITH_OPENGL=ON
-DFORCE_VTK=ON
-DWITH_TBB=ON
-DWITH_GDAL=ON
-DWITH_XINE=ON
-DBUILD_EXAMPLES=ON .. &&
make -j4 &&
make install &&
ldconfig
Great news. So it opens with tcp but doesn’t send any frames so the prefer_tcp option doesn’t fall back to udp. Maybe a bug in the the way OpenCV is using the ffmpeg lib but will be impossible to re-create without the camera you are using.
Is it easy for you to check what the output is without the addition of the OPENCV_FFMPEG_CAPTURE_OPTIONS flag but with the additonal debug flags so I can see if there is anything obviously wrong?