diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-10-18 23:19:25 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-10-18 23:36:59 +0530 |
commit | cd5df121f3577178cb73bafe886677da9452dc42 (patch) | |
tree | 480a0a8ddf5cc5df5a4e495212a137da76824e13 | |
parent | 73ac0e6b857ca138481594cb24d9532ba2714a02 (diff) | |
download | hypervideo-pre-cd5df121f3577178cb73bafe886677da9452dc42.tar.lz hypervideo-pre-cd5df121f3577178cb73bafe886677da9452dc42.tar.xz hypervideo-pre-cd5df121f3577178cb73bafe886677da9452dc42.zip |
[SponsorBlock] Relax duration check for large segments
-rw-r--r-- | yt_dlp/postprocessor/sponsorblock.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/yt_dlp/postprocessor/sponsorblock.py b/yt_dlp/postprocessor/sponsorblock.py index bb15eb709..188eb059a 100644 --- a/yt_dlp/postprocessor/sponsorblock.py +++ b/yt_dlp/postprocessor/sponsorblock.py @@ -64,7 +64,8 @@ class SponsorBlockPP(FFmpegPostProcessor): if duration and duration - start_end[1] <= 1: start_end[1] = duration # SponsorBlock duration may be absent or it may deviate from the real one. - return s['videoDuration'] == 0 or not duration or abs(duration - s['videoDuration']) <= 1 + diff = abs(duration - s['videoDuration']) if s['videoDuration'] else 0 + return diff < 1 or (diff < 5 and diff / (start_end[1] - start_end[0]) < 0.05) duration_match = [s for s in segments if duration_filter(s)] if len(duration_match) != len(segments): |