From b580ccdd42b6a8b97f522c5f1339a45f389df5a6 Mon Sep 17 00:00:00 2001 From: imSp4rky Date: Sun, 2 Aug 2026 13:41:07 -0600 Subject: [PATCH] fix(tools): pass -nostdin to all ffmpeg calls When ffmpeg runs with the terminal on stdin it turns off echo for its interactive keys. If several run at once, or one gets killed, echo never comes back and the terminal is left broken after dl exits. --- unshackle/commands/util.py | 16 +++++++++++++++- unshackle/core/manifests/hls.py | 1 + unshackle/core/tracks/track.py | 1 + unshackle/core/tracks/video.py | 3 +++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/unshackle/commands/util.py b/unshackle/commands/util.py index 67d7f4d1..d2322028 100644 --- a/unshackle/commands/util.py +++ b/unshackle/commands/util.py @@ -135,7 +135,19 @@ def crop(path: Path, aspect: str, letter: bool, offset: int, preview: bool) -> N ] ffmpeg_call = subprocess.Popen( - [binaries.FFMPEG, "-y", "-i", str(video_path), "-map", "0:v:0", "-c", "copy", "-bsf:v", crop_filter] + [ + binaries.FFMPEG, + "-nostdin", + "-y", + "-i", + str(video_path), + "-map", + "0:v:0", + "-c", + "copy", + "-bsf:v", + crop_filter, + ] + out_path, stdout=subprocess.PIPE, ) @@ -216,6 +228,7 @@ def range_(path: Path, full: bool, preview: bool) -> None: ffmpeg_call = subprocess.Popen( [ binaries.FFMPEG, + "-nostdin", "-y", "-i", str(video_path), @@ -267,6 +280,7 @@ def test(path: Path, map_: str) -> None: p = subprocess.Popen( [ binaries.FFMPEG, + "-nostdin", "-hide_banner", "-benchmark", "-err_detect", diff --git a/unshackle/core/manifests/hls.py b/unshackle/core/manifests/hls.py index 11caa093..a84d697c 100644 --- a/unshackle/core/manifests/hls.py +++ b/unshackle/core/manifests/hls.py @@ -1074,6 +1074,7 @@ class HLS: subprocess.check_call( [ binaries.FFMPEG, + "-nostdin", "-hide_banner", "-loglevel", "error", diff --git a/unshackle/core/tracks/track.py b/unshackle/core/tracks/track.py index 3e1b34e6..26c10329 100644 --- a/unshackle/core/tracks/track.py +++ b/unshackle/core/tracks/track.py @@ -921,6 +921,7 @@ class Track: def _ffmpeg(extra_args: list[str] = None, bsf: Optional[str] = None): args = [ binaries.FFMPEG, + "-nostdin", "-hide_banner", "-loglevel", "error", diff --git a/unshackle/core/tracks/video.py b/unshackle/core/tracks/video.py index ead971fc..6d2aecd9 100644 --- a/unshackle/core/tracks/video.py +++ b/unshackle/core/tracks/video.py @@ -385,6 +385,7 @@ class Video(Track): subprocess.run( [ binaries.FFMPEG, + "-nostdin", "-hide_banner", "-loglevel", "panic", @@ -493,6 +494,7 @@ class Video(Track): subprocess.run( [ binaries.FFMPEG, + "-nostdin", "-hide_banner", "-loglevel", "error", @@ -667,6 +669,7 @@ class Video(Track): subprocess.run( [ binaries.FFMPEG, + "-nostdin", "-hide_banner", "-loglevel", "panic",