fix Make Default Tracks First to account for no defaults

main
Gabe Farrell 9 months ago
parent 631a4525ea
commit 5d6bb9ec04

@ -29,6 +29,7 @@ Sets the first audio stream as default. Removes all other default audio tracks'
Moves the default audio and default subtitle tracks to the first index, if they aren't there already.
# Todo
- [ ] Fix bug that causes Make Default Tracks First to delete single, non-default tracks
- [ ] Make Anime Subtitle Fixer have an option to exclude titles when counting (this is hardcoded right now)
- [ ] Investigate using mkvmerge instead of ffmpeg in Set Subtitle Dispositions By Title to stop increase in file size (https://www.reddit.com/r/ffmpeg/comments/wsogpl/removing_subtitle_track_results_in_a_bigger_file/)
- [x] Plugin to strip PGA subs if ASS exists

@ -48,6 +48,8 @@ const details = () => ({
let convert = false;
let processAudio = false;
let processSubtitles = false;
let hasDefaultSubTrack = false;
let hasDefaultAudioTrack = false;
// [false, true, true]
@ -55,6 +57,7 @@ const details = () => ({
try {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() === 'audio') {
if (file.ffProbeData.streams[i].disposition.default === 1) {
hasDefaultAudioTrack = true;
if (audioIdx === 0) {
response.infoLog += "☒Default audio stream is already first \n"
audioFfmpegInsert += "-map 0:a "
@ -69,6 +72,7 @@ const details = () => ({
audioIdx += 1;
} else if (file.ffProbeData.streams[i].codec_type.toLowerCase() === 'subtitle') {
if (file.ffProbeData.streams[i].disposition.default === 1) {
hasDefaultSubTrack = true;
if (subtitleIdx === 0) {
response.infoLog += "☒Default subtitle stream is already first \n"
subtitleFfmpegInsert += "-map 0:s "
@ -86,6 +90,15 @@ const details = () => ({
// Error
}
}
// if there are no default sub tracks, just copy them all
if (!hasDefaultSubTrack) {
subtitleFfmpegInsert += "-map 0:s? "
}
// if there are no default audio tracks, just copy them all
if (!hasDefaultAudioTrack) {
audioFfmpegInsert += "-map 0:a? "
}
if (convert) {
if (processAudio) {

Loading…
Cancel
Save