Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

cv2 save video mp4

import cv2
import numpy as np
import os

image_folder = 'data-set-race-01'
video_file = 'race-01.mp4'
image_size = (160, 120)
fps = 24

images = [img for img in os.listdir(image_folder) if img.endswith(".jpg")]
images.sort()

out = cv2.VideoWriter(video_file, cv2.VideoWriter_fourcc(*'MP4V'), fps, image_size)

img_array = []
for filename in images:
    img = cv2.imread(os.path.join(image_folder, filename))
    img_array.append(img)
    out.write(img)

out.release()
Comment

PREVIOUS NEXT
Code Example
Python :: tkinter minsize 
Python :: python os checj if path exsis 
Python :: django python base 64 encode 
Python :: anaconda python update packages 
Python :: pandas new column with loc 
Python :: cors error in flask 
Python :: pandas dataframe convert nan to string 
Python :: tesseract.exe python 
Python :: python check if item in 2d list 
Python :: count similar values in list python 
Python :: django get superuser password 
Python :: python pip install from script 
Python :: pip version 
Python :: remove None pandas 
Python :: python cd to script directory 
Python :: Find a specific value in a pandas data frame based on loc 
Python :: python alfabet 
Python :: pandas sort values reset index 
Python :: round to two decimal places python 
Python :: print python path variable 
Python :: insert image to jupyter notebook 
Python :: f string curency format 
Python :: how to count stopwords in df 
Python :: selenium scroll element into view inside overflow python 
Python :: beautiful soup 4 python 
Python :: find elements by class name selenium python 
Python :: python input comma separated values 
Python :: how to make a query for not none value in django 
Python :: python image to pdf 
Python :: normalize column pandas 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =