You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
961 B
44 lines
961 B
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"lcthw.dev/vidcrunch/config"
|
|
"github.com/modfy/fluent-ffmpeg"
|
|
)
|
|
|
|
func Run(pass string) {
|
|
pid := 1
|
|
encode := fluentffmpeg.NewCommand("")
|
|
|
|
mp4_opts := []string{
|
|
"-vf", fmt.Sprintf("scale=%s:flags=lanczos", config.Settings.Scale),
|
|
"-aspect", config.Settings.Scale,
|
|
"-pix_fmt", "yuv420p",
|
|
"-tune", config.Settings.Tune,
|
|
"-movflags", "faststart",
|
|
"-pass", pass,
|
|
"-passlogfile", fmt.Sprintf("ffmpeg2pass-%d.log", pid),
|
|
"-preset", config.Settings.Speed,
|
|
"-filter:v", fmt.Sprintf("fps=%d", config.Settings.FPS),
|
|
"-crf", fmt.Sprint(config.Settings.CRF),
|
|
}
|
|
|
|
encode.Options(mp4_opts...)
|
|
|
|
cmd := encode.InputPath(config.Settings.Input).
|
|
OutputFormat("mp4").
|
|
OutputPath(config.Settings.Output).
|
|
Build()
|
|
|
|
fmt.Println("COMMAND", cmd.String())
|
|
|
|
err := cmd.Run()
|
|
if err != nil { panic("fail") }
|
|
}
|
|
|
|
func main() {
|
|
config.Load()
|
|
fmt.Println(config.Settings)
|
|
|
|
Run("1")
|
|
}
|
|
|