aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/postprocessor/modify_chapters.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-05-23 16:10:09 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-05-23 16:12:33 +0530
commitd9473db78ad4c002de53f4cc7c9b045399f8ab72 (patch)
tree6a5a2d73f9157fc39a9e710c7cc3cb8b25a59320 /yt_dlp/postprocessor/modify_chapters.py
parent11233f2afdfc55d3672a7c17ad919a3f70005c19 (diff)
[ModifyChapters] Fix repeated removal of small segments
Closes #3846
Diffstat (limited to 'yt_dlp/postprocessor/modify_chapters.py')
-rw-r--r--yt_dlp/postprocessor/modify_chapters.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/yt_dlp/postprocessor/modify_chapters.py b/yt_dlp/postprocessor/modify_chapters.py
index 8a2ef9065..de3505e11 100644
--- a/yt_dlp/postprocessor/modify_chapters.py
+++ b/yt_dlp/postprocessor/modify_chapters.py
@@ -32,13 +32,13 @@ class ModifyChaptersPP(FFmpegPostProcessor):
real_duration = self._get_real_video_duration(info['filepath'])
if not chapters:
- chapters = [{'start_time': 0, 'end_time': real_duration, 'title': info['title']}]
+ chapters = [{'start_time': 0, 'end_time': info.get('duration') or real_duration, 'title': info['title']}]
info['chapters'], cuts = self._remove_marked_arrange_sponsors(chapters + sponsor_chapters)
if not cuts:
return [], info
- if self._duration_mismatch(real_duration, info.get('duration')):
+ if self._duration_mismatch(real_duration, info.get('duration'), 1):
if not self._duration_mismatch(real_duration, info['chapters'][-1]['end_time']):
self.to_screen(f'Skipping {self.pp_key()} since the video appears to be already cut')
return [], info