Skip to content

Support for real time video stream SceneDetect #509

Description

@qtyandhasee

Hello! Thank you for your excellent work, which has allowed me to easily implement offline video scene detection. I would like to ask if PySceneDetect currently supports real-time video stream scene detect. I noticed the VideoStream interface, but my attempts have consistently failed. Can I build a real-time video stream scene detection method by combining it with SceneManager? I look forward to your reply!

Activity

  1. Breakthrough commented on May 13, 2025

    @Breakthrough
    Owner

    If you are using OpenCV for video input, you could try the VideoCaptureAdapter which is intended for this use case. Could you let me know if that works for you? Thanks!

  2. qtyandhasee commented on May 19, 2025

    @qtyandhasee
    Author

    If you are using OpenCV for video input, you could try the VideoCaptureAdapter which is intended for this use case. Could you let me know if that works for you? Thanks!

    Thank you for your answer! With the API you provided, I achieved RTSP real-time video stream reading. Now, I'm testing scene detection time via a callback function in PySceneDetect. I'm wondering if a custom callback passed to detect_scenes is called after each scene cut. In scene_manager.py, the callback comment says it's for the first frame of every new scene. But detect_scenes' docs state the callback is called after each scene/event. Also, does PySceneDetect offer tools to test scene cut time? Looking forward to your reply!Thanks again for your patient response.

  3. Breakthrough commented on May 19, 2025

    @Breakthrough
    Owner

    Now, I'm testing scene detection time via a callback function in PySceneDetect. I'm wondering if a custom callback passed to detect_scenes is called after each scene cut. In scene_manager.py, the callback comment says it's for the first frame of every new scene. But detect_scenes' docs state the callback is called after each scene/event.

    Correct - right now the API works on fast-cuts only, which is what "event" refers to. I hope to resolve this in v0.6 with a better API, but I have not yet thought about how it would work with callbacks yet. Expect this code to change significantly when v0.7 is released, and feel free to provide feedback if there is anything you need the callback to do specifically (or more information when it gets invoked).

    Also, does PySceneDetect offer tools to test scene cut time?

    There's some unit tests that use a fixed set of videos to ensure algorithms don't regress. @awkrail has also been working on benchmarks to compare detector performance/accuracy across a wider data set.

    Also note that depending on what detector or parameters you use, the callback won't always be invoked on the same frame the video returns it. Some detectors use a sliding window or a buffer, so only after that length of time (detectors have a event_buffer_length property) has passed will the callback be invoked. If you need lower frame latency, you will need to disable most filters and use a simple detector like ContentDetector with a very low minimum scene length.

  4. Repository owner locked and limited conversation to collaborators on Aug 21, 2025
  5. converted this issue into a discussion #517 on Aug 21, 2025
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions