0

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:\Users\xxx\AppData\Local\xxx\xxx\xxx\xxx\xxx\xxx\xxx\963d9d9b8e1\DSC%04d_0013.jpg"

-"C:\Users\xxx\AppData\Local\xxx\xxx\projects\xxx\xxx\xxx\xxx\963d9d9b8e1\DSC%04d_0013.jpg"

-i "C:\Users\xxx\AppData\Local\xxx\xxx\projects\1237\1138\pictures\bundle\963d9d9b8e1\DSC%04d_0013.jpg"

-i "C:\Users\xxx\AppData\Local\xxx\xxx\projects\1237\1138\overlay.png" 
-i "C:\Users\xxx\AppData\Local\xxx\xxx\projects\1237\1138\overlay.png" 
-i "C:\Users\xxx\AppData\Local\xxx\xxx\projects\1237\1138\overlay.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:\Users\xxx\Documents\Projets\2020\xxx\video test ffmpeg\test.mp4"
2
  • 1
    Please specify in details what means your sentence “It is simply not working.”
    – MarianD
    Feb 28, 2020 at 2:21
  • Original question was also answered at the crosspost at Stack Overflow: FFMPEG Video loop from images files, but the quesiton requirements changed after answering.
    – llogan
    Feb 29, 2020 at 0:34

2 Answers 2

1

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"
0

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

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.