Add the ability to specify the pass count in the encoding config.

master
Zed A. Shaw 1 month ago
parent 6dffeb7e7d
commit 1b07c4be54
  1. 6
      config.json
  2. 1
      config/settings.go
  3. 12
      main.go

@ -10,7 +10,8 @@
"FPS": 30, "FPS": 30,
"Tune": "animation", "Tune": "animation",
"Input": "test*.mp4", "Input": "test*.mp4",
"OutDir": "renders" "OutDir": "renders",
"Passes": 3
}, },
{ {
"Format": "mp4", "Format": "mp4",
@ -23,6 +24,7 @@
"FPS": 30, "FPS": 30,
"Tune": "animation", "Tune": "animation",
"Input": "test*.mp4", "Input": "test*.mp4",
"OutDir": "renders" "OutDir": "renders",
"Passes": 2
} }
] ]

@ -20,6 +20,7 @@ type VideoOpts struct {
OutDir string OutDir string
Test int Test int
TestStart int TestStart int
Passes int
} }
type Settings struct { type Settings struct {

@ -40,7 +40,7 @@ func Run(encoding config.VideoOpts, pass int, pid int, input string, output stri
"-preset", encoding.Speed, "-preset", encoding.Speed,
} }
if pass != 3 { if pass != encoding.Passes {
mp4_encoding = append(mp4_encoding, "-an") mp4_encoding = append(mp4_encoding, "-an")
} else { } else {
encode.AudioCodec("aac") encode.AudioCodec("aac")
@ -80,10 +80,12 @@ func DevNull() string {
} }
} }
func RenderFile(opts config.VideoOpts, pid int, path string, target string) { func RenderFile(encoding config.VideoOpts, pid int, path string, target string) {
Run(opts, 1, pid, path, DevNull()) for i := 1; i < encoding.Passes; i++ {
Run(opts, 2, pid, path, DevNull()) Run(encoding, i, pid, path, DevNull())
Run(opts, 3, pid, path, target) }
Run(encoding, encoding.Passes, pid, path, target)
} }
func RenderToDir(encoding config.VideoOpts) { func RenderToDir(encoding config.VideoOpts) {

Loading…
Cancel
Save