Use '--' to separate the file argument from the options when calling ffmpeg
authorIdan Kamara <idankk86@gmail.com>
Fri, 25 Feb 2011 21:19:13 +0000 (23:19 +0200)
committerIdan Kamara <idankk86@gmail.com>
Fri, 25 Feb 2011 21:24:58 +0000 (23:24 +0200)
This is to avoid a potential issue if the file name begins with a hyphen since ffmpeg will interpret it as an option

youtube-dl

index 072a919707fa3bdfd805f90ab7765ad9bdd8eb34..79185b1e7c8972a74261097793bc8ab44edf6239 100755 (executable)
@@ -2620,7 +2620,7 @@ class FFmpegExtractAudioPP(PostProcessor):
        @staticmethod
        def get_audio_codec(path):
                try:
-                       handle = subprocess.Popen(['ffprobe', '-show_streams', path],
+                       handle = subprocess.Popen(['ffprobe', '-show_streams', '--', path],
                                        stderr=file(os.path.devnull, 'w'), stdout=subprocess.PIPE)
                        output = handle.communicate()[0]
                        if handle.wait() != 0:
@@ -2638,7 +2638,7 @@ class FFmpegExtractAudioPP(PostProcessor):
        @staticmethod
        def run_ffmpeg(path, out_path, codec, more_opts):
                try:
-                       ret = subprocess.call(['ffmpeg', '-y', '-i', path, '-vn', '-acodec', codec] + more_opts + [out_path],
+                       ret = subprocess.call(['ffmpeg', '-y', '-i', path, '-vn', '-acodec', codec] + more_opts + ['--', out_path],
                                        stdout=file(os.path.devnull, 'w'), stderr=subprocess.STDOUT)
                        return (ret == 0)
                except (IOError, OSError):