Skip to content

Video: decide the behavior on damaged videos #37

Backlog

Description

@C-Achard

Deferred from #12, which only bridges capability gaps with DeepLabCut's VideoReader.
Potentially useful fixes that would alter behavior are listed below.

Findings

Fixtures from tests/io/test_video.py (60 frames, MJPG, mp4v and H.264), with 400 bytes zeroed mid-file, on OpenCV 5.1.

1. OpenCV's seek can land on another frame

On damaged MJPG, seeking to 30, 35 or 40 decodes frame 29, and OpenCV fails silently. DeepLabCut's VideoReader seeks the same way.

  • CAP_PROP_POS_MSEC after the read exposes it: 2900 ms where 4000 ms is expected. On undamaged files it matched index / fps for every seek tested.
  • Checking it by default would reject variable-frame-rate videos, common in phone footage.
  • Options: opt-in check (Video(path, verify_seeks=True)) raising on mismatch; a warning; no change.

2. Iteration ends silently at damage

Video.frames() stops at the first failed read.
DeepLabCut's VideoReader.read_frame() returns None there, which its callers wrongly treat as the end.

  • Option: on a failed read, try a few more reads, and raise if one succeeds; frame indices after the gap are unknown, so raising is the only correct outcome.
  • Limit: damage spanning more reads than the retry budget still looks like the end.

3. Certain detection

Decoding the whole file with ffmpeg -v error -f null -, as DeepLabCut's VideoReader.check_integrity does, finds all damage. Too slow for Video; candidate for project video validation.

Activity

  1. self-assigned this
    on Nov 27, 2026
  2. added
    io: video
    consumer: deeplabcut
    consumer: napari
    validation
    canonical
    on Nov 27, 2026
  3. added theissue type on Nov 27, 2026
  4. changed the title [-]`Video`: decide the behaviour on damaged videos[/-] [+]`Video`: decide the behavior on damaged videos[/+] on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

canonicalconsumer: deeplabcutconsumer: napariio: videovalidation

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions