|
|
|
@ -6,16 +6,39 @@ import ( |
|
|
|
|
"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) |
|
|
|
|
|
|
|
|
|
err := fluentffmpeg.NewCommand(""). |
|
|
|
|
InputPath(config.Settings.Input). |
|
|
|
|
OutputFormat("mp4"). |
|
|
|
|
OutputPath(config.Settings.Output). |
|
|
|
|
Run() |
|
|
|
|
|
|
|
|
|
if err != nil { panic("fail") } |
|
|
|
|
Run("1") |
|
|
|
|
} |
|
|
|
|