From efa0daf3eef7cc668d8b0b9bccbef572fe3b457f Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Wed, 12 Nov 2025 02:09:15 -0500 Subject: [PATCH] Can now avoid lancozs (or whatever) when the source is the same size as the target. --- config.json | 42 ++++++++++++++++++++++++++++++++++++++++++ config/settings.go | 1 + main.go | 5 +++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 1b8ed73..51be934 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,8 @@ [ { "Format": "mp4", + "Scale": "1280:720", + "Resize": true, "VideoBitrate": 900, "AudioBitrate": 192, "Speed": "veryfast", @@ -19,6 +21,46 @@ { "Format": "webm", "VideoBitrate": 600, + "Scale": "1280:720", + "Resize": true, + "VideoCodec": "libvpx-vp9", + "AudioBitrate": 192, + "AudioCodec": "libopus", + "Speed": "veryfast", + "CleanFilename": false, + "CRF": 20, + "FPS": 30, + "Tune": "animation", + "Input": "*.mp4", + "OutDir": "renders", + "Passes": 2, + "Extras": [ + ] + }, + { + "Format": "mp4", + "Scale": "1920:1080", + "Resize": false, + "VideoBitrate": 900, + "AudioBitrate": 192, + "Speed": "veryfast", + "CleanFilename": false, + "CRF": 20, + "FPS": 30, + "Tune": "animation", + "Input": "*.mp4", + "OutDir": "renders", + "Passes": 3, + "Extras": [ + "-movflags", "faststart", + "-tune", "animation" + ] + }, + { + "Format": "webm", + "Scale": "1920:1080", + "Resize": false, + "VideoBitrate": 600, "VideoCodec": "libvpx-vp9", "AudioBitrate": 192, "AudioCodec": "libopus", diff --git a/config/settings.go b/config/settings.go index a0e0af9..38f6eba 100644 --- a/config/settings.go +++ b/config/settings.go @@ -10,6 +10,7 @@ import ( type VideoOpts struct { Format string Scale string + Resize bool VideoBitrate int VideoCodec string AudioBitrate int diff --git a/main.go b/main.go index 021a860..80c01c3 100644 --- a/main.go +++ b/main.go @@ -36,9 +36,10 @@ func Run(encoding config.VideoOpts, pass int, pid int, input string, output stri "-preset", encoding.Speed, } - if encoding.Scale != "" { + if encoding.Resize { + extras = append(extras, "-vf", fmt.Sprintf("scale=%s:flags=lanczos", encoding.Scale), - "-aspect", encoding.Scale, + "-aspect", encoding.Scale) } extras = append(extras, encoding.Extras...)