From 656cc637bde7595ace2742f31589498dd40cb31b Mon Sep 17 00:00:00 2001 From: Hannes Braun Date: Mon, 22 May 2023 21:40:39 +0200 Subject: [PATCH] Escape command arguments on dry option This allows the output to be passed to eval in a script (or something similar). --- hav1w.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hav1w.py b/hav1w.py index 676bd95..9bc8dd1 100644 --- a/hav1w.py +++ b/hav1w.py @@ -1,12 +1,13 @@ import argparse import os import pathlib +import shlex import subprocess import yaml # Hannes' AV1 wrapper script -# Version 2.0.0 +# Version 2.0.1 # This is a good guide for optimizing AV1 parameters with the AOM reference encoder: # https://www.reddit.com/r/AV1/comments/t59j32/encoder_tuning_part_4_a_2nd_generation_guide_to/ @@ -101,7 +102,7 @@ cmd += ["-b:a", preset["ba"], "-af", f"aformat=channel_layouts={preset['alayout' cmd += [args.output] if args.dry: - print(" ".join(cmd)) + print(" ".join(list(map(lambda x:shlex.quote(x), cmd)))) exit(0) p = subprocess.run(cmd)