Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ffmpeg

I have an image. I have a transparent 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?

like image 498
Tim Scollick Avatar asked Sep 07 '11 20:09

Tim Scollick


People also ask

Can Ffmpeg work with images?

FFmpeg looks for image files with file names with 'img-' resulting in a two-digit number. In the command section, you will need to define a search pattern for the ffmpeg output file so that you can find the image sequence.

What is overlay Ffmpeg?

FFmpeg offers the overlay filter as a way to overlay images (or even other videos) onto video streams. To centre overlay/watermark on a video, use this command: ffmpeg -i inputvideo.avi -i watermarklogo.png -filter_complex \ "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -codec:a copy output.flv.


1 Answers

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.

like image 89
Chris Haas Avatar answered Sep 28 '22 15:09

Chris Haas