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 :: Replace empty string and "records with only spaces" with npnan pandas 
Python :: pathlib get list of files 
Python :: simple gui for pygame 
Python :: sort strings as numbers python 
Python :: select only object columns pandas 
Python :: finding 2 decimal places python 
Python :: python divide one column by another 
Python :: python nameerror input 
Python :: python request post with json with headers 
Python :: pip install dal 
Python :: pyspark concat columns 
Python :: mish activation function tensorflow 
Python :: how to say hello with name in python 
Python :: check cuda available tensorflow 
Python :: plt.imshow not showing 
Python :: generate valid sudoku board python 
Python :: pandas rename column name 
Python :: batch a list python 
Python :: sacar la posicion en una lista python 
Python :: django login redirect 
Python :: how to filter out all NaN values in pandas df 
Python :: pygame change icon 
Python :: import static in django urls 
Python :: unique words from pandas 
Python :: the user to enter their name and display each letter in their name on a separate line python 
Python :: leaky relu keras 
Python :: convert files from jpg to png and save in a new directory python 
Python :: count plot 
Python :: how to change web browser in python 
Python :: rotational list python 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =