Skip filters during remux
This commit is contained in:
parent
47975ac0f5
commit
d630cea8d6
155
main.go
155
main.go
|
|
@ -3747,92 +3747,97 @@ func (s *appState) executeConvertJob(ctx context.Context, job *queue.Job, progre
|
||||||
}
|
}
|
||||||
|
|
||||||
// Video filters
|
// Video filters
|
||||||
|
remux := strings.EqualFold(selectedFormat.VideoCodec, "copy")
|
||||||
|
if vc, ok := cfg["videoCodec"].(string); ok && strings.EqualFold(vc, "Copy") {
|
||||||
|
remux = true
|
||||||
|
}
|
||||||
var vf []string
|
var vf []string
|
||||||
|
if !remux {
|
||||||
|
// Deinterlacing
|
||||||
|
shouldDeinterlace := false
|
||||||
|
deinterlaceMode, _ := cfg["deinterlace"].(string)
|
||||||
|
fieldOrder, _ := cfg["fieldOrder"].(string)
|
||||||
|
|
||||||
// Deinterlacing
|
if deinterlaceMode == "Force" {
|
||||||
shouldDeinterlace := false
|
shouldDeinterlace = true
|
||||||
deinterlaceMode, _ := cfg["deinterlace"].(string)
|
} else if deinterlaceMode == "Auto" || deinterlaceMode == "" {
|
||||||
fieldOrder, _ := cfg["fieldOrder"].(string)
|
// Auto-detect based on field order
|
||||||
|
if fieldOrder != "" && fieldOrder != "progressive" && fieldOrder != "unknown" {
|
||||||
|
shouldDeinterlace = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if deinterlaceMode == "Force" {
|
// Legacy support
|
||||||
shouldDeinterlace = true
|
if inverseTelecine, _ := cfg["inverseTelecine"].(bool); inverseTelecine {
|
||||||
} else if deinterlaceMode == "Auto" || deinterlaceMode == "" {
|
|
||||||
// Auto-detect based on field order
|
|
||||||
if fieldOrder != "" && fieldOrder != "progressive" && fieldOrder != "unknown" {
|
|
||||||
shouldDeinterlace = true
|
shouldDeinterlace = true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy support
|
if shouldDeinterlace {
|
||||||
if inverseTelecine, _ := cfg["inverseTelecine"].(bool); inverseTelecine {
|
// Choose deinterlacing method
|
||||||
shouldDeinterlace = true
|
deintMethod, _ := cfg["deinterlaceMethod"].(string)
|
||||||
}
|
if deintMethod == "" {
|
||||||
|
deintMethod = "bwdif" // Default to bwdif (higher quality)
|
||||||
if shouldDeinterlace {
|
|
||||||
// Choose deinterlacing method
|
|
||||||
deintMethod, _ := cfg["deinterlaceMethod"].(string)
|
|
||||||
if deintMethod == "" {
|
|
||||||
deintMethod = "bwdif" // Default to bwdif (higher quality)
|
|
||||||
}
|
|
||||||
|
|
||||||
if deintMethod == "bwdif" {
|
|
||||||
vf = append(vf, "bwdif=mode=send_frame:parity=auto")
|
|
||||||
} else {
|
|
||||||
vf = append(vf, "yadif=0:-1:0")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Auto-crop black bars (apply before scaling for best results)
|
|
||||||
if autoCrop, _ := cfg["autoCrop"].(bool); autoCrop {
|
|
||||||
cropWidth, _ := cfg["cropWidth"].(string)
|
|
||||||
cropHeight, _ := cfg["cropHeight"].(string)
|
|
||||||
cropX, _ := cfg["cropX"].(string)
|
|
||||||
cropY, _ := cfg["cropY"].(string)
|
|
||||||
|
|
||||||
if cropWidth != "" && cropHeight != "" {
|
|
||||||
cropW := strings.TrimSpace(cropWidth)
|
|
||||||
cropH := strings.TrimSpace(cropHeight)
|
|
||||||
cropXStr := strings.TrimSpace(cropX)
|
|
||||||
cropYStr := strings.TrimSpace(cropY)
|
|
||||||
|
|
||||||
// Default to center crop if X/Y not specified
|
|
||||||
if cropXStr == "" {
|
|
||||||
cropXStr = "(in_w-out_w)/2"
|
|
||||||
}
|
|
||||||
if cropYStr == "" {
|
|
||||||
cropYStr = "(in_h-out_h)/2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cropFilter := fmt.Sprintf("crop=%s:%s:%s:%s", cropW, cropH, cropXStr, cropYStr)
|
if deintMethod == "bwdif" {
|
||||||
vf = append(vf, cropFilter)
|
vf = append(vf, "bwdif=mode=send_frame:parity=auto")
|
||||||
logging.Debug(logging.CatFFMPEG, "applying crop in queue job: %s", cropFilter)
|
} else {
|
||||||
|
vf = append(vf, "yadif=0:-1:0")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Scaling/Resolution
|
// Auto-crop black bars (apply before scaling for best results)
|
||||||
targetResolution, _ := cfg["targetResolution"].(string)
|
if autoCrop, _ := cfg["autoCrop"].(bool); autoCrop {
|
||||||
if targetResolution != "" && targetResolution != "Source" {
|
cropWidth, _ := cfg["cropWidth"].(string)
|
||||||
var scaleFilter string
|
cropHeight, _ := cfg["cropHeight"].(string)
|
||||||
switch targetResolution {
|
cropX, _ := cfg["cropX"].(string)
|
||||||
case "360p":
|
cropY, _ := cfg["cropY"].(string)
|
||||||
scaleFilter = "scale=-2:360"
|
|
||||||
case "480p":
|
if cropWidth != "" && cropHeight != "" {
|
||||||
scaleFilter = "scale=-2:480"
|
cropW := strings.TrimSpace(cropWidth)
|
||||||
case "540p":
|
cropH := strings.TrimSpace(cropHeight)
|
||||||
scaleFilter = "scale=-2:540"
|
cropXStr := strings.TrimSpace(cropX)
|
||||||
case "720p":
|
cropYStr := strings.TrimSpace(cropY)
|
||||||
scaleFilter = "scale=-2:720"
|
|
||||||
case "1080p":
|
// Default to center crop if X/Y not specified
|
||||||
scaleFilter = "scale=-2:1080"
|
if cropXStr == "" {
|
||||||
case "1440p":
|
cropXStr = "(in_w-out_w)/2"
|
||||||
scaleFilter = "scale=-2:1440"
|
}
|
||||||
case "4K":
|
if cropYStr == "" {
|
||||||
scaleFilter = "scale=-2:2160"
|
cropYStr = "(in_h-out_h)/2"
|
||||||
case "8K":
|
}
|
||||||
scaleFilter = "scale=-2:4320"
|
|
||||||
|
cropFilter := fmt.Sprintf("crop=%s:%s:%s:%s", cropW, cropH, cropXStr, cropYStr)
|
||||||
|
vf = append(vf, cropFilter)
|
||||||
|
logging.Debug(logging.CatFFMPEG, "applying crop in queue job: %s", cropFilter)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if scaleFilter != "" {
|
|
||||||
vf = append(vf, scaleFilter)
|
// Scaling/Resolution
|
||||||
|
targetResolution, _ := cfg["targetResolution"].(string)
|
||||||
|
if targetResolution != "" && targetResolution != "Source" {
|
||||||
|
var scaleFilter string
|
||||||
|
switch targetResolution {
|
||||||
|
case "360p":
|
||||||
|
scaleFilter = "scale=-2:360"
|
||||||
|
case "480p":
|
||||||
|
scaleFilter = "scale=-2:480"
|
||||||
|
case "540p":
|
||||||
|
scaleFilter = "scale=-2:540"
|
||||||
|
case "720p":
|
||||||
|
scaleFilter = "scale=-2:720"
|
||||||
|
case "1080p":
|
||||||
|
scaleFilter = "scale=-2:1080"
|
||||||
|
case "1440p":
|
||||||
|
scaleFilter = "scale=-2:1440"
|
||||||
|
case "4K":
|
||||||
|
scaleFilter = "scale=-2:2160"
|
||||||
|
case "8K":
|
||||||
|
scaleFilter = "scale=-2:4320"
|
||||||
|
}
|
||||||
|
if scaleFilter != "" {
|
||||||
|
vf = append(vf, scaleFilter)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user