mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-12 22:04:42 +00:00
[pp/FFmpegMetadata] Avoid erroneous ISO 639 conversions (#16046)
Closes #16045 Authored by: bashonly
This commit is contained in:
parent
a6791415e0
commit
e85da3b985
@ -777,7 +777,16 @@ class FFmpegMetadataPP(FFmpegPostProcessor):
|
|||||||
stream_idx = 0
|
stream_idx = 0
|
||||||
for fmt in info.get('requested_formats') or [info]:
|
for fmt in info.get('requested_formats') or [info]:
|
||||||
stream_count = 2 if 'none' not in (fmt.get('vcodec'), fmt.get('acodec')) else 1
|
stream_count = 2 if 'none' not in (fmt.get('vcodec'), fmt.get('acodec')) else 1
|
||||||
lang = ISO639Utils.short2long(fmt.get('language') or '') or fmt.get('language')
|
lang = fmt.get('language') or ''
|
||||||
|
# Avoid using ISO639Utils.short2long if `lang` is likely already a valid long code.
|
||||||
|
# Some languages have only a long code and no short code, but the language map in
|
||||||
|
# ISO639Utils only contains languages with *both* a short and long code.
|
||||||
|
# If the language doesn't have a short code, short2long will give the wrong result.
|
||||||
|
# See https://github.com/yt-dlp/yt-dlp/issues/16045
|
||||||
|
if len(lang) == 3:
|
||||||
|
lang = lang.lower()
|
||||||
|
else:
|
||||||
|
lang = ISO639Utils.short2long(lang.lower()) or lang
|
||||||
for i in range(stream_idx, stream_idx + stream_count):
|
for i in range(stream_idx, stream_idx + stream_count):
|
||||||
if lang:
|
if lang:
|
||||||
metadata[str(i)].setdefault('language', lang)
|
metadata[str(i)].setdefault('language', lang)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user