diff --git a/src/ytdl_sub/plugins/chapters.py b/src/ytdl_sub/plugins/chapters.py index 0394a0fd..d0a50b0b 100644 --- a/src/ytdl_sub/plugins/chapters.py +++ b/src/ytdl_sub/plugins/chapters.py @@ -235,7 +235,7 @@ class ChaptersPlugin(Plugin[ChaptersOptions]): "postprocessors": [ { "key": "SponsorBlock", - "when": "pre_process", + "when": "after_filter", "categories": self.plugin_options.sponsorblock_categories, }, {"key": "ModifyChapters"}, @@ -280,6 +280,20 @@ class ChaptersPlugin(Plugin[ChaptersOptions]): } ) + # Add this to the end to fully replicate sponsorblock chapter removal in yt-dlp + # reference: yt-dlp/devscripts/cli_to_api.py --sponsorblock-remove all --embed-chapters + if self._is_removing_chapters: + builder.add( + { + "postprocessors": [ + {'key': 'FFmpegConcat', + 'only_multi_video': True, + 'when': 'playlist'} + ] + } + ) + + return builder.to_dict() def _get_removed_chapters(self, entry: Entry) -> List[str]: