1

I am trying to overlay a png image onto a series of images (a few hundred images), I will later take this series of images with the overlay and construct a movie out of the series of images. I don't know too much about ffmpeg and I have just recently started playing with it for converting and editing media files but I have found something that works for combining the png with one tif image:

ffmpeg -i my.png -i my.tif -filter_complex "[1][0]scale2ref[i][m];[m][i]overlay[v]" -map "[v]" -map 0:a? -ac 2 output.tif

This is what I have so far, which allows me to overlay my png on a single tif image. I would like to do this for every single tif image that I have in my folder (hundreds) of tif images.

Is there a way to instruct ffmpeg to do such a process?

Thanks

4
  • Are all the TIFFs with the same properties, like resolution?
    – Gyan
    Nov 6, 2020 at 12:42
  • @Gyan Yes, the resolution of all of the tif images and the png image is the same. Specifically these images are electron micrographs and I was hoping to overlay a graphic on top of all of the electron micrographs. I was able to generate a macro on ImageJ to overlay the graphic onto all of the tifs. However, I am still curious if there is a way to accomplish this type of "water-marking" with ffmpeg as that may prove to be useful in the future. I suppose that I would need a conditional statement for the tif images, but I am not sure how to implement such a thing in ffmpeg.
    – Timecode
    Nov 7, 2020 at 21:44
  • How are the TIFFs named?
    – Gyan
    Nov 8, 2020 at 3:59
  • @Gyan The tif images are all organized by their capture frame in a numerical sequence. Eg. image0001.tif, image0002.tif, etc.
    – Timecode
    Nov 10, 2020 at 23:31

1 Answer 1

0

If all TIFFs have the same properties, and are named sequentially like image0001.tif, then you can use

ffmpeg -i image%04d.tif -i my.png -filter_complex "[1][0]scale2ref[i][m];[m][i]overlay" out%04d.tif

This will generate images with the overlay named as follows

out0001.tif
out0002.tif
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.