Open captain-bugs opened 2 years ago
try this:
buf := bytes.NewBuffer(your []byte input)
err := ffmpeg.Input("pipe:",ffmpeg.KwArgs{}).
Output(outfileName, ffmpeg.KwArgs{}).
OverWriteOutput().
WithInput(buf).Run()
try this:
buf := bytes.NewBuffer(your []byte input) err := ffmpeg.Input("pipe:",ffmpeg.KwArgs{}). Output(outfileName, ffmpeg.KwArgs{}). OverWriteOutput(). WithInput(buf).Run()
This didn't work for me.
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()
func FfmpegTransByte(src []byte) ([]byte, error) {
buf := bytes.NewBuffer(src)
out := &bytes.Buffer{}
err := ffmpeg.Input("pipe:", ffmpeg.KwArgs{}).WithInput(buf).Output("pipe:", ffmpeg.KwArgs{
"acodec": "pcm_s16le",
"f": "wav",
"ac": "1",
"ar": "16000",
}).WithOutput(out).OverWriteOutput().Silent(true).Run()
return out.Bytes(), err
}
This may be ok
I want to read image from s3 and convert it. Is there way to pass
[]byte
toInput
func?