Can now avoid lancozs (or whatever) when the source is the same size as the target.

master
Zed A. Shaw 10 months ago
parent 2c90827345
commit efa0daf3ee
  1. 42
      config.json
  2. 1
      config/settings.go
  3. 5
      main.go

@ -1,6 +1,8 @@
[ [
{ {
"Format": "mp4", "Format": "mp4",
"Scale": "1280:720",
"Resize": true,
"VideoBitrate": 900, "VideoBitrate": 900,
"AudioBitrate": 192, "AudioBitrate": 192,
"Speed": "veryfast", "Speed": "veryfast",
@ -19,6 +21,46 @@
{ {
"Format": "webm", "Format": "webm",
"VideoBitrate": 600, "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", "VideoCodec": "libvpx-vp9",
"AudioBitrate": 192, "AudioBitrate": 192,
"AudioCodec": "libopus", "AudioCodec": "libopus",

@ -10,6 +10,7 @@ import (
type VideoOpts struct { type VideoOpts struct {
Format string Format string
Scale string Scale string
Resize bool
VideoBitrate int VideoBitrate int
VideoCodec string VideoCodec string
AudioBitrate int AudioBitrate int

@ -36,9 +36,10 @@ func Run(encoding config.VideoOpts, pass int, pid int, input string, output stri
"-preset", encoding.Speed, "-preset", encoding.Speed,
} }
if encoding.Scale != "" { if encoding.Resize {
extras = append(extras,
"-vf", fmt.Sprintf("scale=%s:flags=lanczos", encoding.Scale), "-vf", fmt.Sprintf("scale=%s:flags=lanczos", encoding.Scale),
"-aspect", encoding.Scale, "-aspect", encoding.Scale)
} }
extras = append(extras, encoding.Extras...) extras = append(extras, encoding.Extras...)

Loading…
Cancel
Save