Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
Because of un-manageable amounts of spam despite our use of CAPTCHAs, email authorization, and other tools, we have discontinued this forum (see the 700k+ registered users with validated email addresses at right?). Please email us any questions or post bug reports and feature requests on GitHub at https://github.com/jevois -- The content below remains available for future reference.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

How can I store a Video frame by frame to the sdcard of my A33 cam

+1 vote
I wrote a Python code for storing a video on the sd-card of my a33 cam. My problem is, that the Filename will be stored, but I cannot write frames after opening the file. Here you can see my Python code. In the line "jevois.sendSerial(str(cap.isOpened()))" i can read, wether the File is opened or not. I always get the answer "false" (that means File not opened). I do not know what is wrong, where is my mistake. Can everybody help me? Every Tipp will be ok. Thank you.

def VideoSpeichern(self, frame):


    cap = cv2.VideoCapture(0)

    # Der Dateiname besteht aus Objekt, Datum und Uhrzeit. Dies wird hier zusammengefuegt.

    now = datetime.now() # aktuelles Datum und Uhrzeit

    date_object = now.strftime("%Y%m%d") # Heutiges Datum in date_object ablegen

    time_object = now.strftime("%H%M%S") # Aktuelle Uhrzeit in time_object ablegen

    PfadDatei = ("modules/Dambrowsky/OpenCVObjektErkennungBilderVideo/BilderVideos/     Person"+"_"+str(date_object)+"_"+str(time_object)+".avi")

    # codec definieren und VideoWriter Objekt erzeugen

    fourcc = cv2.VideoWriter_fourcc(*'DIVX')

    out = cv2.VideoWriter(PfadDatei,fourcc, 20.0, (640,480))


    start = time.time()


        ret, frame = cap.read()


        if ret==True:

            frame = cv2.flip(frame,0)

            # frame in Datei schreiben


            end = time.time()

            jevois.sendSerial(end - start)

            if (end - start > 30):

                key = ord('q')




    # Alles wieder am Ende schliessen


asked Mar 2, 2020 in Programmer Questions by Peter (580 points)

1 Answer

0 votes
Looks like you are opening "cap" as a video capture device but that is not available in JeVois modules.

The core JeVois software does the capture for you. All you need is to write a process() function that will be called each time a new frame is available from the sensor. In that function you can save your frames. Make sure you make "out" a class data member of your module so that it persists across multiple calls to process()

Have a look here for some guidance:



Start with the code for Hello. Open "out" (renamed self.out) in __init__ of the module). Then in process() add your "out.write(frame)". I recommend that you use an absolute path for your saved video (e.g., /jevois/myvideo.avi)
answered Mar 11, 2020 by JeVois (46,580 points)