Home > Forum > Best method to switch between 2 network camera sources

Best method to switch between 2 network camera sources

Apr 18, 2019
Steve Harrison wrote
I am trying to create a video switcher to switch between two network cameras.

I have a windows form with 3 video capture controls on it Cam1 Cam2 and Output, the code is set to load up the urls of the two cameras at start up and the two camera feeds display in the form.

What is the best method to seemlesly switch between the two camera feeds.

the code below works by there is a slight gap as i switch inputs

videoCaptureMain.IP_Camera_Source = videoCapture2.IP_Camera_Source;
videoCaptureMain.Mode = videoCapture2.Mode;
videoCaptureMain.Debug_Mode = videoCapture2.Debug_Mode;
videoCaptureMain.Debug_Dir = videoCapture2.Debug_Dir;

videoCaptureMain.Start();

i cant help but feel .Start() is not the correct way of doing this, i tried .Refresh() and RefreshLists(true,true,true) and also .Update() but none change it over with the exception of using .Start();

any help greatly appreciated.


Reply
5 Answers
Apr 18, 2019
Roman Miniailov agent wrote
2 camera controls for 2 sources, and you can show and hide control on form, instead start and stop calls. Also, if audio present you need to mute and unmute.

So, just trick, not some special another control usage.
Apr 19, 2019
Steve Harrison wrote
My problem is as well as switching between two network video sources, I want to record the resultant switched output to a single file.

Your suggestion of having two video capture objects and just resizing / moving on the fly to give me a switched effect would not work, I think.

This was why i hit on the idea of two capture objects for the camera inputs and one capture object as the main display / recording system, then all i needed to do was make the main display "take" the settings of the selected camera input. This does work but i would have liked to end up with less of a gap when doing the switch.

If you had any ideas for achieving the "seamless" switch from camera to camera AND doing the recording as a single stream i would be most appreciative.
Apr 19, 2019
Roman Miniailov agent wrote
Do you need audio also from sources?
Apr 19, 2019
Steve Harrison wrote
no, i will have a single audio feed coming in to the sound card. There is no audio requirement from either of the cameras.
Apr 19, 2019
Roman Miniailov agent wrote
Using Picture-in-Picture engine we can set one source to cover entire screen and second to be in background. But, both sources need to be started at the same time. So, not dynamic switch really.