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 5 forks source link

FastApi re-architecture #52

Open jonmatthis opened 4 months ago

jonmatthis commented 4 months ago

A complete overhaul of the backend/frontend architecture and strategy. Frontend and Backend now connect via FastAPI uvicorn server.

TO DO before merge:

...probably other stuff too

jonmatthis commented 4 months ago

Finally got the basic proof of concept working for the FastAPI skellycam refactor - Check it out if you're curious (main.py is the entry point, only the start session button is connected, there's still a lot of tech debt/slop in here that I'll clean up soon (e.g. the websocket stuff is vestigial, everything happens through the http_router.py endpoints)

https://youtu.be/VK1gcdzoYpo

philipqueen commented 4 months ago

@jonmatthis When I run it the gui loads and it tries to connect to my cameras (internal webcam and orphaned OBS camera) but never gets past a "connecting to camera" screen for each camera, while the logs say

[2024-02-22T10:22:51.670373] [Δt:0.030193s] [   DEBUG] [skellycam.frontend.api_client.api_client] [api_client:get_latest_frames():76] [PID:61667:Process-2 TID:4379936128:MainThread ] Sending request to the frontend API `latest_frame` endpoint
INFO:     127.0.0.1:51369 - "GET /latest_frames HTTP/1.1" 200 OK
[2024-02-22T10:22:51.671751] [Δt:0.001245s] [   DEBUG] [skellycam.frontend.api_client.api_client] [api_client:get_latest_frames():78] [PID:61667:Process-2 TID:4379936128:MainThread ] Response: <Response [200 OK]>
jonmatthis commented 4 months ago

@philipqueen @aaroncherian @trentwirth

This is starting to work now, I think I fixed the bug that @philipqueen hit last time

Its a significant upgrade from current fxnality, but fps still drops on more than a few 1080p streams, though it can handle quite a few 720p ones.

Please give it a shot when you get a chance - connect to cameras and record some vids with different #'s of cameras & diff resolutions please - check the stats that are printed to the terminal to see if the measured fps matches the target

Lots of broken buttons, zombie process problems and whatnot, so if things get borky just restart program

When its running you can check out the Swagger docs at http://localhost:8000 (or check the link in the terminal)

Again, this is known broken in many ways, but it would help for y'all to stress test on your various machines

jonmatthis commented 4 months ago

@philipqueen @aaroncherian @trentwirth

Play close attention to the general architecture, happy for feedback and questions before we start pulling this over to freemocap

entry is __main__.py - let me know if you get lost 💫

When in doubt, draw it out (things like draw.io are helpful here)