-
Notifications
You must be signed in to change notification settings - Fork 415
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
Dropped scenes if using --copy with split-video #236
Comments
Hi @notagainbutyeah; Interesting find - it looks like this works when using
Does that command yield the correct output on your end? If so, I think it now makes sense to default to using Thanks! |
Unfortunately when using the copy mode, precise splits are impossible in a lot of cases since it requires a keyframe to be at the exact split point. This behavior is described in both the If performance is your main concern, you can tweak the ffmpeg arguments to reduce processing time at expense of file size (same with quality, can even make it lossless). I'll leave this open for now though as I'd like to look more into this sample video to see exactly the distribution of I/P/B frames that is causing this issue. |
That was just an example. If I split a whole episode I get so many not split parts. Or are they wrong splits in the first place? Anyway when you take out a possible wrong split the bug of this thead arise. The concer about transcode is quality. Also is there a way to ask ffmpeg to get the same quality? Without ending with nonsense size. |
I had a look with Thus, with ffmpeg, extra frames are included when doing stream copying. This is implicitly done with mkvmerge as well, but the mkv container has additional metadata indicating when the stream should stop being presented. Using mkvmerge also doesn't output the 2nd scene since there are no keyframes after/on the starting timecode. ffmpeg ignores this and simply copies the P and B frames from the output, which is why the first few frames may appear corrupted when trying to view the video. This issue is typically worse with animated videos, since they generally have a much higher amount of P and B frames to reduce the encoded file size. The only solution that works for all types of input videos consistently is to not use You should be able to get pretty good results by specifying If you truly do need lossless, then you can specify Also note that in some cases OpenCV has already been known to drop some frames which can lead to incorrect timecodes - see #213 for details. Hope this helps, and thanks for the additional clip. |
So after re-visiting the output, my analysis above might be slightly incorrect re: ffmpeg's case - there, the last 3 frames is a sequence of P -> B -> P. The video should end on the B-frame according to where the split is detected, but this is not possible, since actually decoding the B frame requires both frames adjacent to it. Thus an extra frame from the next scene is required to be included. Try doing it this way:
Remember to escape the $'s if you're on bash, e.g.:
Does this solve the issue for you? Edit: I think I was looking at the wrong file - this still has some off by one issues... Let me know though what you think. Depending on if it's better/worse, I might rework #77 to just get rid of using mkvmerge entirely, and just use ffmpeg always for doing steam copying (or swap the default to ffmpeg, since clearly it gives better behavior out of the box). Either way, marking this as a bug now since clearly |
I don't understand what is the difference with this new command, I can tell that the audio part is missing. I am not able to run this since in Windows cmd $ get not escaped with . |
@notagainbutyeah the only difference is the extension that gets passed to ffmpeg. If the output file name ends in .mkv, it forces the output container to be Matroska. |
The default for -c/--copy in v0.6 will be to use ffmpeg which should avoid this issue. See #77 for details. Available in the v0.6 beta. |
Bug/Issue Description:
![immagine](https://user-images.githubusercontent.com/89797453/131371571-a6b8829c-4b5f-44cb-8695-9b6dc6fa8919.png)
With ffmpeg is fine but mkvmerge eats some split.
Required Information:
scenedetect -i 1.mkv detect-content split-video -c
clip.zip
BUG_REPORT.txt
Computing Environment:
The text was updated successfully, but these errors were encountered: