Merge 9aa66caa5b4be3ed91b9a75b8ad1ca2b2306fc29 into 66ab0814c4baa2dc79c2dd5287bc0ad61a37c5b9

This commit is contained in:
Deleted user 2023-09-05 20:45:09 +08:00 committed by GitHub
commit 987e67232e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 3 deletions

View File

@ -468,7 +468,7 @@ class FFmpegFD(ExternalFD):
args += ['-f', 'mpegts']
else:
args += ['-f', 'mp4']
if (ffpp.basename == 'ffmpeg' and is_outdated_version(ffpp._versions['ffmpeg'], '3.2', 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']

View File

@ -78,7 +78,22 @@ class FFmpegPostProcessor(PostProcessor):
prefer_ffmpeg = True
def get_ffmpeg_version(path):
ver = get_exe_version(path, args=['-version'])
if os.path.basename(path) == 'ffmpeg':
# 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. ]+)\s+/\s+([0-9. ]+))?')
if isinstance(vers, (list, tuple)):
ver = vers[0]
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:
ver = get_exe_version(path, args=['-version'])
if ver:
regexs = [
r'(?:\d+:)?([0-9.]+)-[0-9]+ubuntu[0-9.]+$', # Ubuntu, see [1]
@ -96,6 +111,7 @@ class FFmpegPostProcessor(PostProcessor):
self._paths = None
self._versions = None
self._lavf_version = {}
if self._downloader:
prefer_ffmpeg = self._downloader.params.get('prefer_ffmpeg', True)
location = self._downloader.params.get('ffmpeg_location')

View File

@ -3993,7 +3993,10 @@ def detect_exe_version(output, version_re=None, unrecognized='present'):
version_re = r'version\s+([-0-9._a-zA-Z]+)'
m = re.search(version_re, output)
if m:
return m.group(1)
if len(m.groups()) == 1:
return m.group(1)
else:
return m.groups()
else:
return unrecognized