TransWikia.com

FFMPEG Video loop from images files

Video Production Asked by Nesan Mano on July 29, 2020

I am trying to make a video from a bundle of image files and then apply a an overlay on top of it.Another requirement is to make the video loop 3x. It is simply not working.
The requirement is to produce a video of 3 seconds looped 3x. The below script does npt allow to do it.

This is my script.

ffmpeg 
-start_number 1 -framerate 3/1 
-i "C:UsersxxxAppDataLocalxxxxxxxxxxxxxxxxxxxxx963d9d9b8e1DSC%04d_0013.jpg"

-"C:UsersxxxAppDataLocalxxxxxxprojectsxxxxxxxxxxxx963d9d9b8e1DSC%04d_0013.jpg"

-i "C:UsersxxxAppDataLocalxxxxxxprojects12371138picturesbundle963d9d9b8e1DSC%04d_0013.jpg"

-i "C:UsersxxxAppDataLocalxxxxxxprojects12371138overlay.png" 
-i "C:UsersxxxAppDataLocalxxxxxxprojects12371138overlay.png" 
-i "C:UsersxxxAppDataLocalxxxxxxprojects12371138overlay.png" 
-filter_complex " [0:v]scale=600x900[scaled1]; [1:v]scale=600x900[scaled2]; [2:v]scale=600x900[scaled3]; [scaled1][3:v]overlay[tmp1]; [scaled2][4:v]overlay[tmp2]; [scaled3][5:v]overlay[tmp3]; [tmp1][tmp2][tmp3]concat=n=3[scaled] "
-map [scaled] -r 10 -vcodec libx264  -pix_fmt yuv420p -crf 23  "C:UsersxxxDocumentsProjets2020xxxvideo test ffmpegtest.mp4"

2 Answers

The "solution" that you gave to your own question confuses me because it seems to be somewhat unrelated to your initial question.

What I understood from your question:

  1. You have a Sequence of Images in 3 directories.
  2. Make a movie from each Image Sequence.
  3. Length is 1s each.
  4. Overlay an image for each 1s movie.
  5. concatenate the movies -> 3s movie
  6. Loop 3 times -> 9s movie

I've added the fllowing to your code in your question:

  1. Add -start_number 1 before every input
  2. Add loop=loop=2:size=30 after concat

Notice loop=2 loops 3 times.

Furthermore it needs a size (the total number of frames to loop over).

This depends on how many images you had.

I had 10 images in the 3 directories. 10 x 3 = 30

ffmpeg 
-start_number 1 -framerate 12 
-i "imgSequ1/img-%d.png" 
-start_number 1 -framerate 12 
-i "imgSequ2/img-%d.png" 
-start_number 1 -framerate 12 
-i "imgSequ3/img-%d.png" 
-i "overlay1.png" 
-i "overlay2.png" 
-i "overlay3.png" 
-filter_complex "
[0:v]scale=600x900[scaled1];
[1:v]scale=600x900[scaled2];
[2:v]scale=600x900[scaled3];
[scaled1][3:v]overlay[tmp1];
[scaled2][4:v]overlay[tmp2];
[scaled3][5:v]overlay[tmp3];
[tmp1][tmp2][tmp3]concat=n=3,loop=loop=2:size=30[scaled]" 
-map "[scaled]" -r 10 -vcodec libx264 -pix_fmt yuv420p -crf 23 "result.mp4"

Answered by drake7 on July 29, 2020

This is the solution and it works.

-start_number 1 -framerate 3/1 -i DSC%04d_0013.jpg -loop 1 -i overlay.png" -filter_complex " [0:v]scale=600x900[scaled]; [scaled][1:v]overlay,trim=duration=3,loop=loop=2:size=9[tmp] " -map [tmp] -r 10 -vcodec libx264 -pix_fmt yuv420p -crf 23 test.mp4

Answered by Nesan Mano on July 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP