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

Use custom error if video does not have frames #1832

Merged
merged 2 commits into from Mar 24, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions pupil_src/shared_modules/video_capture/utils.py
Expand Up @@ -25,6 +25,10 @@
VIDEO_TIME_EXTS = VIDEO_EXTS + ("time",)


class VideoDoesNotContainFramesError(ValueError):
pass


class Exposure_Time(object):
def __init__(self, max_ET, frame_rate, mode="manual"):
self.mode = mode
Expand Down Expand Up @@ -189,8 +193,8 @@ def check_valid(self):
# 3. decode() yields None
first_frame = next(cont.decode(video=0), None)
if first_frame is None:
raise av.AVError("Video does not contain any frames")
except av.AVError:
raise VideoDoesNotContainFramesError()
except (av.AVError, VideoDoesNotContainFramesError):
return False
pfaion marked this conversation as resolved.
Show resolved Hide resolved
else:
cont.seek(0)
Expand Down