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
3.16k stars 387 forks source link

Extraction half of frames #360

Closed vladoossss closed 9 months ago

vladoossss commented 11 months ago

When I try to extract keyframes from a long video(about 30 min and more), it only works for half the length of the video and then stops: image

I will be appreciate your help!

Breakthrough commented 11 months ago

Could you provide debug logs to assist? You can add -v debug -l BUG_REPORT.txt to create one. Thanks.

vladoossss commented 10 months ago

Could you provide debug logs to assist? You can add -v debug -l BUG_REPORT.txt to create one. Thanks.

I started with debug, but it's still not clear for me to understand what happend: image

But i figured out that my test video has ~50fps. Can the problem depends on huge fps?

Breakthrough commented 10 months ago

Is that the same video? If the framerate is 50 FPS, then 131833 frames represents 43 minutes [1] that PySceneDetect processed. The progress bar bases the total # of frames on whatever the video container reports, which may not be accurate. To confirm this, you can try re-encoding the video with ffmpeg and then process it again with PySceneDetect.

Are you seeing this problem on different videos or just a single input? Have you tried another backend (e.g. --backend pyav)?

[1] 131833 frames / (50 frames/sec * 60 secs/min) = 43 minutes

Edit: To answer your question, the problem shouldn't depend on framerate as long as it is fixed.

vladoossss commented 10 months ago

Is that the same video? If the framerate is 50 FPS, then 131833 frames represents 43 minutes [1] that PySceneDetect processed. The progress bar bases the total # of frames on whatever the video container reports, which may not be accurate. To confirm this, you can try re-encoding the video with ffmpeg and then process it again with PySceneDetect.

Are you seeing this problem on different videos or just a single input? Have you tried another backend (e.g. --backend pyav)?

[1] 131833 frames / (50 frames/sec * 60 secs/min) = 43 minutes

Edit: To answer your question, the problem shouldn't depend on framerate as long as it is fixed.

I've tried 2 diffrent video(both 50 fps, ~1.5 hours). But it's always processes half of the frames.

I agree with your calculation. But when i save one image per scene and looking at last image, i see ~the middle frame of my vildeo.

I also used another backend(moviepy) and it works well(with all frames), but too slow compared to opencv(4-5 times slower).

Breakthrough commented 10 months ago

Are you able to share a sample video with me that shows the issue? That would be useful to help debug what the issue may be. Thanks!