From c81e246846407bb6134726eb6a1afbd139cdcf51 Mon Sep 17 00:00:00 2001 From: Mattia Lecci Date: Mon, 6 Mar 2023 17:57:57 +0100 Subject: [PATCH] Add Error.cmdline print to examples --- examples/get_video_thumbnail.py | 2 +- examples/show_progress.py | 2 +- examples/transcribe.py | 2 +- examples/video_info.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/get_video_thumbnail.py b/examples/get_video_thumbnail.py index b905642..860965a 100755 --- a/examples/get_video_thumbnail.py +++ b/examples/get_video_thumbnail.py @@ -26,7 +26,7 @@ def generate_thumbnail(in_filename, out_filename, time, width): .run(capture_stdout=True, capture_stderr=True) ) except ffmpeg.Error as e: - print(e.stderr.decode(), file=sys.stderr) + print(f"$ {e.cmdline}\n{e.stderr.decode()}", file=sys.stderr) sys.exit(1) diff --git a/examples/show_progress.py b/examples/show_progress.py index dd0253a..81d24f5 100755 --- a/examples/show_progress.py +++ b/examples/show_progress.py @@ -125,6 +125,6 @@ if __name__ == '__main__': .run(capture_stdout=True, capture_stderr=True) ) except ffmpeg.Error as e: - print(e.stderr, file=sys.stderr) + print(f"$ {e.cmdline}\n{e.stderr.decode()}", file=sys.stderr) sys.exit(1) diff --git a/examples/transcribe.py b/examples/transcribe.py index 0b7200c..eb03ec9 100755 --- a/examples/transcribe.py +++ b/examples/transcribe.py @@ -27,7 +27,7 @@ def decode_audio(in_filename, **input_kwargs): .run(capture_stdout=True, capture_stderr=True) ) except ffmpeg.Error as e: - print(e.stderr, file=sys.stderr) + print(f"$ {e.cmdline}\n{e.stderr.decode()}", file=sys.stderr) sys.exit(1) return out diff --git a/examples/video_info.py b/examples/video_info.py index df9c992..525b22d 100755 --- a/examples/video_info.py +++ b/examples/video_info.py @@ -15,7 +15,7 @@ if __name__ == '__main__': try: probe = ffmpeg.probe(args.in_filename) except ffmpeg.Error as e: - print(e.stderr, file=sys.stderr) + print(f"$ {e.cmdline}\n{e.stderr.decode()}", file=sys.stderr) sys.exit(1) video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None)