Hi Changhao,
Thanks for the detailed post!
The UVC protocol we use to send video frames from the Miniscope DAQ to the computer has the possibility of frame drops when the USB port on the computer is not able to keep up with the data stream coming from the Miniscope DAQ. The Output Toggles of the DAQ will account for every since frame that was received by the Miniscope DAQ but once in a while you will get a DAQ output toggle without that frame making it all the way to the computer. This is a dropped frame and will show up as a difference in Output Toggles and TimeStamp_num. The rate of frame drops will depend on your computer hardware, and to a lesser extent, the stability of the coax cable connection between the Miniscope and DAQ. It looks like you are averaging just a few frame drops per 10K frames which should be very very minor. The timeStamp.csv file only saves time stamps of non-dropped frames, so just use these frame numbers and timestamps for analysis.
Also, while you can set the FPS as "30FPS" or 20FPS" (for example) the actual FPS will be very slightly off from exactly that number. So instead of a frame length of exactly 33.333333ms for 30FPS it might be 33.3ms or 33.4ms. This will end up resulting in not exactly 9000 frames for 5min. This slight difference is due to the timing resolution of the registers within the image sensor.
Let me know if you have any other questions I did not address.