I'm trying to add watermark to images and videos using ffmpeg. My files are stored on AWS S3, so they are byte arrays ([]byte).
I need my input and output to be in a byte array and not saved to disk.
I tried something like the code and it didn't work:
buffFile := bytes.NewBuffer(file)
out := &bytes.Buffer{}
overlay := ffmpeg.Input("pipe:", ffmpeg.KwArgs{}).Filter("scale", ffmpeg.Args{"64:-1"}).WithInput(buffWatermark)
err = ffmpeg.Filter(
[]*ffmpeg.Stream{
ffmpeg.Input("pipe:", ffmpeg.KwArgs{}).WithInput(buffFile),
overlay,
}, "overlay", ffmpeg.Args{"10:10"}, ffmpeg.KwArgs{"enable": "gte(t,1)"}).
Output("pipe:", ffmpeg.KwArgs{}).WithOutput(out).OverWriteOutput().ErrorToStdOut().Run()