Skip to content

ZeroDivisionError with empty video document #297

Description

@owencking

Bug Description

Running SWT detection v8.6, upon encountering a zero byte video, this error occurred:

Traceback (most recent call last):
File "/app/cli.py", line 88, in <module>
out_mmif = clamsapp.annotate(in_data, **params)
File "/usr/local/lib/python3.10/site-packages/clams/app/__init__.py", line 193, in annotate
annotated, cuda_profiler = self._profile_cuda_memory(self._annotate)(mmif, **refined)
File "/usr/local/lib/python3.10/site-packages/clams/app/__init__.py", line 582, in wrapper
result = func(*args, **kwargs)
File "/app/app.py", line 57, in _annotate
self._annotate_timepoints(mmif, **parameters)
File "/app/app.py", line 92, in _annotate_timepoints
vdh.capture(video)
File "/usr/local/lib/python3.10/site-packages/mmif/utils/video_document_helper.py", line 620, in capture
dur = round(fc / fps, 3) * 1000
ZeroDivisionError: float division by zero

Reproduction steps

Touch a filename to create a zero byte mp4 file, create blank/source MMIF, then run SWT detection v8.6.

Expected behavior

Honestly, I don't know what is the desirable behavior here. Should it just create a view without any annotations, or perhaps some error view?

Log output

Screenshots

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛BSomething isn't working

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions