mirror of https://git.sr.ht/~cadence/cloudtube
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() {
|
||||
let best = null
|
||||
let aidub = false
|
||||
for (const f of audioFormats.values()) {
|
||||
if (best === null || f.bitrate > best.bitrate) {
|
||||
best = f
|
||||
if (f.resolution.includes("default")) {
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue