Tyelab / bruker_control

Repository for code running the lab's multi-photon imaging experiments at the Bruker Ultima Investigator scope. Unites Arduino, Prairie View, and GenTL machine cameras in Python.
Mozilla Public License 2.0
7 stars 3 forks source link

Use skvideo or pycam instead of opencv #90

Open jmdelahanty opened 2 years ago

jmdelahanty commented 2 years ago

Using scikit-video will allow us to better control how video is written to disk than opencv, so it'd be worth it to try updating the scripts to use the package instead for actually writing out video frames.

jmdelahanty commented 2 years ago

Changing name of this issue to reflect that we will likely want to use pycam for future work

jmdelahanty commented 1 year ago

At least for now skvideo is working! Check out #110

jmdelahanty commented 1 year ago

It appears that skvideo might be slower performance wise than the way opencv is used, or at least the way that I'm using it yields writing to disk/data collection that's a lot slower than the about 30FPS triggers. Needs more testing before it's put into main.

jmdelahanty commented 1 year ago

I noticed today that videos taken recently using the main branch are extra long. An experiment typically takes about 33 minutes (or so) but the output videos are closer to 40 minutes. I did some quick inspection with ffmpeg, opencv, and ffprobe and they all confirm that there are too many frames in the videos.

I'm very concerned that what I did with #90 has inadvertently messed up the video data collection from these days. I'm going to revert back to the cv2 writer. I've reached out to Annie and Jonny to see what they think about this.

Visual inspection of the videos doesn't seem to point to anything especially wrong. I don't notice any jitter in the video itself and I don't see any clear indication that something has gone awry through visual inspection. However I think that with sleapyfaces it will have problems if the frame numbers don't make any sense.

I can't for the life of me figure out how all these extra frames appear. The most likely cause is that I'm using the skvideo.io writer incorrectly somehow even though it appears to be incredibly straightforward and doesn't seem to issue any trouble during the recording of the experiment.

The only other thing would be that the frame triggers from the scope are being strange again and there's errant triggers arriving to the camera.

Given this strangeness is something I can't explain and don't undersstand, I'm going to reopen this issue and revert back to opencv for this.