Question

I would like to create an image from a couple of frames in a video, i.e. either create multiple images and blend them or create an image from multiple frames. I have been using FFMPEG to get a single frame image using the code below but cannot find a way to blend a couple of these images and save as a single image or make FFMPEG create the image from multiple frames.

-ss 00:05:40 -i video.AVI -vframes 1 -vf image.jpg'
Was it helpful?

Solution

Consider using ImageMagick - it is free and available here. It has C, C++, Perl and PHP bindings and can be used from the command line.

Depending on how you wish to merge your images, you could use one of these:

convert -evaluate-sequence mean a.jpg b.jpg c.jpg d.jpg

which takes 3 images (a.jpg, b.jpg, c.jpg), which I artificially added noise to, and then averages them to create d.jpg which you can see is less noisy. Or maybe you prefer to take the median of the pixels at each point:

convert -evaluate-sequence median a.jpg b.jpg c.jpg d.jpg

Or you could use:

composite -blend 30 foreground.jpg background.jpg blended.jpg

for a 30% blend.

EDITED

If your fish are dark in the image and you want to remove them, you can just choose the lighter of the two pixels in your images at every point like this:

convert a.jpg b.jpg -compose lighten -composite result.jpg

a.jpg d.jpg

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top