fix first audio in lang

main
Gabe Farrell 9 months ago
parent c2ce2eee11
commit b9a297b69f

@ -6,7 +6,7 @@ const details = () => ({
Type: 'Video', Type: 'Video',
Operation: 'Transcode', Operation: 'Transcode',
Description: Description:
'Re-orders streams to move default audio and subtitle tracks to be first. \\n', 'Re-orders streams to move default audio and subtitle tracks to be first. Multiple default tracks may result in duplicate streams.\\n',
Version: '1.0', Version: '1.0',
Tags: 'pre-processing,ffmpeg', Tags: 'pre-processing,ffmpeg',
Inputs: [], Inputs: [],

@ -60,10 +60,9 @@ const details = () => ({
let foundAudioInLang = false; let foundAudioInLang = false;
let defaults = [] // list of tracks currently set as default let defaults = [] // list of tracks currently set as default
// 1, 2 jpn (default), 3 eng (default) // 0 jpn (default), 1 eng (default)
// [0,1,1] // [true, true]
// firstAudioIdx = 2 // firstAudioInLangIdx = 0
// convert = false
for (let i = 0; i < file.ffProbeData.streams.length; i++) { for (let i = 0; i < file.ffProbeData.streams.length; i++) {
try { try {
@ -71,9 +70,10 @@ const details = () => ({
defaults[audioIdx] = file.ffProbeData.streams[i].disposition.default === 1 defaults[audioIdx] = file.ffProbeData.streams[i].disposition.default === 1
// if we find an audio in the lang // if we find an audio in the lang
if (languages.includes(file.ffProbeData.streams[i].tags.language)) { if (languages.includes(file.ffProbeData.streams[i].tags.language)) {
// mark the id and break // mark the id of the first track in lang
firstAudioInLangIdx = audioIdx; if (firstAudioInLangIdx === -1) {
break; firstAudioInLangIdx = audioIdx;
}
} }
audioIdx += 1; audioIdx += 1;
} }

Loading…
Cancel
Save