mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-22 06:00:00 +00:00
[ffmpeg] Detect libavformat version for aac_adtstoasc
and print available features in verbose head Based on https://github.com/ytdl-org/youtube-dl/pull/29581
This commit is contained in:
parent
832e9000c7
commit
8913ef74d7
3 changed files with 15 additions and 4 deletions
|
@ -3350,7 +3350,11 @@ def python_implementation():
|
|||
platform.architecture()[0],
|
||||
platform_name()))
|
||||
|
||||
exe_versions = FFmpegPostProcessor.get_versions(self)
|
||||
exe_versions, ffmpeg_features = FFmpegPostProcessor.get_versions_and_features(self)
|
||||
ffmpeg_features = {key for key, val in ffmpeg_features.items() if val}
|
||||
if ffmpeg_features:
|
||||
exe_versions['ffmpeg'] += f' (%s)' % ','.join(ffmpeg_features)
|
||||
|
||||
exe_versions['rtmpdump'] = rtmpdump_version()
|
||||
exe_versions['phantomjs'] = PhantomJSwrapper._version()
|
||||
exe_str = ', '.join(
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
encodeArgument,
|
||||
handle_youtubedl_headers,
|
||||
check_executable,
|
||||
is_outdated_version,
|
||||
Popen,
|
||||
sanitize_open,
|
||||
)
|
||||
|
@ -459,7 +458,7 @@ def _call_downloader(self, tmpfilename, info_dict):
|
|||
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 ffpp._features.get('needs_adtstoasc')) 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']
|
||||
|
|
|
@ -75,9 +75,14 @@ def check_version(self):
|
|||
self.basename, self.basename, required_version)
|
||||
self.report_warning(warning)
|
||||
|
||||
@staticmethod
|
||||
def get_versions_and_features(downloader=None):
|
||||
pp = FFmpegPostProcessor(downloader)
|
||||
return pp._versions, pp._features
|
||||
|
||||
@staticmethod
|
||||
def get_versions(downloader=None):
|
||||
return FFmpegPostProcessor(downloader)._versions
|
||||
return FFmpegPostProcessor.get_version_and_features(downloader)[0]
|
||||
|
||||
def _determine_executables(self):
|
||||
programs = ['avprobe', 'avconv', 'ffmpeg', 'ffprobe']
|
||||
|
@ -99,9 +104,12 @@ def get_ffmpeg_version(path, prog):
|
|||
if prog != 'ffmpeg' or not out:
|
||||
return
|
||||
|
||||
mobj = re.search(r'(?m)^\s+libavformat\s+(?:[0-9. ]+)\s+/\s+(?P<runtime>[0-9. ]+)', out)
|
||||
lavf_runtime_version = mobj.group('runtime').replace(' ', '') if mobj else None
|
||||
self._features = {
|
||||
'fdk': '--enable-libfdk-aac' in out,
|
||||
'setts': 'setts' in out.splitlines(),
|
||||
'needs_adtstoasc': is_outdated_version(lavf_runtime_version, '57.56.100', False),
|
||||
}
|
||||
|
||||
self.basename = None
|
||||
|
|
Loading…
Reference in a new issue