Closed YamiOdymel closed 1 year ago
Problem solved
split := input.Split()
split1, split2 := split.Get("0"), split.Get("1")
ffmpeg.Filter(
[]*ffmpeg.Stream{
split1,
split2.Filter("palettegen", ffmpeg.Args{}, ffmpeg.KwArgs{
"reserve_transparent": "on",
"transparency_color": "ffffff",
}),
}, "paletteuse", ffmpeg.Args{}).Output(path).OverWriteOutput().ErrorToStdOut().Run()
and it generates something like this
[s2]split=2[s3][s4];[s4]palettegen=reserve_transparent=on:transparency_color=ffffff[s5];[s3][s5]paletteuse[s6]
I'm trying to generate a palette for GIF to keep it's transparency by using
palettegen
andpaletteuse
.ffmpeg-go
automatically generated[s0]
and[s1]
for me.But the command won't run, because
paletteuse
should takes 2 input arguments:[input][palette]
(error:
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_paletteuse_2
)The corrected compiled filter should look like this:
But I can't get it work with
ffmpeg-go
because theinput.Filter
escapes my variable placeholder.My code
It seems that
ffmpeg-python
supports multi-input for a single filter:https://github.com/kkroening/ffmpeg-python/issues/193