Skip to content
Snippets Groups Projects
Commit a138463f authored by Simon Künzel's avatar Simon Künzel
Browse files

#45 FFProbe: Fix missing conversion from seconds to nanoseconds

parent de911ba2
Branches
Tags v2.0.16
No related merge requests found
Pipeline #7656 failed
Pipeline: backend

#7657

    ......@@ -34,7 +34,7 @@ class FFProbeImageStream(FFProbeStream):
    height: int
    def _parse_duration_string_human(val: str) -> int:
    def _parse_duration_string_human_to_ns(val: str) -> int:
    match = re.match("(?>(?>([0-9]+):)?([0-9]+):)?([0-9]+)(?>\\.([0-9]+))?", val)
    if match is None:
    raise ValueError(f"Unable to parse duration: {val}")
    ......@@ -43,8 +43,8 @@ def _parse_duration_string_human(val: str) -> int:
    seconds = int(match.group(3))
    nanos = int(match.group(4) or "0")
    return math.ceil(
    (hours * 60 + minutes) * 60 + seconds
    + nanos / math.pow(10, 9)
    ((hours * 60 + minutes) * 60 + seconds) * math.pow(10, 9)
    + nanos
    )
    ......@@ -56,7 +56,7 @@ def _get_stream_duration_ns(stream: dict):
    if tags is not None:
    duration_string = tags.get("DURATION")
    if duration_string is not None:
    return _parse_duration_string_human(duration_string)
    return _parse_duration_string_human_to_ns(duration_string)
    raise Exception(f"Unable to get duration from stream: {stream}")
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment