Skip to content

Instantly share code, notes, and snippets.

View laygond's full-sized avatar
🏅
It is never too late to commit.

Laygond laygond

🏅
It is never too late to commit.
View GitHub Profile
@laygond
laygond / writeVideoOpenCV.py
Last active August 14, 2019 00:56
Write Video OpenCV
video_name = "sample.mp4"
input_video_path = os.path.join("Input_Video", video_name) # USER must Edit
# Load video
cap = cv2.VideoCapture(input_video_path)
# Get General Info
fps = cap.get(cv2.CAP_PROP_FPS) # OpenCV2 version 2 used "CV_CAP_PROP_FPS"
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
duration = int(frame_count/fps)