Include streams with a blank format_note and the proper height

This commit is contained in:
tcely committed 2024-12-05 00:30:32 +00:00
1 parent 09044aa95d
commit b1a4c8bbaf
1 file changed
+5 -1
+5 -1
View File
@@ -87,7 +87,7 @@ def get_best_video_format(media):
return False, False return False, False
# Filter video-only formats by resolution that matches the source # Filter video-only formats by resolution that matches the source
video_formats = [] video_formats = []
sort_keys = [('height', False), ('id', False)] # key, reverse sort_keys = [('height', False), ('vcodec', True), ('vbr', False)] # key, reverse
for fmt in media.iter_formats(): for fmt in media.iter_formats():
# If the format has an audio stream, skip it # If the format has an audio stream, skip it
if fmt['acodec'] is not None: if fmt['acodec'] is not None:
@@ -120,6 +120,10 @@ def get_best_video_format(media):
source_resolution = media.source.source_resolution.strip().upper() source_resolution = media.source.source_resolution.strip().upper()
source_vcodec = media.source.source_vcodec source_vcodec = media.source.source_vcodec
exact_match, best_match = None, None exact_match, best_match = None, None
for fmt in video_formats:
# format_note was blank, match height instead
if '' == fmt['format'] and fmt['height'] == media.source.source_resolution_height:
fmt['format'] = source_resolution
# Of our filtered video formats, check for resolution + codec + hdr + fps match # Of our filtered video formats, check for resolution + codec + hdr + fps match
if media.source.prefer_60fps and media.source.prefer_hdr: if media.source.prefer_60fps and media.source.prefer_hdr:
for fmt in video_formats: for fmt in video_formats: