-
Notifications
You must be signed in to change notification settings - Fork 398
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
min_scene_len
parameter isn't respected with AdaptiveDetector
#408
Comments
The code samples you posted here look correct at first glance, so this could possibly be a bug. Could you share what version you're using and any sample videos? In the latest version, the check for min_scene_len is done here: Consequently it should not emit any cuts until min_scene_len frames have passed. Are you able to share any clips that reproduce the issue? I attempted to fix this in d8397bc but perhaps that was not robust enough. If you are using the latest version, could you verify with an older one? Thanks for the report! |
min_scene_len
parameter isn't respected with AdaptiveDetector
Looking at the code again with some fresh eyes, it seems that the check for if the minimum length was met uses the current frame number, but we emit a cut at the target. This definitely seems wrong, and we seem to be missing test cases that exercise different window sizes with AdaptiveDetector. I'll make sure we add some for that before closing this out, and will try to reproduce with existing videos in the dataset. Open Items:
|
So, if I am understanding this issue correctly, it currently works like this:
That would explain how the resulting video in the example code ended up as just 4 frames. |
@Breakthrough This was the example when I was finding this problem: This is an extract of the video I was using Just after "federal gun trial" there is a change between shots. This change corresponds with the two peaks that are just about second 6 in the graph. In that moment, I get these following clips: https://github.com/user-attachments/assets/d46e2ab3-6a45-4d78-9520-ad187f957500 For which the first one is the one I run ffprobe with, getting a length of 4 frames. Thank you!! |
@wjs018 Exactly |
Hello. First of all, thanks for all the work you've done in this project. I've been using PyScene for some months until now and it has been very helpful, intuitive and easy to use.
Description of the issue
I'm having trouble with the parameter
min_scene_len
because it doesn't seem to do nothing if I change it.I'm using the AdaptiveDetector module to differenciate shots in videos and one problem I get a lot is that when some frame surpases the threshold, normally there are some following frames also surpasing the threshold until it decays, and these additional frames trigger the scene detection. So I end up with 2 to 3 very short scenes whenever there is a scene change.
My approach to handle this was to use the
min_scene_len
parameter to filter this short scenes but, even with this parameter, the module generates clips with fewer frames than the specified parameter.The code I'm running to get the scenes is this one:
Then I cut the scenes with this ffmpeg command:
Which writes all the clips in my project folder.
Some of the clips (especially the ones I told in shots boundaries) are very short (0.1 to 0.4 seconds) and it didn't seem to be coherent with the
min_scene_len=24
parameter.I checked the number of frames of these videos with ffprobe, obtaining this result:
So my suspicions were confirmed. I'm having clips shorter than the specified minimum scene length.
Question
Is there something am I doing the wrong way or maybe I don't understand correctly the use of this parameter? Or is this a bug I found? I didn't manage to find anything about this topic, especially with the AdaptiveDetector module.
Thank you!
The text was updated successfully, but these errors were encountered: