Skip to content

Instantly share code, notes, and snippets.

View AsharFatmi's full-sized avatar
🤔
In the Zone

Ashar Fatmi AsharFatmi

🤔
In the Zone
  • Kellogg School of Mangement
  • Chicago, USA
View GitHub Profile
@AsharFatmi
AsharFatmi / record_video.py
Created October 7, 2019 07:00
Python script to record video from camera without cv2.imshow. to stop recording just hit ctrl+c .
import numpy as np
import cv2
cap = cv2.VideoCapture(0) # for IPCamera format : rtsp://admin:admin@192.168.10.122:554/1
# Define the codec and create VideoWriter object
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter('traffic_video_back.mp4',fourcc, 15.0, (1920,1080))
frame_count = 0
while(cap.isOpened()):