Breakthrough / PySceneDetect

:movie_camera: Python and OpenCV-based scene cut/transition detection program & library.
https://www.scenedetect.com/
BSD 3-Clause "New" or "Revised" License
2.97k stars 374 forks source link

url input ,1080p video much slower #381

Closed babyta closed 4 months ago

babyta commented 4 months ago

as title,when test,i found that problem。Looking forward to your reply

Breakthrough commented 4 months ago

I'm not sure this is enough information to go by, could you please provide:

Description:

Describe what the bug or issue is (e.g. crashes when setting X) and how it can be reproduced.

Command:

Place a full copy of the command line options you are using here, for example:

scenedetect -i some_video.mp4 -s some_video.stats.csv -o outdir detect-content --threshold 28 list-scenes save-images

Output:

Copy the output of running the application here. Where possible, generate a debug log by adding -v debug -l BUG_REPORT.txt to the beginning of your command, and attach BUG_REPORT.txt to your issue.

Environment:

The operating system and how you installed PySceneDetect may be relevant to the issue. Please run scenedetect version --all and copy the output here, or provide other details on how PySceneDetect was installed.

Media/Files:

Attach or link to any files relevant to the issue, including videos (or YouTube links), scene files, stats files, and log output.

babyta commented 4 months ago

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

babyta commented 4 months ago

https://drive.google.com/file/d/1h5tztZkpV6ziJzgtVieJqcnhF4Bo82f_/view?usp=sharing =================This is the url image =================This is a speed comparison. The URL input is very slow, but the same video is downloaded locally as input and the strips are split very quickly.

from scenedetect import open_video, SceneManager, split_video_ffmpeg from scenedetect.detectors import ContentDetector from scenedetect.video_splitter import split_video_ffmpeg

video_path = '1080pvdieo.mp4' threshold=27.0

Open our video, create a scene manager, and add a detector.

video = open_video(video_path) scene_manager = SceneManager() scene_manager.add_detector( ContentDetector(threshold=threshold)) scene_manager.detect_scenes(video, show_progress=True) scene_list = scene_manager.get_scene_list()

================= this is code

Breakthrough commented 4 months ago

URL input is handled by OpenCV if you don't change anything, have you tried using a different backend? https://www.scenedetect.com/docs/0.6.2/api/backends.html

babyta commented 4 months ago

Traceback (most recent call last): File "C:\Users\Administrator\Desktop\test.py", line 9, in video = open_video(video_path, backend='pyav') File "D:\ProgramData\miniconda3\envs\py39pt1121\lib\site-packages\scenedetect__init.py", line 143, in open_video return backend_type(path, framerate, **kwargs) File "D:\ProgramData\miniconda3\envs\py39pt1121\lib\site-packages\scenedetect\backends\pyav.py", line 107, in init__ self._io = open(path_or_io, 'rb') OSError: [Errno 22] Invalid argument

babyta commented 4 months ago

When I use pyav as backends, I get an error directly.

babyta commented 4 months ago

cv2.VideoCapture When reading a URL, if the video resolution corresponding to the URL is very high and the data rate is very high, it will be very slow.

Breakthrough commented 4 months ago

Thank you for following up on this, I appreciate it. If you suspect this is due to OpenCV and isn't just an issue with using ffmpeg (or which ever backend OpenCV itself is using to process the stream), you might want to reach out in their repo.

Best regards!