Skip to content

Instantly share code, notes, and snippets.

@talhaahussain
Created June 14, 2024 18:32
Show Gist options
  • Save talhaahussain/88fdaeda48dc5e4f13ee74db54293324 to your computer and use it in GitHub Desktop.
Save talhaahussain/88fdaeda48dc5e4f13ee74db54293324 to your computer and use it in GitHub Desktop.
image_seq_to_video.py -- A Python function to convert a sequence of images to video. Depends on OpenCV. See the original and an application here: https://github.com/talhaahussain/grappling-pose-identification/
import cv2
def concat_frames_into_video(filename, frames, fps):
height, width, channels = frames[0].shape
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter(filename, fourcc, fps, (width, height))
for frame in frames:
out.write(frame)
out.release()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment