I have a video and a set of images (each image for one video frame) I want to overlay the images over the video, each image over one single frame. The images and the video have the same size. I know the number of video frames by fetching the metadata first.
Here is the command that I am running.
ffmpeg -y -i "video-file.mp4" -i "%05d.png" -filter_complex "[0:v][1:v]overlay" "output-video-file.mp4"
The issue is that the generated video is longer than the initial video because it hasn't yet overlayed all the images provided. It looks like each image has been overlayed over several frames so by the end of the video, there were still frames left and it overlayed them all over the last frame of the initial video.
What is missing from this command?
-framerate 30
if the rate of video-file.mp4 is 30fps (for example). I think it's not going to work, because the overlay filter implementation is based on timestamps instead of frame numbers (and FFmpeg timestamps synchronization is not accurate enough).