Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try 4 times more if can't read a frame. #692

Open
wants to merge 3 commits into
base: beta
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions howdy/src/recorders/video_capture.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Import required modules
import configparser
from time import sleep
import cv2
import os
import sys
Expand Down Expand Up @@ -81,10 +82,15 @@ def read_frame(self):
# Grab a single frame of video
# Don't remove ret, it doesn't work without it
ret, frame = self.internal.read()
if not ret:
print(_("Failed to read camera specified in the 'device_path' config option, aborting"))
sys.exit(1)

i = 0
while not ret and i<=5:
if i == 5:
print(_("Failed to read camera specified in the 'device_path' config option, aborting"))
sys.exit(1)
sleep(i*.5)
ret, frame = self.internal.read()

i+=1
try:
# Convert from color to grayscale
# First processing of frame, so frame errors show up here
Expand Down