From a8fb4b105b07a168128069174b387452616e125b Mon Sep 17 00:00:00 2001 From: Alex DeLorenzo Date: Wed, 16 Nov 2022 19:21:38 -0500 Subject: [PATCH] Quote filenames to handle paths spaces --- ffmpeg/_run.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ffmpeg/_run.py b/ffmpeg/_run.py index f42d1d7..9cdb431 100644 --- a/ffmpeg/_run.py +++ b/ffmpeg/_run.py @@ -3,6 +3,7 @@ from .dag import get_outgoing_edges, topo_sort from ._utils import basestring, convert_kwargs_to_cmd_line_args from builtins import str from functools import reduce +from shlex import quote import copy import operator import subprocess @@ -44,7 +45,7 @@ def _get_input_args(input_node): if video_size: args += ['-video_size', '{}x{}'.format(video_size[0], video_size[1])] args += convert_kwargs_to_cmd_line_args(kwargs) - args += ['-i', filename] + args += ['-i', quote(filename)] else: raise ValueError('Unsupported input node: {}'.format(input_node)) return args @@ -144,7 +145,7 @@ def _get_output_args(node, stream_name_map): video_size = '{}x{}'.format(video_size[0], video_size[1]) args += ['-video_size', video_size] args += convert_kwargs_to_cmd_line_args(kwargs) - args += [filename] + args += [quote(filename)] return args