Skip to content

Instantly share code, notes, and snippets.

@Manoj-nathwani
Last active May 7, 2022 01:39
Show Gist options
  • Save Manoj-nathwani/a78e23a18dda38cf6a301eaec7d1bc81 to your computer and use it in GitHub Desktop.
Save Manoj-nathwani/a78e23a18dda38cf6a301eaec7d1bc81 to your computer and use it in GitHub Desktop.
picamera video
import os
from time import sleep
import picamera
camera = picamera.PiCamera()
camera.hflip = True
camera.vflip = True
i = 0
while os.path.exists('/home/pi/Downloads/video_{}.h264'.format(i)):
i += 1
while True:
video_name = '/home/pi/Downloads/video_{}.h264'.format(i)
print('Recording video' + video_name)
camera.start_recording(video_name)
sleep(10)
camera.stop_recording()
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment