aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/postprocessor/ffmpeg.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-11-02 10:50:30 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-11-02 10:50:30 +0100
commit9580711841d60426e2b888cde7b410ae7d512849 (patch)
tree4860d80fd274a0ea0c26f605534d8875c23a9915 /youtube_dl/postprocessor/ffmpeg.py
parentc30ae9594cea215f36a736f944acd67fcec39d0d (diff)
[ffmpeg] Move version detection to utils
Diffstat (limited to 'youtube_dl/postprocessor/ffmpeg.py')
-rw-r--r--youtube_dl/postprocessor/ffmpeg.py20
1 files changed, 2 insertions, 18 deletions
diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index 083c79592..338c145fa 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -11,6 +11,7 @@ from ..utils import (
compat_subprocess_get_DEVNULL,
encodeArgument,
encodeFilename,
+ get_exe_version,
is_outdated_version,
PostProcessingError,
prepend_extension,
@@ -19,23 +20,6 @@ from ..utils import (
)
-def get_version(executable):
- """ Returns the version of the specified executable,
- or False if the executable is not present """
- try:
- out, err = subprocess.Popen(
- [executable, '-version'],
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()
- except OSError:
- return False
- firstline = out.partition(b'\n')[0].decode('ascii', 'ignore')
- m = re.search(r'version\s+([0-9._-a-zA-Z]+)', firstline)
- if not m:
- return u'present'
- else:
- return m.group(1)
-
-
class FFmpegPostProcessorError(PostProcessingError):
pass
@@ -61,7 +45,7 @@ class FFmpegPostProcessor(PostProcessor):
@staticmethod
def get_versions():
programs = ['avprobe', 'avconv', 'ffmpeg', 'ffprobe']
- return dict((program, get_version(program)) for program in programs)
+ return dict((p, get_exe_version(p, args=['-version'])) for p in programs)
@property
def _executable(self):