How to make a video using raspberry pi camera without it crashing

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__)

def index():

    camera = PiCamera()




if __name__ == '__main__':, port=8000, host='')

please see screenshot of error below

preview of crash error returned

Please help

Read more here:

Content Attribution

This content was originally published by famakin taiwo at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: