I have written a script using python (flask) which runs on local service
the scripts purpose is to create a video and store on my raspberry pi desktop which works
but after this video is created while a preview is shown, the camera crashes.
This is what I am trying below
import os import os.path from flask import Flask from picamera import PiCamera from time import sleep import sys app = Flask(__name__) @app.route('/') def index(): camera = PiCamera() camera.start_preview() camera.start_recording('/home/pi/Desktop/play.h264') sleep(15) camera.stop_recording() camera.stop_preview() if __name__ == '__main__': app.run(debug=True, port=8000, host='0.0.0.0')
please see screenshot of error below