How to record video automatically with multicopter

I want to record a video while hovering and stop recording while moving automatically.
I hope that both modes such as mission mode and manual mode like position flight mode will be applied.
I recognized that the trigger can be activated at every way-point in the mission planning menu. But what I want is to activate the trigger to record the image when hovering is detected, and to turn off the recording when the drone is detected to move.

How can I apply this feature?

Not sure how to do it if you want to run it on the Pixhawk. But if you have a companion computer it is very simple, make a program using MAVSDK to read if the drone is loitering or moving and turn on/off the camera from there.

Thanks for your answer!

Then, is it eough to use raspberry pi as companion computer?

Yes a Raspberry pi works perfectly as a companion computer, just install Ubuntu server on it with Ros and Mavlink and you are good to go.

I’ve recorded videos with a drone before and what you’re looking for might require custom scripting or advanced drone settings that can detect and respond to movement or lack thereof. Some drones have intelligent flight modes that can start or stop recording based on specific conditions. Check your drone’s manual or software settings for any such features that can be programmed for this task.

After recording, editing is crucial to stitch together the best parts. I used Movavi for editing my drone footage because it’s easy to use and handles MP4 files well. For editing tools, you might find this useful: 11 BEST Free MP4 Editors 2024 [Windows & Mac].