diff --git a/config.json b/config.json index 8be3639..73114a5 100644 --- a/config.json +++ b/config.json @@ -1,42 +1,43 @@ [ { - "Format": "mp4", + "Format": "webm", "Scale": "1920:1080", "Resize": false, "VideoBitrate": 900, "AudioBitrate": 192, - "VideoCodec": "libx264", + "VideoCodec": "libvpx-vp9", "Preset": "veryfast", "CleanFilename": false, "CRF": 30, "FPS": 30, "Tune": "animation", "Input": "LGo*.mp4", - "OutDir": "mp4_test", + "OutDir": "dash_test", "Passes": 1, "Extras": [ - "-movflags", "faststart", - "-tune", "animation" + "-deadline", "realtime", + "-row-mt", "1", + "-cpu-used", "8" ] }, { "Format": "webm", "VideoCodec": "libvpx-vp9", - "Scale": "1920:1080", + "Scale": "1280:720", "Resize": false, - "VideoBitrate": 900, + "VideoBitrate": 600, "AudioBitrate": 192, "CleanFilename": false, "CRF": 30, "FPS": 30, "Tune": "animation", "Input": "LGo*.mp4", - "OutDir": "webm_test", + "OutDir": "dash_test", "Passes": 1, "Extras": [ "-deadline", "realtime", "-row-mt", "1", "-cpu-used", "8" - ] + ] } ] diff --git a/config/settings.go b/config/settings.go index 5cde046..3ae9c6a 100644 --- a/config/settings.go +++ b/config/settings.go @@ -31,6 +31,7 @@ type VideoOpts struct { type Settings struct { Debug int Force bool + Server string ConfigPath string Encodings []VideoOpts } @@ -39,6 +40,7 @@ func ParseFlags(c *Settings) { flag.IntVar(&c.Debug, "debug", 0, "1=print the ffmpeg command, 2=and its stderr output") flag.BoolVar(&c.Force, "force", false, "Force the render even if the file exists.") flag.StringVar(&c.ConfigPath, "config", "config.json", "config.json to load") + flag.StringVar(&c.Server, "server", ":8099", "start a simple HTTP server for testing") flag.Parse() } diff --git a/main.go b/main.go index 5b9c303..32d98b1 100644 --- a/main.go +++ b/main.go @@ -25,14 +25,13 @@ func ModFile(fname string, encoding config.VideoOpts) string { return filepath.Join(dir, renamed) } - func Run(encoding config.VideoOpts, pass int, pid int, input string, output string) { encode := fluentffmpeg.NewCommand("") extras := []string{ "-pix_fmt", "yuv420p", "-pass", fmt.Sprint(pass), - "-passlogfile", fmt.Sprintf("ffmpeg2pass-%x.log", pid), + "-passlogfile", fmt.Sprintf("ffmpegpass-%x.log", pid), } if encoding.Preset != "" { @@ -45,8 +44,6 @@ func Run(encoding config.VideoOpts, pass int, pid int, input string, output stri "-aspect", encoding.Scale) } - extras = append(extras, encoding.Extras...) - if pass != encoding.Passes { extras = append(extras, "-an") } else { @@ -66,6 +63,7 @@ func Run(encoding config.VideoOpts, pass int, pid int, input string, output stri FrameRate(encoding.FPS). ConstantRateFactor(encoding.CRF) + extras = append(extras, encoding.Extras...) encode.OutputOptions(extras...) cmd := encode.InputPath(input).