|
|
|
|
@ -21,9 +21,14 @@ func ModFile(fname string, encoding config.VideoOpts) string { |
|
|
|
|
base, found := strings.CutSuffix(file, ext) |
|
|
|
|
if !found { panic("no extension found?!") } |
|
|
|
|
|
|
|
|
|
dim := strings.Replace(encoding.Scale, ":", ".", 1) |
|
|
|
|
renamed := fmt.Sprint(base, ".", dim, ".", encoding.Format) |
|
|
|
|
return filepath.Join(dir, renamed) |
|
|
|
|
if encoding.Scale == "" && encoding.VideoCodec == "none" { |
|
|
|
|
renamed := fmt.Sprint(base, ".audio.", encoding.Format) |
|
|
|
|
return filepath.Join(dir, renamed) |
|
|
|
|
} else { |
|
|
|
|
dim := strings.Replace(encoding.Scale, ":", ".", 1) |
|
|
|
|
renamed := fmt.Sprint(base, ".", dim, ".", encoding.Format) |
|
|
|
|
return filepath.Join(dir, renamed) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func Run(encoding config.VideoOpts, pass int, pid int, input string, output string) { |
|
|
|
|
@ -49,8 +54,7 @@ func Run(encoding config.VideoOpts, pass int, pid int, input string, output stri |
|
|
|
|
"-aspect", encoding.Scale) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if pass != encoding.Passes || encoding.Dash { |
|
|
|
|
// BUG: warn that dash removes audio
|
|
|
|
|
if pass != encoding.Passes || encoding.AudioCodec == "none" { |
|
|
|
|
extras = append(extras, "-an") |
|
|
|
|
} else { |
|
|
|
|
encode.AudioCodec(encoding.AudioCodec) |
|
|
|
|
@ -64,11 +68,14 @@ func Run(encoding config.VideoOpts, pass int, pid int, input string, output stri |
|
|
|
|
extras = append(extras, "-t", fmt.Sprint(encoding.Test)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
encode.VideoCodec(encoding.VideoCodec). |
|
|
|
|
VideoBitRate(encoding.VideoBitrate * 1024). |
|
|
|
|
FrameRate(encoding.FPS). |
|
|
|
|
ConstantRateFactor(encoding.CRF) |
|
|
|
|
|
|
|
|
|
if encoding.VideoCodec == "none" { |
|
|
|
|
extras = append(extras, "-vn") |
|
|
|
|
} else { |
|
|
|
|
encode.VideoCodec(encoding.VideoCodec). |
|
|
|
|
VideoBitRate(encoding.VideoBitrate * 1024). |
|
|
|
|
FrameRate(encoding.FPS). |
|
|
|
|
ConstantRateFactor(encoding.CRF) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
extras = append(extras, encoding.Extras...) |
|
|
|
|
|
|
|
|
|
@ -78,7 +85,6 @@ func Run(encoding config.VideoOpts, pass int, pid int, input string, output stri |
|
|
|
|
|
|
|
|
|
encode.OutputOptions(extras...) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd := encode.InputPath(input). |
|
|
|
|
OutputFormat(encoding.Format). |
|
|
|
|
OutputPath(output). |
|
|
|
|
|