Align queued DVD jobs with direct convert settings

This commit is contained in:
Stu Leak 2025-11-30 00:29:05 -05:00
parent c237cb8a8e
commit c85fd8503e

34
main.go
View File

@ -814,9 +814,33 @@ func (s *appState) executeConvertJob(ctx context.Context, job *queue.Job, progre
"-y",
"-hide_banner",
"-loglevel", "error",
"-i", inputPath,
}
// Check if this is a DVD format (special handling required)
selectedFormat, _ := cfg["selectedFormat"].(formatOption)
isDVD := selectedFormat.Ext == ".mpg"
// DVD presets: enforce compliant target, frame rate, resolution, codecs
if isDVD {
if strings.Contains(selectedFormat.Label, "PAL") {
args = append(args, "-target", "pal-dvd")
cfg["frameRate"] = "25"
cfg["targetResolution"] = "PAL (720×576)"
} else {
args = append(args, "-target", "ntsc-dvd")
cfg["frameRate"] = "29.97"
cfg["targetResolution"] = "NTSC (720×480)"
}
cfg["videoCodec"] = "MPEG-2"
cfg["audioCodec"] = "AC-3"
if _, ok := cfg["audioBitrate"].(string); !ok || cfg["audioBitrate"] == "" {
cfg["audioBitrate"] = "192k"
}
cfg["pixelFormat"] = "yuv420p"
}
args = append(args, "-i", inputPath)
// Add cover art if available
coverArtPath, _ := cfg["coverArtPath"].(string)
hasCoverArt := coverArtPath != ""
@ -890,10 +914,6 @@ func (s *appState) executeConvertJob(ctx context.Context, job *queue.Job, progre
args = append(args, "-vf", strings.Join(vf, ","))
}
// Check if this is a DVD format (special handling required)
selectedFormat, _ := cfg["selectedFormat"].(formatOption)
isDVD := selectedFormat.Ext == ".mpg"
// Video codec
videoCodec, _ := cfg["videoCodec"].(string)
if videoCodec == "Copy" && !isDVD {
@ -3354,6 +3374,8 @@ func determineVideoCodec(cfg convertConfig) string {
return "libaom-av1"
case "MPEG-2":
return "mpeg2video"
case "mpeg2video":
return "mpeg2video"
case "Copy":
return "copy"
default:
@ -3372,6 +3394,8 @@ func determineAudioCodec(cfg convertConfig) string {
return "libmp3lame"
case "AC-3":
return "ac3"
case "ac3":
return "ac3"
case "FLAC":
return "flac"
case "Copy":