freemocap / skellycam

The camera back-end for the `freemocap` project - or - An easy and efficient way to connect to one or more cameras and record synchronized videos💀📸
GNU Affero General Public License v3.0
19 stars 6 forks source link

Detect virtual cameras #20

Closed mprib closed 1 year ago

mprib commented 1 year ago

The module DetectPossibleCameras was revised to implement the method I'd been using with calicam. One note here is that this did now work when directly connecting via DSHOW on windows, so I revised the capture object to connect using the default cv2.CAP_ANY.

For some reason, when the capture is connected to in this way (ANY), the capture does not need to have the resolution set exactly in order to change it. It will find the closest available resolution that it can, and this behavior is the critical part of it.

Virtual cameras that I've seen only present with one available resolution, and this can be used to identify them.

I've successfully tested this out on my windows machine while running OBS. I had hoped to test on my beater linux laptop, but have been having issues getting an environment up and running on it so decided to stop wasting time on that and push this out. Happy to discuss any questions or problems getting this working on your end.

mprib commented 1 year ago

I wanted to add:

mprib commented 1 year ago

The threaded implementation has been merged in now. The non-threaded solution for 3 cameras took an average of 14 seconds to complete and the threaded solution took 6.5 seconds. Apologies for the confusion with the multiple merges...I wasn't sure how to make this two discrete steps with github.

On to GUI stuff....

jonmatthis commented 1 year ago

The non-threaded solution for 3 cameras took an average of 14 seconds to complete and the threaded solution took 6.5 seconds.

Oh yeah, that's a huge speed up! Definitely worth it

jonmatthis commented 1 year ago

. Apologies for the confusion with the multiple merges...I wasn't sure how to make this two discrete steps with github.

You did this correctly!

A pull-request is a "request to merge your branch on to my branch" - When I request changes, you just keep adding new commits to that branch (like you did) and when its ready we merge the branches

If we wanted to put the changes into two discrete steps (e.g. if it had wound up being more work than expected), we could have just merged the branch as-is, and then you could submit a new PR with the new changes

jonmatthis commented 1 year ago

Could you please allow me to make edits? I want to make a few stylistic changes and it'd be easier to do that myself vs requesting you to do it :)

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork#enabling-repository-maintainer-permissions-on-existing-pull-requests

mprib commented 1 year ago

Sounds good. Hopefully should be editable now:

image

jonmatthis commented 1 year ago

Oh shoot, I didn't mean to push those commits to your branch 😅

jonmatthis commented 1 year ago

Looks good! I made a few changes to your variable names and added _ to the front of your private methods (i.e. the ones that aren't meant to be accessed from the outside)

Happy to merge it in now, thanks for the work on this!!

mprib commented 1 year ago

Awesome! My first accepted PR!