Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support using decord library for video input #458

Open
ZXMMD opened this issue Nov 12, 2024 · 3 comments
Open

support using decord library for video input #458

ZXMMD opened this issue Nov 12, 2024 · 3 comments
Labels
Milestone

Comments

@ZXMMD
Copy link

ZXMMD commented Nov 12, 2024

Problem/Use Case

Is the input for scenedetect limited to video file paths? Does it support inputting tensors, such as videos read using decord? Additionally, can scenedetect detect whether a video contains multiple scenes without segmenting the video?

@Breakthrough
Copy link
Owner

Is the input for scenedetect limited to video file paths?

PySceneDetect also supports PyAV which allows input from any file-like object, as well as MoviePy which should work with streams. Most backends already support network streams and image sequences.

Does it support inputting tensors, such as videos read using decord?

Could you clarify what you mean by inputting tensors? Do you mean a large list of videos?

decord looks pretty cool, thanks for the link - I'll look into what's required for integrating that as a backend for PySceneDetect in addition to OpenCV/PyAV/MoviePy. I'm curious if it will be faster than those, especially with GPU decoding.

Additionally, can scenedetect detect whether a video contains multiple scenes without segmenting the video?

Yes, by default it doesn't cut videos. You need to explicitly state if any output should be created.

@ZXMMD
Copy link
Author

ZXMMD commented Nov 14, 2024

Thanks for your reply! After reading a video using the following command:

import decord
video_path = 'path_to_video.mp4
vr = decord.VideoReader(video_path)

Can PySceneDetect be used directly for scene detection? For example:

from scenedetect import detect, ContentDetector
scene_list = detect(vr, ContentDetector())

@Breakthrough
Copy link
Owner

Breakthrough commented Nov 18, 2024

Thanks for your reply! After reading a video using the following command:

import decord video_path = 'path_to_video.mp4 vr = decord.VideoReader(video_path)

Can PySceneDetect be used directly for scene detection? For example:

from scenedetect import detect, ContentDetector scene_list = detect(vr, ContentDetector())

It doesn't seem to be a fully-compliant cv2.VideoCapture drop-in replacement as purported, but judging by the API examples, we should be able to integrate it into PySceneDetect as a backend. I can consider this for a future release though.

If you need this sooner, you could try implementing the VideoStream interface for decord's VideoReader. That would allow using it with PySceneDetect's SceneManager API.

Note that GPU support is out of scope for the time being, but I am open to adding support for it in the future. Right now there are no libraries on PyPI that come with GPU-enabled binaries out of the box (decord also falls into this category), so I would prefer if that problem could be solved first before we tackle GPU support.

@Breakthrough Breakthrough added this to the 0.6.6 milestone Nov 24, 2024
@Breakthrough Breakthrough changed the title support inputting tensors support using decord library for video input Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants