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 first three paths are pointing toward the same image bundle. (A folder containing images like the following DSC0001_0013.jpg,DSC0002_0013.jpg,etc)

Observed symptoms:

The script runs infinitely.I produces a video file of 0 KB.I have to abort script using CTRL+C

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"

-i "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\xxx\xxx\xxx\xxx\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"
Nesan Mano
  • 1,892
  • 2
  • 26
  • 43

2 Answers2

0

Use the -stream_loop option:

ffmpeg -stream_loop 3 -framerate 3/1 -i DSC%04d_0013.jpg -i overlay.png -filter_complex "[0]scale=600:900[bg];[bg][1]overlay=format=auto,format=yuv420p[v]" -map "[v]" -r 10 -c:v libx264 -crf 23 output.mp4
llogan
  • 121,796
  • 28
  • 232
  • 243
  • It loops now. It had to tweak a few things. The problem, is the video's duration is 15 seconds. I would like to limit the video to 9 seconds or less. In other words, it's like a a concatenation of 3 video whose duration is 3 seconds each. – Nesan Mano Feb 27 '20 at 21:23
  • You are right the solution you have provided is valid for the above question. I forgot that there was another constraint which stated that each loop had to have a 3 seconds duration. So basically for a frame rate of 3/1 it resolves to 9 frames for 3 seconds duration. I am pretty sure there is a way to specify this via _stream_loop option. I will post our script below. – Nesan Mano Feb 27 '20 at 21:53
0

@Ilogan, This is our solution.

-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
Nesan Mano
  • 1,892
  • 2
  • 26
  • 43