diff --git a/auto_editor/__main__.py b/auto_editor/__main__.py index 85e7744c6..3d11fe4f5 100755 --- a/auto_editor/__main__.py +++ b/auto_editor/__main__.py @@ -255,6 +255,11 @@ def main_options(parser: ArgumentParser) -> ArgumentParser: help="Apply audio rendering to all audio tracks. Applied right before rendering the output file.", ) parser.add_text("Miscellaneous:") + parser.add_argument( + "-sn", + flag=True, + help="Disable the inclusion of subtitle streams in the output file", + ) parser.add_argument( "--extras", metavar="CMD", diff --git a/auto_editor/edit.py b/auto_editor/edit.py index fddc64a27..93c88d981 100644 --- a/auto_editor/edit.py +++ b/auto_editor/edit.py @@ -215,7 +215,7 @@ def edit_media( if tl is None: # Extract subtitles in their native format. - if src is not None and len(src.subtitles) > 0: + if src is not None and len(src.subtitles) > 0 and not args.sn: cmd = ["-i", f"{src.path}", "-hide_banner"] for s, sub in enumerate(src.subtitles): cmd.extend(["-map", f"0:s:{s}"]) @@ -283,7 +283,7 @@ def make_media(tl: v3, output: str) -> None: sub_output = [] apply_later = False - if ctr.allow_subtitle: + if ctr.allow_subtitle and not args.sn: sub_output = make_new_subtitles(tl, ffmpeg, temp, log) if ctr.allow_audio: diff --git a/auto_editor/output.py b/auto_editor/output.py index 89d3354bb..2d2685366 100644 --- a/auto_editor/output.py +++ b/auto_editor/output.py @@ -88,7 +88,7 @@ def mux_quality_media( ) -> None: v_tracks = len(visual_output) a_tracks = len(audio_output) - s_tracks = len(sub_output) + s_tracks = 0 if args.sn else len(sub_output) cmd = ["-hide_banner", "-y", "-i", f"{src.path}"] @@ -192,7 +192,9 @@ def mux_quality_media( if args.extras is not None: cmd.extend(args.extras.split(" ")) cmd.extend(["-strict", "-2"]) # Allow experimental codecs. - cmd.extend(["-map", "0:t?"]) # Add input attachments to output. + + if not args.sn: + cmd.extend(["-map", "0:t?"]) # Add input attachments to output. # This was causing a crash for 'example.mp4 multi-track.mov' # cmd.extend(["-map", "0:d?"]) diff --git a/auto_editor/utils/types.py b/auto_editor/utils/types.py index f5e360a5b..ccd6581c7 100644 --- a/auto_editor/utils/types.py +++ b/auto_editor/utils/types.py @@ -229,6 +229,7 @@ class Args: video_quality_scale: str = "unset" scale: float = 1.0 extras: str | None = None + sn: bool = False no_seek: bool = False cut_out: list[list[str]] = field(default_factory=list) add_in: list[list[str]] = field(default_factory=list)