Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to save frames in form of video in opencv python

import numpy as np
import cv2

cap = cv2.VideoCapture(0)

fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi', fourcc, 20.0, (640,480))

while(cap.isOpened()):
    ret, frame = cap.read()
    if ret==True:
        frame = cv2.flip(frame,0)


        out.write(frame)

        cv2.imshow('frame',frame)
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break
    else:
        break
cap.release()

out.release()

cv2.destroyAllWindows()
Comment

PREVIOUS NEXT
Code Example
Python :: python random uuid 
Python :: How do I plot a csv file in Jupyter notebook? 
Python :: python random choices weights 
Python :: Add two numbers as a linked list 
Python :: python bool 
Python :: head first python 
Python :: django loginview 
Python :: multiple channel deleteing command in discord.py 
Python :: python print variable 
Python :: python3 format leading 0 
Python :: how to add a list in python 
Python :: adding two strings together in python 
Python :: send xml data with python 
Python :: why pytest return No ModuleError 
Python :: counter library python 
Python :: df.loc a list of index 
Python :: python sqlite select column name 
Python :: python logging variables extra 
Python :: python list extend() 
Python :: pytest debug test 
Python :: python destructure object 
Python :: extract address from text python 
Python :: python easter egg 
Python :: Python NumPy ndarray flat function Example with 2d array 
Python :: nibabel image 
Python :: cronometro python tkinter 
Python :: telegram.ext module python 
Python :: Using Python-docx to update cell content of a table 
Python :: housie numbers using python 
Python :: MNIST model 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =