Quick fixes before working on the webserver and DASH support.

master
Zed A. Shaw 1 month ago
parent bb51688a6a
commit ff20dd1137
  1. 19
      config.json
  2. 2
      config/settings.go
  3. 6
      main.go

@ -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"
]
]
}
]

@ -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()
}

@ -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).

Loading…
Cancel
Save