How to get multiple cams connected - vb.net

I am trying to connect multiple webcams at the same time but it produces the Video source dialog to select the webcam. IS there any way to bypass it? Can I pass the webcamm info explicitly?
Here is the code that is producing the problem
Dim infoReturn As VariantType
infoReturn = SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0)
If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then
'Set the preview scale
Call SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)
WM_CAP_DRIVER_CONNECT is the message that shows the dialog.
any help will be appreciated.
Thanks

You send WM_CAP_DRIVER_CONNECT twice, you don't need to. This is ancient Video for Windows API and you don't have flexibility to override default behavior, nor you have support for full range of video capture sources with it.
Perhaps you should rather look into switching to newer APIs (DriectShow/Media Foundation).

Related

When having a p2p webtrc connection, how to use different resolutions for the video call and the photo capture?

I'm working on a p2p webtrc video call between HoloLens2 and PC. I also need to support the capturing of photos(and send photos to the server). Now the video and photo can be supported with a resolution of 2272x1278, but I need the photo resolution of 3904x2196(the highest value that HoloLens2 provides).
The problem is when I am trying to change the resolutions, I found I had no limit when the call continues.
I use MediaCapture to take a photo. And the WebcamSource based on MixedReality-WebRTC running on the SharedReadOnly mode. I thought of one way to solve this: shut the call down when taking a photo, and restart it after capturing finished. But the problem is
How can I set the mode to exclusive WebcamSource when just capturing the photo?
Can I make sure when the call had been shut down, the WebcamSource is released?
Or if there is another way to use different resolutions for the video call and the photo capture? Thanks a lot.
How can I set the mode to exclusive WebcamSource when just capturing the photo?
No, SharingMode has hardcoded in the UwpUtils and does not expose any API to access.
Can I make sure when the call had been shut down, the WebcamSource is released?
To make sure dispose of audio and video tracks and media sources last, please reference the following code:
localAudioTrack?.Dispose();
localVideoTrack?.Dispose();
microphoneSource?.Dispose();
webcamSource?.Dispose();

IMFSourceReader.ReadSample never hitting callback after reading on stream 1. calls to stream 0 work fine

So background im working on reworking an application that was using direct show to use Windows Media Foundation. in Directshow i have UVC camera still pins working fine. however when i switched to using a SourceReader in WMF i have stream 0 (the live video stream) however when i use the same interface to try and request samples on Stream1 i dont receive anything. This is with the following call.
hr = StreamReader.ReadSample(1,
MediaFoundation.ReadWrite.MF_SOURCE_READER_CONTROL_FLAG.None,
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero
);
if i switch it to
hr = StreamReader.ReadSample(1,
MediaFoundation.ReadWrite.MF_SOURCE_READER_CONTROL_FLAG.Drain,
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero,
IntPtr.Zero
);
i receive only null IMFSamples. ive checked the state of hr and it is always S_OK. During this time i am also running the same call but on stream 0 and it is working fine. The only error or flag i get is StreamTick on the first frame on stream 0.
Im not entirely sure where to go from here if anyone has suggestions im open
Edit1:
I do have streams selected for both and the desired MediaTypes set with SetCurrentMediaType
There is IMFSourceReader::SetStreamSelection method to configure the reader and set it to expect or not expect samples on specific streams. You need to make sure you selected the stream before reading from it.

Deleting content from Sony a6300 camera

I am developing a python remote control application using the open source pysony library. The program should be able to shoot images in a loop, download them and then delete the artifacts on the camera (We can't manually format the sd card, since the idea is that, of a remote control application).
I'd like to point out, that I have read this post about the correct way of remotely deleting files. I have read the Sony API documentation and have successfully managed to control everything I need to, but the deletion of images. The camera in question is a Sony a6300, updated to the latest firmware as is its API.
The problem in question is the fact that the camera returns a success response ({'result': [], 'id': 1}) after trying to delete a set of image URIs, but the images still remain on the camera. I am using the remote control app and am connected directly to the camera wifi (making this the standard 1:1 connection). When I issue the delete command, the screen of the camera shortly displays a "controlling with smartphone... you cannot directly operate this device" message.
I have searched all around the www an can't seem to find and aswer.
Thank you in advance!

DSC-HX400 RAW image data & Movie Recording

I am currently testing a DSC-HX400. While I am able to do almost everything I need to with the camera there are a couple of items that are not exposed via the API that have frustrated my efforts.
1) The camera does not seem to offer an option, via the API or the camera itself, to capture images in RAW format. It does offer standard & fine JPEG format but both of those are leaving artifacts in the image that become extremely noticeable when you zoom in with an image editor. Is there a way to get the camera to capture RAW images? I do not need the SDK to return the data just to save it out to the card. If getting the RAW data is impossible has anyone found an inventive way to clean up the artifacts?
2) The camera supports both still shoot and movie mode but the API will only expose the mode that I am currently in. It makes it impossible to transition between still to movie mode (to allow recording) from the API but I can do that same transition by pressing a single button on the camera. Once I am recording a movie the API will allow me to transition back to still mode (by cancelling recording). Is there plans to support the ability to trigger a movie recording via the API if you are in a still capture mode (Seeing the firmware already supports this functionality)?
Answers to the questions below:
If the camera cannot capture RAW images, the API will not be able to either. I do not know of a way to capture RAW images but can only comment with regards to the API as I am not an expert on usage of the camera itself.
You can change between still and movie mode by using the "setShootMode" API.

how to connect disconnect the camera device using getUserMedia and webRTC

I am creating an audio/video and chat application using webRTC and Node.js. I need to mute and unmute the camera device.
Presently, I am able to disconnect and the other party is not able to see me, but the problem I see is that it doesn't disconnect the camera. It still remains active and connected as I see the camera flash still on.
I need help how to disconnect when muted and connect it back when unmuted. I want the same feature as we see in skype video call.
It varies a bit between Firefox and Chrome. These steps, in this order, work for me.
1) Set the src property on your video element to empty string ''.
2) Make sure the stop method exists before calling it as a function. Firefox doesn't have it, and if you try to run it, your code will throw an error.
if (localStream && localStream.stop) {
localStream.stop();
}
3) After you call cameraStream.stop() (or not), set localStream = null. (Maybe not actually necessary, but it couldn't hurt to let the object get garbage-collected. And when the user asks to start the camera up again, you can check against the variable to see if you need to clean up after the previous stream before starting a new one.)
When you are getting your media, in your success callback function you have to keep your localstream in a variable. Then, when you want to stop your stream, you can do localstream.stop();
To start again, you can repeat to call your getUserMedia() method again.