import time
import cv2
import numpy

cam1 = '/dev/video1'
cam2 = '/dev/video2'

try:
    t = time.time()
    fn1 = '/tmp/cam1-{}.npy'.format(t)
    fn2 = '/tmp/cam2-{}.npy'.format(t)
    d1 = d2 = None
    d1 = cv2.VideoCapture(cam1)
    d2 = cv2.VideoCapture(cam2)
    is_capturing, frame1 = d1.read()
    is_capturing, frame2 = d2.read()
    numpy.save(fn1, frame1)
    numpy.save(fn2, frame2)
    print ("II: files saved --", fn1, fn2)
except Exception as e:
    print ("EE", e)
finally:
    if d1 and d1.isOpened():
        d1.release()
    if d2 and d2.isOpened():
        d2.release()
