From 1b07c4be5403b7157e5c63f0d60b975d858e70b0 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Tue, 11 Nov 2025 23:25:45 -0500 Subject: [PATCH] Add the ability to specify the pass count in the encoding config. --- config.json | 6 ++++-- config/settings.go | 1 + main.go | 12 +++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/config.json b/config.json index f39f0a3..b5ab309 100644 --- a/config.json +++ b/config.json @@ -10,7 +10,8 @@ "FPS": 30, "Tune": "animation", "Input": "test*.mp4", - "OutDir": "renders" + "OutDir": "renders", + "Passes": 3 }, { "Format": "mp4", @@ -23,6 +24,7 @@ "FPS": 30, "Tune": "animation", "Input": "test*.mp4", - "OutDir": "renders" + "OutDir": "renders", + "Passes": 2 } ] diff --git a/config/settings.go b/config/settings.go index b3b604a..d716e00 100644 --- a/config/settings.go +++ b/config/settings.go @@ -20,6 +20,7 @@ type VideoOpts struct { OutDir string Test int TestStart int + Passes int } type Settings struct { diff --git a/main.go b/main.go index 1e8b007..fdf5547 100644 --- a/main.go +++ b/main.go @@ -40,7 +40,7 @@ func Run(encoding config.VideoOpts, pass int, pid int, input string, output stri "-preset", encoding.Speed, } - if pass != 3 { + if pass != encoding.Passes { mp4_encoding = append(mp4_encoding, "-an") } else { encode.AudioCodec("aac") @@ -80,10 +80,12 @@ func DevNull() string { } } -func RenderFile(opts config.VideoOpts, pid int, path string, target string) { - Run(opts, 1, pid, path, DevNull()) - Run(opts, 2, pid, path, DevNull()) - Run(opts, 3, pid, path, target) +func RenderFile(encoding config.VideoOpts, pid int, path string, target string) { + for i := 1; i < encoding.Passes; i++ { + Run(encoding, i, pid, path, DevNull()) + } + + Run(encoding, encoding.Passes, pid, path, target) } func RenderToDir(encoding config.VideoOpts) {