How to access frame from USB camera?
AnsweredI am able to access frames from testlivecamera using python opencv. I used below snippet to extract frames from live camera.
stream_url="rtsp://nx_user:nx_pass@host:port/camera_id"
cap = cv2.VideoCapture(stream_url)
while True:
is_read_success, frame = cap.read()
now = str(datetime.now())
cv2.imwrite(out+'/'+str(now) + ".jpg", frame)
But, If I access USB camera I am getting green color image like below.

Is it not possible to extract images from usb camera using RTSP?
-
Often, web cameras use MJPEG codec, not H.264, that might be causing some issues.
Can you try playing that rtsp stream in VLC media player? What do you see in VLC?
0
Please sign in to leave a comment.
Comments
1 comment