Aharoni-Lab / Miniscope-DAQ-QT-Software

Software for streaming and controlling neural and behavioral data from freely behaving animals
GNU General Public License v3.0
116 stars 28 forks source link

Why is recorded video fixed 60 fps? #46

Closed m11o closed 2 years ago

m11o commented 2 years ago

When recording video by miniscope v4 and miniscope-DAQ, recorded video is fixed at 60 fps. If frameRate is 20 in a user configuration file, I think the recorded video is wanted to save with the same fps. However, it is currently saved with 60 fps. So, when it is displayed by a video player (VLC etc...), it is played faster than real.

Would you please tell me why the recorded video is fixed at 60 fps? Thanks!

ref: https://docs.opencv.org/4.1.0/dd/d9e/classcv_1_1VideoWriter.html#a0901c353cd5ea05bba455317dab81130 https://github.com/Aharoni-Lab/Miniscope-DAQ-QT-Software/blob/4999be0ce0e2cf7d8da4c0bed6ffe0b679cd90ea/source/datasaver.cpp#L202-L204 https://github.com/Aharoni-Lab/Miniscope-DAQ-QT-Software/blob/4999be0ce0e2cf7d8da4c0bed6ffe0b679cd90ea/source/datasaver.cpp#L207-L209

daharoni commented 2 years ago

We save Miniscope videos at a noticeably wrong playback FPS in the hopes that users will not use the playback FPS/timing for actually timestamping each frame. The timing of Miniscope and behavior data is saved in the timestamp.csv files and this is what should be used for acquisition timing during analysis.

Additionally, we set the playback FPS at 60FPS because it often makes it easier to see neural dynamics by eye when the recording is played back at a faster FPS than it was recorded. This can make quickly reviewing past recordings easier in some cases.

m11o commented 2 years ago

Great! Thank you for your replying.

DenisPolygalov commented 2 years ago

@daharoni then why frameRate option is available in a configuration file? So a user can request FPS=20 Hz in configuration file, right? Or I am missing something? How according to you as the software author users should use this option? I what circumstances?

daharoni commented 2 years ago

The user configuration file allows you to set the default frame rate the Miniscope will initially stream at. You can then further adjust the FPS using the controls within the software.

In other words, users can adjust the real Miniscope FPS (10, 15, 20, 25, 30FPS) using the user config and in software controls but the recorded .AVI files will always have a "playback" FPS of 60. This playback FPS is completely independent of what the Miniscope was actually running at.