-
Notifications
You must be signed in to change notification settings - Fork 462
Closed
Labels
Milestone
Description
As identified in #151, there is no example in the API documentation for how to use a callback, e.g. for processing a live video stream. An example should clearly document and demonstrate this use case, e.g.:
from scenedetect import VideoStreamCv2, SceneManager, ContentDetector
scene_manager = SceneManager()
cam = VideoStreamCv2(0)
scene_manager.add_detector(ContentDetector())
scene_manager.detect_scenes(video=cam, callback=lambda frame: print("a new scene: ", len(frame)))
Also note that the callback API is still unstable, so if you are using this in production you should pin your scenedetect
package to < 0.7.
This arose from the following comment:
A usage example:
cam = cv2.VideoCapture(0) scene_manager.add_detector(ContentDetector()) scene_manager.detect_scenes(frame_source=cam, callback=lambda frame: print("a new scene: ", len(frame)))when i tried this on a live video input, it throws error,
scene_manager.detect_scenes(frame_source=cam, callback=lambda frame: print("a new scene: ", len(frame))) File "/usr/local/lib/python3.6/dist-packages/scenedetect/scene_manager.py", line 752, in detect_scenes self._base_timecode = video.base_timecode AttributeError: 'cv2.VideoCapture' object has no attribute 'base_timecode' ``` any idea why is this happening?
Originally posted by @research-boy in #151 (comment)
lutoma