mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-06 01:22:35 +00:00
[postprocessor/ffmpeg] sanitize ffmpeg version for Ubuntu and Arch Linux systems(closes #18813)
This commit is contained in:
parent
c469e8808c
commit
a64646e417
@ -79,6 +79,19 @@ class FFmpegPostProcessor(PostProcessor):
|
|||||||
programs = ['avprobe', 'avconv', 'ffmpeg', 'ffprobe']
|
programs = ['avprobe', 'avconv', 'ffmpeg', 'ffprobe']
|
||||||
prefer_ffmpeg = True
|
prefer_ffmpeg = True
|
||||||
|
|
||||||
|
def get_ffmpeg_version(path):
|
||||||
|
ver = get_exe_version(path, args=['-version'])
|
||||||
|
if ver:
|
||||||
|
regexs = [
|
||||||
|
r'([0-9.]+)-0ubuntu0\.[0-9.]+$', # Ubuntu
|
||||||
|
r'n([0-9.]+)$', # Arch Linux
|
||||||
|
]
|
||||||
|
for regex in regexs:
|
||||||
|
mobj = re.match(regex, ver)
|
||||||
|
if mobj:
|
||||||
|
ver = mobj.group(1)
|
||||||
|
return ver
|
||||||
|
|
||||||
self.basename = None
|
self.basename = None
|
||||||
self.probe_basename = None
|
self.probe_basename = None
|
||||||
|
|
||||||
@ -110,11 +123,10 @@ class FFmpegPostProcessor(PostProcessor):
|
|||||||
self._paths = dict(
|
self._paths = dict(
|
||||||
(p, os.path.join(location, p)) for p in programs)
|
(p, os.path.join(location, p)) for p in programs)
|
||||||
self._versions = dict(
|
self._versions = dict(
|
||||||
(p, get_exe_version(self._paths[p], args=['-version']))
|
(p, get_ffmpeg_version(self._paths[p])) for p in programs)
|
||||||
for p in programs)
|
|
||||||
if self._versions is None:
|
if self._versions is None:
|
||||||
self._versions = dict(
|
self._versions = dict(
|
||||||
(p, get_exe_version(p, args=['-version'])) for p in programs)
|
(p, get_ffmpeg_version(p)) for p in programs)
|
||||||
self._paths = dict((p, p) for p in programs)
|
self._paths = dict((p, p) for p in programs)
|
||||||
|
|
||||||
if prefer_ffmpeg is False:
|
if prefer_ffmpeg is False:
|
||||||
|
Loading…
Reference in New Issue
Block a user