Repository navigation
Conversation
deruyter92
left a comment
There was a problem hiding this comment.
Useful to have the canonical video reader in dlccore.
Should it replace VideoReader in DLC as soon as this package becomes public? Or do you foresee difficulties?
Also, did we follow up on the integration possibilities with the FI team, who were also working on something similar?
| if not self._stream.isOpened(): | ||
| raise OSError("Video could not be opened.") | ||
|
|
||
| self._n_frames = int(self._stream.get(cv2.CAP_PROP_FRAME_COUNT)) |
There was a problem hiding this comment.
Apparently it is risky to trust CAP_PROP_FRAME_COUNT (which is an estimate), because, read_frame can then refuse valid frames, or raise "Could not read frame" near the end.
There was a problem hiding this comment.
Made it a bit clearer, not sure what would be best save for decoding the whole video as fallback
|
|
||
| ind = max(0, min(ind, len(self) - 1)) | ||
| if ind != self._pos: | ||
| ok = self._stream.set(cv2.CAP_PROP_POS_FRAMES, ind) |
There was a problem hiding this comment.
CAP_PROP_POS_FRAMES could land on the nearest keyframe for some codecs. Only mp4v is tested.
|
One additional comment about rotated videos, maybe you were already aware: Apparently OpenCV 4.11 and OpenCV 5 can return the same rotated video in different orientations. Probably worth to set |
464e304 to
4bab925
Compare
4bab925 to
38d6cd5
Compare
f11d8ce to
62a370c
Compare
- Rename the package to dlccore.io and add the dlccore license header - Add the optional `video` extra (opencv-python-headless>=5) and an `all` extra listing every extra; dlccore.io does not re-export Video, so OpenCV loads only with dlccore.io.video - test_video skips without OpenCV, and its DeepLabCut comparison skips without DeepLabCut - CI installs .[all] for the test, weekly and wheel jobs; the dependency-floor job stays on the core install so numpy's floor stays tested
Raise FileNotFoundError for invalid paths and include video paths and frame indices in decoding errors. Clarify reported frame-count limitations and update error tests.
Enable OpenCV's automatic rotation and report unsupported rotation metadata. Expand video tests to cover rotated frames and H.264, and install video dependencies in the lowest-version CI job.
Add Video.frames(start) and iterator support to yield RGB frames until the decoder ends, regardless of reported frame counts. Validate start bounds and cover iteration order, seeking, and inaccurate counts with tests.
Mark stream position unknown after failed reads, grabs, or seeks so subsequent access seeks instead of decoding from stale state. Add a damaged-video regression test.
62a370c to
f03ecbc
Compare
OpenCV canonical video reader first version, new optional
videoextra.Videois not re-exported fromdlccore.io, so OpenCV loads only withdlccore.io.video.CI
.[all].Note: The comparison with DeepLabCut's
VideoReaderskips when DeepLabCut is not installed, which is the case in CI.