Only round end_time of removal segments

We don't actually care if we chop out a segment after a keyframe,
just that the next segment should start with one. So only the
end_time requires rounding, not the start_time.
This commit is contained in:
Quantum 2024-12-26 03:22:18 -05:00
parent cfc29f62c8
commit a9abae0a92
2 changed files with 1 additions and 6 deletions

View file

@ -567,7 +567,7 @@ class TestModifyChaptersPP(unittest.TestCase):
]) ])
self.assertEqual(chapters, [ self.assertEqual(chapters, [
{'start_time': 0, 'end_time': 2}, {'start_time': 0, 'end_time': 2},
{'start_time': 3, 'end_time': 5, 'remove': True}, {'start_time': 2, 'end_time': 5, 'remove': True},
{'start_time': 6, 'end_time': 10, 'remove': False}, {'start_time': 6, 'end_time': 10, 'remove': False},
]) ])

View file

@ -341,11 +341,6 @@ class ModifyChaptersPP(FFmpegPostProcessor):
result.append(c) result.append(c)
continue continue
start_frame = bisect.bisect_left(keyframes, c['start_time'])
if start_frame >= len(keyframes):
continue
c['start_time'] = keyframes[start_frame]
if c['end_time'] < keyframes[-1]: if c['end_time'] < keyframes[-1]:
c['end_time'] = keyframes[bisect.bisect_right(keyframes, c['end_time']) - 1] c['end_time'] = keyframes[bisect.bisect_right(keyframes, c['end_time']) - 1]
result.append(c) result.append(c)