fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.85k stars 874 forks source link

Overlay Image with Video #1170

Closed imclean closed 2 years ago

imclean commented 2 years ago

Version information

I am looking to overlay a video onto an image and output the new video in H264, I can do this with ffmpeg in the terminal with:

ffmpeg -loop 1 -i './image.jpg' -vf "movie=video.mp4,scale=1080:1080[inner];[in][inner]overlay=0:0:shortest=1[out]" -vcodec libx264 -y output.mp4

Code to reproduce

I am trying to do the exact same with fluent:

ffmpeg().addInput('./image.jpg').loop().addInput('./video.mp4').videoCodec('libx264').save('/Path/To/File/On/myMac/file.mp4')

Expected results

As per ffmpeg terminal

Observed results

Just the video with no image, no error

Checklist

imclean commented 2 years ago

it's ok, I sorted it.

ffmpeg() .input(./image.jpg) .inputOptions(['-loop 1']) .input(./image.jpg) .videoFilter(movie=Video.mp4,scale=1080:1080[inner];[in][inner]overlay=0:0:shortest=1[out]) .videoCodec('libx264') .noAudio() .save(./output.mp4)

PrincePRS commented 8 months ago

@imclean , I'm going to overlay 4 videos on background image. 4 videos will be shown as a grid(2 X 2). How can I do this using flutent-ffmpeg