0

I've a mp4 video path and set of images(00.png, 01.png... 170.png). These images have alpha (transparent background). I would like to display these images on my video as overlay at specific time (00:05-1:35) at framerate of 15 with a loop. It means that when all the images are displayed once, they will be re-displayed if the time mentioned didn't pass.

For example, assume that I've a set of 3 images(00.png, 01.png, 02.png) with 4 framerate and I want to display them only during 00:00-00:02 so:

the images that will be displayed at 00:00-00:01 will be: 00, 01, 02, 00.

the images that will be displayed at 00:01-00:02 will be: 01, 02, 00, 01.

I've tried to use this but it did nothing (just tried 1 image as a begninng).

final String[] cmd = {"-f","-i",output_mp4,"-framerate", "15", "-loop", "1", "-i",image1,"-filter_complex","overlay=shortest=1", newOutput};

FFmpeg.execute(cmd);

Any way how to get what I want?

There is a 'select' option that maybe can assist:

https://video.stackexchange.com/questions/19873/extract-specific-video-frames

Maor Cohen
  • 936
  • 2
  • 18
  • 33

1 Answers1

2

Offset the image timestamp with setpts then use overlay with enable option.

ffmpeg -i input -framerate 15 -loop 1 -i %d.png -filter_complex "[1]setpts=PTS+5/TB[fg];[0][fg]overlay=enable='between(t,5,95)':shortest=1" output
llogan
  • 121,796
  • 28
  • 232
  • 243