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

Failed to open video with opencv: Ensure file is valid video and system dependencies are up to date. #415

Open
kehuanfeng opened this issue Sep 2, 2024 · 2 comments

Comments

@kehuanfeng
Copy link

kehuanfeng commented Sep 2, 2024

Description:

Failed to open video with opencv: Ensure file is valid video and system dependencies are up to date.

Command:

scenedetect -i file_example_MP4_480_1_5MG.mp4 split-video

Output:

[PySceneDetect] PySceneDetect 0.6.4
[PySceneDetect] Failed to open video with opencv: Ensure file is valid video and system dependencies are up to date.

Usage: scenedetect [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...
Try 'scenedetect -h' for help.

Error: Invalid value for -i/--input: Failed to open input video using opencv backend: Ensure file is valid video and system dependencies are up to date.

Environment:

[PySceneDetect] PySceneDetect 0.6.4

System Info
------------------------------------------------------------
OS           Linux-5.14.0-362.24.1.el9_3.0.1.x86_64-x86_64-with-glibc2.35
Python       3.10.12

Packages
------------------------------------------------------------
av           12.3.0
click        8.1.7
cv2          4.7.0
moviepy      1.0.3
numpy        1.24.4
platformdirs 4.2.0
scenedetect  0.6.4
tqdm         4.66.2

Tools
------------------------------------------------------------
ffmpeg       4.4.2-0ubuntu0.22.04.1
mkvmerge     v65.0.0 ('Too Much') 64-bit

Media:
https://file-examples.com/wp-content/storage/2017/04/file_example_MP4_480_1_5MG.mp4

@kehuanfeng
Copy link
Author

BTW, I can use ffmpeg to cut the sample video file successfully,

ffmpeg -i file_example_MP4_480_1_5MG.mp4 -ss 10 -t 5 new_example.mp4

@Breakthrough
Copy link
Owner

It seems that OpenCV is failing to open that video. You can try using a different backend like PyAV:

scenedetect -i file_example_MP4_480_1_5MG.mp4 -b pyav split-video

Can you try that and/or MoviePy and let me know if that works for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants