开发者

How do I make a video with a static image background in FFMPEG?

开发者 https://www.devze.com 2023-04-03 14:22 出处:网络
I have an image. I have a transpare开发者_开发百科nt FLV. I want to use the image as a background to the transparent FLV and have it outputted as FLV.

I have an image. I have a transpare开发者_开发百科nt FLV. I want to use the image as a background to the transparent FLV and have it outputted as FLV.

This command works but the video is one frame long:

ffmpeg -i background.png -f flv -vcodec flv -b 1500k -vf "movie=test_videos/alpha.flv [logo]; [in][logo] overlay=0:0 [out]" -s 800x464 -y output.flv

I have tried to use the -t and -vframes parameters to no avail.

Does anyone have any tips?


I apologize for my initial comment, my searching produced very little results initially.

Now looking at the documentation I see in fact that you should be able to do that. I don't have time to test this but I would try making two passes. The first pass should turn your PNG into a movie with a transparent background that's the same duration as your other movie. Something like:

ffmpeg -loop_input -f image2 -i background.png -r 25 -vframes 250 -an -vcodec png test.mov

I chose PNG for the video codec because according to this post it supports transparency in MOV containers.

Then you should hopefully just be able to pipe that movie into your original command where you had your image.


The complete solution that got me what I wanted was this command:

ffmpeg -loop_input -f image2 -i background.png -r 25 -vframes 2500 -an -vcodec libx264 -b 1500k -vf "movie=test_videos/alpha.flv [logo]; [in][logo] overlay=0:0 [out]" -s 800x464 -y output.mov
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号