How to get gravity direction?

The gyroscope data is not attached to the frames of video in a way that we can extract. We do not know the location of the sensor data in the video files.

You can build a plug-in to record the sensor data in an independent log file and then use the plug-in to trigger the video and match up the gyro sensor file and the video