Skip to content

Commit 1a44636

Browse files
committed
fixed exception handling
1 parent 74d42a7 commit 1a44636

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

src/ffmpegio/transcode.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,8 @@ def transcode(input_url, output_url, progress=None, show_log=None, **options):
4646
)
4747
if pout.returncode:
4848
assert False
49-
except:
50-
raise FFmpegError(pout.stderr, show_log)
49+
except Exception as e:
50+
if pout:
51+
raise FFmpegError(pout.stderr, show_log)
52+
else:
53+
raise e

tests/test_transcode.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,14 @@ def test_transcode():
2727
# print(f.read())
2828

2929

30+
def test_transcode_vf():
31+
url = "tests/assets/testmulti-1m.mp4"
32+
with tempfile.TemporaryDirectory() as tmpdirname:
33+
# print(probe.audio_streams_basic(url))
34+
out_url = path.join(tmpdirname, path.basename(url))
35+
transcode(url, out_url, t='0.1', vf="scale=in_w:in_h*9/10", show_log=True)
36+
assert path.isfile(out_url)
37+
38+
3039
if __name__ == "__main__":
3140
test_transcode()

0 commit comments

Comments
 (0)