forked from kenzuya/unshackle
fix(tracks): treat a zero-denominator video frame rate as unknown
This commit is contained in:
@@ -249,6 +249,7 @@ class Video(Track):
|
||||
fps: A number, float, or string representing the frames/s of the video.
|
||||
Strings may represent numbers, floats, or a fraction (num/den).
|
||||
All strings will be cast to either a number or float.
|
||||
A zero denominator gives no fps.
|
||||
hdr10plus: The DV track also carries HDR10+ metadata. The HDR10+ probe sets it.
|
||||
hdr10_base: The DV track has an HDR10 base layer, as DV profile 8.1 does.
|
||||
stereo: The track is stereoscopic 3D (MV-HEVC), with a second view for the other eye.
|
||||
@@ -293,6 +294,9 @@ class Video(Track):
|
||||
|
||||
try:
|
||||
self.fps = (FPS.parse(str(fps)) or None) if fps else None
|
||||
except ZeroDivisionError:
|
||||
logging.getLogger("Video").debug(f"Ignored fps {fps!r}: zero denominator")
|
||||
self.fps = None
|
||||
except Exception as e:
|
||||
raise ValueError( # noqa: B904
|
||||
"Expected fps to be a number, float, or a string as numerator/denominator form, " + str(e)
|
||||
|
||||
Reference in New Issue
Block a user