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

Get cameras working on mac (fastapi branch) #54

Open philipqueen opened 7 months ago

philipqueen commented 7 months ago

This PR adds mac support for cameras by assuming that once any virtual cameras are removed from the QCameraDevice list, the device list lines up with the cv2 ports. That is, it assumes any virtual camera is always shown last in the cv2 ports.

Also adds some error handling in the parsing code for non mac/windows code.

philipqueen commented 6 months ago

Got some weird behavior when actually recording with this. It say's the webcams I used were running at 5 fps, and that it would default to slowest framerate. However, display clearly showed it was recording at faster than 5 fps. Then when checking the output videos, the two webcams recorded at 5 fps and my internal camera at 30.

I'm getting fps info from ffprobe, and it matches the video playback speed. Timestamp info looks normal though:

    'timestamp_stats_by_camera_id': {   0: {   'mean_frame_duration_s': 0.03938690085542169,
                                               'mean_frames_per_second': 25.38915167940531,
                                               'std_dev_frame_duration_s': 0.02373020642672382},
                                        1: {   'mean_frame_duration_s': 0.03932604844578313,
                                               'mean_frames_per_second': 25.428438389345178,
                                               'std_dev_frame_duration_s': 0.02341737166964161},
                                        2: {   'mean_frame_duration_s': 0.03935551957831326,
                                               'mean_frames_per_second': 25.409396463693167,
                                               'std_dev_frame_duration_s': 0.02102969659997065}},

And here's the error message I'm getting:

[2024-03-16T16:31:35.735441] [Δt:0.020952s] [ WARNING] [skellycam.backend.core_functionality.camera_group.incoming_frame_wrangler] [incoming_frame_wrangler:prescribed_framerate():57] [PID:96597:Process-1 TID:6404059136:Thread-1 ] Frame rates are not all the same: [5.0, 5.0, 30.0] - Defaulting to the slowest frame rate