Skip to content

Commit 8811047

Browse files
committed
SingleVideoMuxer: fix the problem that the end frame is missing after splitting in some extreme cases according to mkvmerge's splitting feature
1 parent d7a518a commit 8811047

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

OKEGui/OKEGui/JobProcessor/Muxer/SingleVideoMuxer.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ public override void BuildCommandline()
2525
commandLine += $" --default-track \"0:1\" --language 0:und \"(\" \"{MJob.Input}\" \")\"";
2626
if (MJob.IsPartialMux)
2727
{
28-
commandLine += $" --split parts-frames:{MJob.FrameRange.begin + 1}-{MJob.FrameRange.end}";
28+
// OKE's frame number range is in python format, with the start frame included but the end frame excluded.
29+
// So when converting to mkvmerge format, only the start frame number is added by one.
30+
// According to mkvmerge's documentation, when splitting by frame, the result will contain the content up to but excluding the first key frame at or after the end frame.
31+
// It means that if the end frame happens to be a key frame (there are two consecutive key frames in end and end+1), the end frame won't be included.
32+
// To avoid such a situation, we pass end+1 to mkvmerge, since end+1 frame is always a key frame and it won't be included.
33+
commandLine += $" --split parts-frames:{MJob.FrameRange.begin + 1}-{MJob.FrameRange.end + 1}";
2934
}
3035
}
3136
}

0 commit comments

Comments
 (0)