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
62a370c to
f03ecbc
Compare
ecd4b12 to
ca65138
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.