Hi i want to make a program that will continually record a video and on a press of a button, it will save 2 minutes before i pressed the button is it possible to do it somehow ?
Both the third-party Python picamera API and the official raspivid command-line program support this. picamera calls it "circular stream" and the flag for raspivid is
You really should study the excellent picamera documentation in-depth since it discusses easy and complex applications of circular buffers. One wonders how people not using Python cope, seeing that their Raspberry camera libraries are almost abysmal in comparison.