-
Notifications
You must be signed in to change notification settings - Fork 407
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
At the end of the sliced video via split-video there is a frame of the next video #431
Comments
Can you share the original clip? Does the issue happen with all videos or only a few? |
I haven't checked, but I suspect on all anime videos, because they are drawn the same way its original clip |
Thanks for sharing, I was able to repro the issue. The issue isn't with detection but with PySceneDetect converting timecodes to frame numbers and back. This causes issues with certain containers/streams especially when there are corrupt frames. It should be fixed by #168 but I don't have a timeline for that fix yet unfortunately, since it is a very big change. |
@whatforiam sorry my initial theory might be incorrect - can you try setting the backend to PyAV with
And let me know if that fixes the issue? You can also try So far from my testing this video has different output with each supported backend (
This is probably leading the timecodes calculated for With PyAV we use |
Thank you so much. This command solved the problem! But I have another question. Is there any way to improve the detect of places where need to cut? As I understand it, the program is designed primarily for real videos, but are there any settings for a better detect for such 2d animations that I gave as an example? It's just that it either cuts too often, or vice versa in one moment 2 different angles. I just wanted it to separate into a separate file every time I changed the angle Of course, I wrote a script for bat to combine these files when dragging into one, but considering how many such videos I have, and how much I have to do this (>5000 series), I would like to make the work easier here is my code for combining videos when dragging, if it is useful, I wrote it myself (but the sound disappears a little at the joints of the video, I did not come up with how to solve this, so I wanted to at least reduce the number when it is necessary to combine)
|
You can change the weight placed on the luma channel for
You can try saving a statsfile and using that to help guide tuning each detector.
Keep in mind that the default setting for minimum scene length is 0.6 seconds, which can lead to some issues like this where it seems to "miss" these shot changes. You might want to lower it further to say 0.2-0.3 seconds. You can also customize how sensitive each detector is by lowering the threshold. See the docs for whatever detector you use for a full list of params. Please do let me know what parameters end up working best for your use case :) |
Could this be due to precision differences between the different libraries? It looks like moviepy and pyav are the same while OpenCV is different. I wonder if a solution for this specific framerate (23.976 comes from 3:2 pulldown), would be to check to see if the detected framerate is very, very close to 23.976, and if so, then simply define it as such, overriding what the library automatically detects? Not sure what that would break though. |
Yes, thank you very much for your help. I came to the conclusion that it is either better without any additional settings at all
or with these (This is a script .bat that processes each video in the input folder and saves it to the output folders_(File name))
That 's another one who needs mine .bat file for auto-cutting anime series
of course, this did not completely solve the problem, but it reduced the number of unnecessary triggers Should I close the repo or do you still need any information? |
@wjs018 I looked into this just now, but it looks like both ffmpeg and OpenCV are using Hard-coding a value for cases like this is a reasonable one, and would probably not break too many things. The most important thing is that we get the timecode calculations aligned with what ffmpeg expects for split-video functionality, as all the other output commands work on the VideoStream directly so there will never be visual off-by-one issues like this. I'll do some digging into how ffmpeg translates these timestamps back into timecodes or how it uses start seek and It's a bit worrying that OpenCV doesn't seem to work even when I use @whatforiam sure, please do. You might also want to try the new Thanks for the report and sharing the params you are using, I'll close the issue once I've done some further investigation into OpenCV/FFmpeg differences here. Before closing this out I think we should also add an FAQ for this to the website and the docs since this does come up frequently enough. Tasks:
|
Something that could be looked into is also how these timecodes are exported with |
I noticed that after I was advised to add pyav, most of my frames became normal, but sometimes not one frame is added to the end, but a whole second, I do not know how to fix it |
@IncredibleLaser thanks for bringing that up, I wasn't aware that was an issue. Filed #464 to track this issue.
@whatforiam could you provide a logfile to help debug the issue and also provide the version of PyAV you are using (run |
[PySceneDetect] PySceneDetect 0.6.4 System InfoOS Windows-10-10.0.19045-SP0 Packagesav 10.0.0 Toolsffmpeg 6.0-full_build-www.gyan.dev |
Description:
At the end of the sliced video via split-video there is a frame of the next video. I cut the anime into moments and on some videos it worked poorly, as a result, either 1-2 frames from the last moment are shown at the beginning, or the next one appears at the end for 1 frame
Command:
scenedetect -i input/input.mp4 split-video -o output -hq -p fast
Output:
BUG_REPORT.txt
Environment:
[PySceneDetect] PySceneDetect 0.6.4
System Info
OS Windows-10-10.0.19045-SP0
Python 3.9.13
Packages
av 10.0.0
click 8.1.7
cv2 4.10.0
moviepy Not Installed
numpy 1.26.4
platformdirs 4.2.2
scenedetect 0.6.4
tqdm 4.66.4
Tools
ffmpeg 6.0-full_build-www.gyan.dev
mkvmerge Not Installed
Media/Files:
https://github.com/user-attachments/assets/cf4dac57-632f-44a6-8893-d0ad1bf64cde
https://github.com/user-attachments/assets/379f5981-7e44-41a7-a277-583907542869
https://github.com/user-attachments/assets/c79a5b5a-1ade-4cee-8a43-66624aa839b9
https://github.com/user-attachments/assets/6ac030fc-a95d-4cde-a68e-03fd14209f8b
https://github.com/user-attachments/assets/ca551609-7a9e-46a4-a54d-6de1921a8ff8
https://github.com/user-attachments/assets/2bc46619-b1db-4917-a9f5-8e0c1c3ad124
The text was updated successfully, but these errors were encountered: