Hi , Could anyone share an example code or project to interface with IP Camera [RSTP or ONVIF] and streaming video on the screen?
a simple htmlviewer with the ip address of the camera ?
Yes Jean-Yves. Anything will do first. I was hoping to able to display the video in a Image box on a Window.
not in an image box, use an htmlviewer instead. it should work straight.
ive been fighting with such things on and off over the years and its a true pain. Apple removed any direct support for RTSP years ago and there are no good solutions for handling it otherwise. You can try to include the VLC libraries into the app but my success at that has been severely limited, it leaks memory hugely and hangs up after just a few minutes. Your experience might be different though so dont let me dissuade you from trying. It may work better on windows I dont know. Onvif is just a way to discover cameras and what their real connection addresses are automatically, the connection method is still likely to be RTSP in which case youre still in trouble for getting their video directly.
The idea of just linking an HTML viewer to the real camera IP is a good one with a few potential problems. Youll likely have to sign into each camera display separately. Many cameras still require a plugin to display their contents and Im not sure where to place that so it will load. On MacOS these are ALL broken as far as I can tell as there are none that meet the new security requirements so for many cameras there is no way to actually view them on a Mac at all and I have no idea if windows will still let you use less secure browser plugins or not but if so then their time is running out there too as that wont last forever.
If you have control over which camera brands and models youre wanting to support then you can pick some that will work via that method and tell people what to use, if you want to support many different things that are out there right now then its much more difficult.
The HTML viewer will work for just viewing, but if you wanted actual access to the video streams for recording or taking snap shots that are not just a screen shot of the viewer then its going to be very difficult.
Thanks you , Guys. YOU are the Best of the Best…
I actually just finished part of a project doing this again I used ffmpeg in a shell to connect to the RTSP stream and then transcode the video at a lower framerate to mjpeg. I wrote a progressive MJPEG parser class which sends me events as it receives each frame and just keeps swallowing data from the ffmpeg process. You cant use stdin for the data as its VERY slow but sending through a TCP socket is very easy. Its still not as ideal as if we had the ffmpeg libraries as a plugin in Xojo (christian are you listening?) but it does work and I can get the latency down to about a second and a half which isnt so bad really.
There was also a brand new VLC release recently which added a lot of hardware acceleration. I havent tried to include those libraries in my app anymore but it was REALLY hard to do previously. I have notes around here about how to use the various command line tools to change their include paths so they would find themselves inside another app. It was so much work and leaked so much memory and dropped the connection so badly that I am not really thinking I need to do that now with ffmpeg being able to run in a shell and do the translation for me…