Metin Bulak
Metin Bulak

Reputation: 727

How to get image from video and combine other image using ffmpeg

I want to get a frame from video to combine with other image

using two ffmpeg commands as:

command 1:

  ffmpeg -ss 3 -i video.mp4 -vf \"select=gt(scene\,0.4)\" 
 -frames:v 5 -vsync vfr -vf fps=fps=1/100 
 -vf scale=150:150  output.jpeg

command 2:

  ffmpeg -i output.jpeg -i other.png -filter_complex "[0:v][1:v] 
  overlay=(W-w)/2:(H-h)/2:enable='between(t,0,20)'" 
 -pix_fmt yuv420p -c:a copy output2.jpg

how to combine two commands in one, or how to get frame from video and combine other image in one?

Upvotes: 0

Views: 515

Answers (1)

asendjasni
asendjasni

Reputation: 1074

You can combine the two commands using the and && after the first command which allows you to execute the second command based on whether the first command completed successfully:

 ffmpeg -ss 3 -i video.mp4 -vf "select=eq(n\,4)" 
 -frames:v 5 -vsync vfr -vf fps=fps=1/100 
 -vf scale=150:150  output.jpeg 

&& 

ffmpeg -i output.jpeg -i other.png -filter_complex "[0:v][1:v] 
  overlay=(W-w)/2:(H-h)/2:enable='between(t,0,20)'" 
 -pix_fmt yuv420p -c:a copy output2.jpg

Now if you want to combine multiple images onto one, Take a look at this solution

Upvotes: 1

Related Questions