Skip to content

Instantly share code, notes, and snippets.

@vtsatskin
Created October 23, 2015 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vtsatskin/4190fee5c4804cb69f17 to your computer and use it in GitHub Desktop.
Save vtsatskin/4190fee5c4804cb69f17 to your computer and use it in GitHub Desktop.
Saving numpy image frames to video with OpenCV
import cv2
import numpy as np
def save_frames(frames, file_path, width, height, fps, codec="mp4v"):
# Define the codec and create VideoWriter object
fourcc = cv2.cv.CV_FOURCC(*codec)
out = cv2.VideoWriter(file_path, fourcc, fps, (width,height))
for frame in frames:
out.write(frame)
@SportsMUST
Copy link

thank you for your code !
run the code ,it's nothing?
thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment