-
Notifications
You must be signed in to change notification settings - Fork 386
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
Frames decoded with different resolution/shape #319
Comments
Follow-up
We've decided to circumvent the issue by making use of the CLI through a subprocess for now. |
Do you happen to have a sample video you could share? This error is happening because one of the frames that was decoded isn't the correct size or color space. I haven't ever been able to reproduce this issue reliably unfortunately, so any samples you could share would be a great help. Any more insight or information you could help provide would be great. I can also work on a patch to add more logging around this area to try and get better insight into what's going on. In particular, I would like to see what the size of the previous and current frames are (can also do this by just printing |
@samlegrand-ordina are you able to share any additional information to help debug the issue you were facing? I would love to understand how to make the bug happen in order to fix it if possible. Otherwise could you close the issue if there is no follow-up required? Thanks! |
Hello, I encountered this issue while using the same detector to process multiple videos of different sizes. After processing one video, the |
@ShenhaoZhu thank you for pointing that out, I had not considered that use case. I will investigate a fix for this in the following release. Are you using the |
@Breakthrough thank you for your reply, I am using a SceneManager with adaptive detector. |
I realize now what the problem with the original code sample is, and it's that the same instance of a detector is used for each invocation of the function. In retrospect I don't think this should be supported at for The example in the initial post with the from pathlib import Path
from scenedetect import AdaptiveDetector, detect
def do_detect_scenes(movie_path: Path, detector_type=AdaptiveDetector):
return detect(str(movie_path), detector_type(), show_progress=True) It's also easy enough to create a detector factory function if you need to tweak parameters, or write a wrapper for the function: def detect_with(video_path, detector_type, detector_args={}, **kwargs):
instance = detector_type(**detector_args)
return detect(video_path, instance, **kwargs)
detect_with("video.mp4", AdaptiveDetector, {"threshold": 30}, show_progress=True) I can look into adding the latter to the official API if there is enough interest for it, or perhaps extending the existing |
@ShenhaoZhu as an aside, may I ask why you require the |
An instance of this also cropped up in another project: Breakthrough/DVR-Scan#151 It seems some videos might have frames that are decoded at a lower resolution. I'm unsure why this is, and it doesn't seem to trip up ffmpeg much... I don't have any samples handy, but if anyone could share a test case for this that would be greatly appreciated. In the meantime, I'll make sure that a warning is emitted and any frames that aren't the expected size are just ignored. |
In v0.6.4, frames with the incorrect size will be skipped, and an error will be logged. |
Bug/Issue Description:
When making use of the Python API, scene detection arbitrarily fails with the following AssertionError within a cloud environment:
The issue does not occur persistently, sometimes scene detection finishes without issues, and sometimes it fails at a random point for the same video. The issue does not occur locally.
Required Information:
The issue cannot be replicated (and thus, scene detection succeeds) when making use of the CLI through a subprocess with the following options:
scenedetect -i ./video.mp4 -o ./output detect-adaptive list-scenes
I therefore provide the failing Python implementation instead:
Expected Behavior:
I expected scene detection to succeed for a given video, as it does when making use of the CLI or when running scene detection locally.
Computing Environment:
The text was updated successfully, but these errors were encountered: