From 0ed8aec83d89d5eacd8b8d50e02d714407c8a47b Mon Sep 17 00:00:00 2001 From: Jesse Bannon Date: Thu, 4 Jul 2024 10:03:34 -0700 Subject: [PATCH] [BACKEND] Show ffmpeg conversion errors (#1016) --- src/ytdl_sub/plugins/file_convert.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ytdl_sub/plugins/file_convert.py b/src/ytdl_sub/plugins/file_convert.py index 00182d69..1b9ecf1e 100644 --- a/src/ytdl_sub/plugins/file_convert.py +++ b/src/ytdl_sub/plugins/file_convert.py @@ -1,4 +1,5 @@ import os +from subprocess import CalledProcessError from typing import Any from typing import Dict from typing import Optional @@ -204,9 +205,10 @@ class FileConvertPlugin(Plugin[FileConvertOptions]): try: FFMPEG.run(ffmpeg_args) except Exception as exc: - raise ValidationException( - f"ffmpeg_post_process_args {' '.join(ffmpeg_args)} result in an error" - ) from exc + err_msg = f"ffmpeg_post_process_args {' '.join(ffmpeg_args)} result in an error" + if isinstance(exc, CalledProcessError): + err_msg += f":\n{exc.stderr.decode('utf-8')}" + raise ValidationException(err_msg) from exc if not os.path.isfile(tmp_output_file): raise ValidationException(