mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-12-21 20:56:58 +00:00
If multiple languages found, look for default
Fix for Google rolling out AI dubbed translations and cloudtube picking the first audio stream, not the default. Chooses the best audio format by filtering for default. If none of the audio streams are marked as default, then use old codepath. Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
This commit is contained in:
parent
4823f8ec73
commit
be33a66e8c
@ -19,9 +19,17 @@ for (const f of [].concat(
|
|||||||
|
|
||||||
function getBestAudioFormat() {
|
function getBestAudioFormat() {
|
||||||
let best = null
|
let best = null
|
||||||
|
let aidub = false
|
||||||
for (const f of audioFormats.values()) {
|
for (const f of audioFormats.values()) {
|
||||||
if (best === null || f.bitrate > best.bitrate) {
|
if (f.resolution.includes("default")) {
|
||||||
best = f
|
aidub = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const f of audioFormats.values()) {
|
||||||
|
if (!aidub || f.resolution.includes("default")) {
|
||||||
|
if (best === null || f.bitrate > best.bitrate) {
|
||||||
|
best = f
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return best
|
return best
|
||||||
|
Loading…
Reference in New Issue
Block a user