From 9aa66caa5b4be3ed91b9a75b8ad1ca2b2306fc29 Mon Sep 17 00:00:00 2001 From: kikuyan Date: Mon, 19 Jul 2021 11:39:33 +0900 Subject: [PATCH] add to extract libavformat build version --- youtube_dl/downloader/external.py | 2 +- youtube_dl/postprocessor/ffmpeg.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py index 11131e525..32b687481 100644 --- a/youtube_dl/downloader/external.py +++ b/youtube_dl/downloader/external.py @@ -321,7 +321,7 @@ class FFmpegFD(ExternalFD): args += ['-f', 'mpegts'] else: args += ['-f', 'mp4'] - if (ffpp.basename == 'ffmpeg' and is_outdated_version(ffpp._lavf_version, '57.56.100', False)) and (not info_dict.get('acodec') or info_dict['acodec'].split('.')[0] in ('aac', 'mp4a')): + if (ffpp.basename == 'ffmpeg' and is_outdated_version(ffpp._lavf_version.get('runtime'), '57.56.100', False)) and (not info_dict.get('acodec') or info_dict['acodec'].split('.')[0] in ('aac', 'mp4a')): args += ['-bsf:a', 'aac_adtstoasc'] elif protocol == 'rtmp': args += ['-f', 'flv'] diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index 8aea0d67f..19d7163bb 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -81,11 +81,14 @@ class FFmpegPostProcessor(PostProcessor): # get ffmpeg and libavformat runtime versions vers = get_exe_version( path, args=['-version'], - version_re=r'(?s)version\s+([-0-9._a-zA-Z]+)(?:.*?libavformat.*?/\s+([0-9. ]+))?') + version_re=r'(?s)version\s+([-0-9._a-zA-Z]+)(?:.*?libavformat\s+([0-9. ]+)\s+/\s+([0-9. ]+))?') if isinstance(vers, (list, tuple)): ver = vers[0] - if len(vers) > 1 and vers[1]: - self._lavf_version = vers[1].replace(' ', '') + if len(vers) > 2 and vers[1] and vers[2]: + self._lavf_version = { + 'build': vers[1].replace(' ', ''), + 'runtime': vers[2].replace(' ', '') + } else: ver = vers else: @@ -107,7 +110,7 @@ class FFmpegPostProcessor(PostProcessor): self._paths = None self._versions = None - self._lavf_version = None + self._lavf_version = {} if self._downloader: prefer_ffmpeg = self._downloader.params.get('prefer_ffmpeg', True) location = self._downloader.params.get('ffmpeg_location')