Sunday, June 30, 2024

Program D-Link DCS-5010L - Part 3

 As mentioned in Program D-Link DCS-5010L - Part 2, I wasn't able to successfully open DCS-5010L stream with OpenCV+GStreamer, so I'm going to explore OpenCV+ffmpeg. Ffmpeg is famous OpenSource Multimedia framework which contains a set of utility with almost all codec supported. Here is a Ffmpeg vs. GStreamer comparison.

To going this approach, there is FfmpegCV, which might be served as OpenCV replacement with ffmpeg support, has compatible API as OpenCV. Here I'm going to give it a try. Similar as using GStreamer, would need to install ffmpeg executable separately. Then do: pip install ffmpegcv

This will install the stable version, without cuda acceleration as I don't have nVidia GPU. After trying around, I realized that I need to use this API to open the stream:

cap = ffmpegcv.VideoCaptureStream(stream_url)

However, I don't see how it can help to play the audio.

Then I turned to PyAV. With that, I figured out that the 'video.cgi' would only provide video stream. Need to open 'audio.cgi' for the audio stream which is in wave format.

I added my code to forked dlink-dcs-python-lib github repository, with arrow key support for tile/pan the camera. There is no need to put the OpenCV video into a Tcl/tk gadget, but may create a TK GUI for setting configuration/options such as video file saving path, resolution, motion detecting and so on.

0 Comments:

Post a Comment