Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using ffmpeg to replace a single frame based on timestamp

Tags:

ffmpeg

Is it possible to CLI ffmpeg to replace a specific frame at a specified interval with another image? I know how to extract all frames from a video, and re-stitch as another video, but I am looking to avoid this process, if possible.

My goal:

  • Given a video file input.mp4
  • Given a PNG file, image.png and given its known to occur at exactly a specific timestamp within input.mp4
  • create out.mp4 with image.png replacing that position of input.mp4
like image 463
user1361529 Avatar asked Oct 12 '25 22:10

user1361529


1 Answers

The basic command is

ffmpeg -i video -i image \
       -filter_complex \
         "[1]setpts=4.40/TB[im];[0][im]overlay=eof_action=pass" -c:a copy out.mp4

where 4.40 is the timestamp of the frame to be replaced.

like image 107
Gyan Avatar answered Oct 15 '25 12:10

Gyan