mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-15 00:48:28 +00:00
Merge d60baa052f
into 38c2bf4026
This commit is contained in:
commit
ac24f575f3
@ -3466,6 +3466,7 @@ def correct_ext(filename, ext=new_ext):
|
||||
|
||||
merger = FFmpegMergerPP(self)
|
||||
downloaded = []
|
||||
should_merge = True
|
||||
if dl_filename is not None:
|
||||
self.report_file_already_downloaded(dl_filename)
|
||||
elif fd:
|
||||
@ -3483,12 +3484,20 @@ def correct_ext(filename, ext=new_ext):
|
||||
'You have requested merging of multiple formats '
|
||||
'while also allowing unplayable formats to be downloaded. '
|
||||
'The formats won\'t be merged to prevent data corruption.')
|
||||
should_merge = False
|
||||
elif not merger.available:
|
||||
msg = 'You have requested merging of multiple formats but ffmpeg is not installed'
|
||||
if not self.params.get('ignoreerrors'):
|
||||
self.report_error(f'{msg}. Aborting due to --abort-on-error')
|
||||
return
|
||||
self.report_warning(f'{msg}. The formats won\'t be merged')
|
||||
should_merge = False
|
||||
elif any(f.get('container') == 'iamf' for f in info_dict['requested_formats']):
|
||||
self.report_warning(
|
||||
'You have requested merging of multiple formats '
|
||||
'but one of the formats is an IAMF audio format. '
|
||||
'The formats won\'t be merged to prevent data loss.')
|
||||
should_merge = False
|
||||
|
||||
if temp_filename == '-':
|
||||
reason = ('using a downloader other than ffmpeg' if FFmpegFD.can_merge_formats(info_dict, self.params)
|
||||
@ -3514,7 +3523,7 @@ def correct_ext(filename, ext=new_ext):
|
||||
info_dict['__real_download'] = info_dict['__real_download'] or real_download
|
||||
success = success and partial_success
|
||||
|
||||
if downloaded and merger.available and not self.params.get('allow_unplayable_formats'):
|
||||
if downloaded and should_merge:
|
||||
info_dict['__postprocessors'].append(merger)
|
||||
info_dict['__files_to_merge'] = downloaded
|
||||
# Even if there were no downloads, it is being merged only now
|
||||
|
@ -3540,8 +3540,8 @@ def gvs_pot_required(policy, is_premium_subscriber, has_player_token):
|
||||
'width': int_or_none(fmt.get('width')),
|
||||
'language': join_nonempty(language_code, 'desc' if is_descriptive else '') or None,
|
||||
'language_preference': PREFERRED_LANG_VALUE if is_original else 5 if is_default else -10 if is_descriptive else -1,
|
||||
# Strictly de-prioritize damaged and 3gp formats
|
||||
'preference': -10 if is_damaged else -2 if itag == '17' else None,
|
||||
# Strictly de-prioritize damaged, 3gp and iamf formats
|
||||
'preference': -10 if is_damaged else -2 if itag in ('17', '773') else None,
|
||||
}
|
||||
mime_mobj = re.match(
|
||||
r'((?:[^/]+)/(?:[^;]+))(?:;\s*codecs="([^"]+)")?', fmt.get('mimeType') or '')
|
||||
@ -3552,7 +3552,7 @@ def gvs_pot_required(policy, is_premium_subscriber, has_player_token):
|
||||
itags[itag].add(('https', dct.get('language')))
|
||||
stream_ids.append(stream_id)
|
||||
single_stream = 'none' in (dct.get('acodec'), dct.get('vcodec'))
|
||||
if single_stream and dct.get('ext'):
|
||||
if single_stream and dct.get('ext') and not dct.get('container'):
|
||||
dct['container'] = dct['ext'] + '_dash'
|
||||
|
||||
if (all_formats or 'dashy' in format_types) and dct['filesize']:
|
||||
|
@ -3030,7 +3030,7 @@ def parse_codecs(codecs_str):
|
||||
return {}
|
||||
split_codecs = list(filter(None, map(
|
||||
str.strip, codecs_str.strip().strip(',').split(','))))
|
||||
vcodec, acodec, scodec, hdr = None, None, None, None
|
||||
vcodec, acodec, scodec, hdr, container = None, None, None, None, None
|
||||
for full_codec in split_codecs:
|
||||
full_codec = re.sub(r'^([^.]+)', lambda m: m.group(1).lower(), full_codec)
|
||||
parts = re.sub(r'0+(?=\d)', '', full_codec).split('.')
|
||||
@ -3046,8 +3046,10 @@ def parse_codecs(codecs_str):
|
||||
elif parts[:2] == ['vp9', '2']:
|
||||
hdr = 'HDR10'
|
||||
elif parts[0] in ('flac', 'mp4a', 'opus', 'vorbis', 'mp3', 'aac', 'ac-4',
|
||||
'ac-3', 'ec-3', 'eac3', 'dtsc', 'dtse', 'dtsh', 'dtsl'):
|
||||
'ac-3', 'ec-3', 'eac3', 'dtsc', 'dtse', 'dtsh', 'dtsl', 'iamf'):
|
||||
acodec = acodec or full_codec
|
||||
if parts[0] == 'iamf':
|
||||
container = 'iamf'
|
||||
elif parts[0] in ('stpp', 'wvtt'):
|
||||
scodec = scodec or full_codec
|
||||
else:
|
||||
@ -3058,6 +3060,7 @@ def parse_codecs(codecs_str):
|
||||
'acodec': acodec or 'none',
|
||||
'dynamic_range': hdr,
|
||||
**({'scodec': scodec} if scodec is not None else {}),
|
||||
**({'container': container} if container is not None else {}),
|
||||
}
|
||||
elif len(split_codecs) == 2:
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user