summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-01-09 19:02:06 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-01-09 19:02:07 +0100
commitb0e87c311078cf8510c720d50d4960a87f43296b (patch)
tree9993dae0fd7aab7fe5bc5bcc57d4f642da357c05
parentc0bdf32a3cb0f6a08ba92cb5261d020ef2f61892 (diff)
downloadyoutube-dl-b0e87c311078cf8510c720d50d4960a87f43296b.tar.gz
youtube-dl-b0e87c311078cf8510c720d50d4960a87f43296b.tar.xz
youtube-dl-b0e87c311078cf8510c720d50d4960a87f43296b.zip
[ffmpeg] Correctly encode paths on Windows
On Python 2.x on Windows, if there are any unicode arguments in the command argument list, the whole list is converted to unicode internally.
Therefore, we need to call encodeArgument on every argument.

Fixes #4337 and #4668.
-rw-r--r--youtube_dl/postprocessor/ffmpeg.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index 473536dcc..d1b342c7a 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -80,8 +80,9 @@ class FFmpegPostProcessor(PostProcessor):
 
         files_cmd = []
         for path in input_paths:
-            files_cmd.extend(['-i', encodeFilename(path, True)])
-        cmd = ([self._executable, '-y'] + files_cmd
+            files_cmd.extend([encodeArgument('-i'), encodeFilename(path, True)])
+        cmd = ([encodeFilename(self._executable, True), encodeArgument('-y')] +
+               files_cmd
                + [encodeArgument(o) for o in opts] +
                [encodeFilename(self._ffmpeg_filename_argument(out_path), True)])
 
@@ -122,8 +123,8 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
             raise PostProcessingError('ffprobe or avprobe not found. Please install one.')
         try:
             cmd = [
-                self._probe_executable,
-                '-show_streams',
+                encodeFilename(self._probe_executable, True),
+                encodeArgument('-show_streams'),
                 encodeFilename(self._ffmpeg_filename_argument(path), True)]
             handle = subprocess.Popen(cmd, stderr=compat_subprocess_get_DEVNULL(), stdout=subprocess.PIPE)
             output = handle.communicate()[0]