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

--min-scene-len does not respect first scene #105

Closed
charlesvestal opened this issue Jun 11, 2019 · 8 comments

Comments

@charlesvestal
Copy link

commented Jun 11, 2019

Bug/Issue Description:
--min-scene-len returns scenes shorter than specified length at the beginning and end of a file

Required Information:
Provide the following information to assist with reporting the bug:

  1. Provide a full copy of the command line options you are using, for example:

scenedetect -i video.mp4 detect-threshold --min-scene-len 14000

  1. Add -v debug -l BUG_REPORT.txt to the beginning of the command, then re-run PySceneDetect and attach the generated BUG_REPORT.txt file.

BUG_REPORT.txt

Expected Behavior:
A clear and concise description of what you expected to happen.

When specifying the min-scene-len, I would expect no scenes to be returned of below the length specified. It appears that internal scenes are respected, but not the first or last segment.

For instance, if I have a 30m video with a fade to black at 1m, 15m and 29m. I would expect with a threshold of 300,000 (10 minutes), I would only have two 15m slices. Instead, I see the first fade detected, as well as the third, as the scenes in between are of sufficient length.

Expected behavior would be that these are included as part of the adjacent scenes.

Computing Environment:

  • OS: osx
  • Python Version: 2.7
  • OpenCV Version: 4.1.0_2
@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Jun 11, 2019

Hi @charlesvestal;

Thanks for the submission, will definitely add this to the list of issues to address in the next version.

Much appreciated!

@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Aug 4, 2019

Hi @charlesvestal;

I have a code change that I committed to master just now which should address this issue.

Would you be willing to test the fix out to confirm that it has resolved your issue?

Thank you!


You can test the fix out by cloning the repo or downloading it as an archive and extracting the files. Then, place the video in the folder where you cloned/extracted the files, and run the scenedetect.py file as you would the normal scenedetect command.

@pgodwin

This comment has been minimized.

Copy link

commented Aug 30, 2019

Having the same issue with detect-content as well.

@charlesvestal

This comment has been minimized.

Copy link
Author

commented Aug 30, 2019

Having the same issue with detect-content as well.

Possibly related to the other issue, here? #106

@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Aug 30, 2019

@pgodwin good catch, thank you. Will work on that next.

To fix the endings, I will need to post-process the last two scenes added to the scene list, merging them if the stuff after it is actually too small.

@charlesvestal unfortunately they are not related in terms of the code changes which caused the bug, but that is one I still do have to get to for sure.

Thank you both!!

@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Aug 30, 2019

Alright, this should be fixed for the beginning of videos for both ThresholdDetector and ContentDetector in master as of 557bbc5. Feel free to checkout and install the latest development version as above until this is released in v0.5.2.

That being said, I'm not sure if it's worth it to apply the same logic to the end of the video - thoughts? Is your expectation that even the last scene complies with the minimum scene length even in the event that can't be met (by merging it with a previous scene)?

If so I can consider adding a command line option for that as an enhancement, but would prefer it's tracked under a different issue if possible (just since this one has been root caused and a solution has been proposed).

@Breakthrough Breakthrough changed the title --min-scene-len does not respect first and last scenes --min-scene-len does not respect first scene Aug 31, 2019

@Breakthrough

This comment has been minimized.

Copy link
Owner

commented Aug 31, 2019

Hey @charlesvestal;

The bugfix I applied is only for the first scene, since it's less correct to merge the last scene with it's predecessor simply because there weren't any frames left in the video. I've updated the title of this issue to reflect that.

I personally don't feel that it's correct to apply this logic to the last scene, just because the last scene is generated out of the only remaining frames. If you (or anyone) happen to disagree with that logic, and feel like such an option is useful or adds value/utility to PySceneDetect, feel free to create a new feature/enhancement request. If you can specify what you would call the command-line option to enable/disable the feature as well, that would be appreciated.

Thank you.

@charlesvestal

This comment has been minimized.

Copy link
Author

commented Aug 31, 2019

Thanks! That sounds like it would work as expected. And I think you're right in the sense of detecting scenes as this tool is intended to be used for. :) My use case was to split files containing multiple episodes of a show for instance, detecting black between episodes but ignoring other fades at the end of episodes. When used in conjunction with analyzed duration that should be a sufficient solve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.