Guess at ffmpeg options based on filename

This commit is contained in:
tcely 2025-01-27 20:24:23 -05:00 committed by GitHub
parent d160a043e5
commit b40626f9dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -245,6 +245,22 @@ def download_media(url, media_format, extension, output_file, info_json,
'home': os.path.dirname(output_file),
})
codec_options = []
ofn = os.path.basename(output_file)
if 'av1-' in ofn:
codec_options = ['-c:v', 'libsvtav1', '-preset', '8', '-crf', '35']
elif 'vp9-' in ofn:
codec_options = ['-c:v', 'libvpx-vp9', '-b:v', '0', '-crf', '31']
ytopts['postprocessor_args'] = opts.get('postprocessor_args', {})
set_ffmpeg_codec = not (
ytopts['postprocessor_args'] and
ytopts['postprocessor_args']['modifychapters+ffmpeg']
)
if set_ffmpeg_codec and codec_options:
ytopts['postprocessor_args'].update({
'modifychapters+ffmpeg': codec_options,
})
# clean-up incompatible keys
pp_opts = {k: v for k, v in pp_opts.items() if not k.startswith('_')}