mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 14:45:14 +00:00 
			
		
		
		
	Fix format sorting bug with vp9.2 vcodec (#10884)
Authored by: rakslice
This commit is contained in:
		| @@ -236,6 +236,35 @@ class TestFormatSelection(unittest.TestCase): | ||||
|         downloaded = ydl.downloaded_info_dicts[0] | ||||
|         self.assertEqual(downloaded['format_id'], 'vid-vcodec-dot') | ||||
| 
 | ||||
|     def test_format_selection_by_vcodec_sort(self): | ||||
|         formats = [ | ||||
|             {'format_id': 'av1-format', 'ext': 'mp4', 'vcodec': 'av1', 'acodec': 'none', 'url': TEST_URL}, | ||||
|             {'format_id': 'vp9-hdr-format', 'ext': 'mp4', 'vcodec': 'vp09.02.50.10.01.09.18.09.00', 'acodec': 'none', 'url': TEST_URL}, | ||||
|             {'format_id': 'vp9-sdr-format', 'ext': 'mp4', 'vcodec': 'vp09.00.50.08', 'acodec': 'none', 'url': TEST_URL}, | ||||
|             {'format_id': 'h265-format', 'ext': 'mp4', 'vcodec': 'h265', 'acodec': 'none', 'url': TEST_URL}, | ||||
|         ] | ||||
|         info_dict = _make_result(formats) | ||||
| 
 | ||||
|         ydl = YDL({'format': 'bestvideo', 'format_sort': ['vcodec:vp9.2']}) | ||||
|         ydl.process_ie_result(info_dict.copy()) | ||||
|         downloaded = ydl.downloaded_info_dicts[0] | ||||
|         self.assertEqual(downloaded['format_id'], 'vp9-hdr-format') | ||||
| 
 | ||||
|         ydl = YDL({'format': 'bestvideo', 'format_sort': ['vcodec:vp9']}) | ||||
|         ydl.process_ie_result(info_dict.copy()) | ||||
|         downloaded = ydl.downloaded_info_dicts[0] | ||||
|         self.assertEqual(downloaded['format_id'], 'vp9-sdr-format') | ||||
| 
 | ||||
|         ydl = YDL({'format': 'bestvideo', 'format_sort': ['+vcodec:vp9.2']}) | ||||
|         ydl.process_ie_result(info_dict.copy()) | ||||
|         downloaded = ydl.downloaded_info_dicts[0] | ||||
|         self.assertEqual(downloaded['format_id'], 'vp9-hdr-format') | ||||
| 
 | ||||
|         ydl = YDL({'format': 'bestvideo', 'format_sort': ['+vcodec:vp9']}) | ||||
|         ydl.process_ie_result(info_dict.copy()) | ||||
|         downloaded = ydl.downloaded_info_dicts[0] | ||||
|         self.assertEqual(downloaded['format_id'], 'vp9-sdr-format') | ||||
| 
 | ||||
|     def test_format_selection_string_ops(self): | ||||
|         formats = [ | ||||
|             {'format_id': 'abc-cba', 'ext': 'mp4', 'url': TEST_URL}, | ||||
|   | ||||
| @@ -921,6 +921,11 @@ class TestUtil(unittest.TestCase): | ||||
|             'acodec': 'none', | ||||
|             'dynamic_range': 'HDR10', | ||||
|         }) | ||||
|         self.assertEqual(parse_codecs('vp09.02.50.10.01.09.18.09.00'), { | ||||
|             'vcodec': 'vp09.02.50.10.01.09.18.09.00', | ||||
|             'acodec': 'none', | ||||
|             'dynamic_range': 'HDR10', | ||||
|         }) | ||||
|         self.assertEqual(parse_codecs('av01.0.12M.10.0.110.09.16.09.0'), { | ||||
|             'vcodec': 'av01.0.12M.10.0.110.09.16.09.0', | ||||
|             'acodec': 'none', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 rakslice
					rakslice