ffmpeg - Building video with audio in loop I'm building a video from 3 ( or more ) images, with some effects and with an mp3 in background; my issue  is that the mp3 can be shorter than the final video ( whose length dependes from the number of images ) ; is there a way to send audio background in loop, so that when it finish, it restarts and I have no silence during video?

Thanks in advance!

This is the code:

#/bin/bash
ffmpeg -y \
-loop 1 -t 10 -i     img001.jpg  \
-loop 1 -t 10 -i     img002.jpg  \
-loop 1 -t 10 -i     img003.jpg  \
-i 1.mp3  \
-filter_complex \
"\
[0:v]\
format=yuv420p,\
scale=iw*10:ih*10,\
zoompan=z='min(pzoom+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/    zoom/2)':s=640x480,\
drawtext=fontfile='IndieFlower.ttf':enable='between(    t,0,5)':\
text='Caption 1 Scena 1':\
fontsize=60:fontcolor=whit    e:\
x=t*300*lte(t*300\,(w-text_w)/2)+(w-text_w)/2*gt(t*300\,(w-t    ext_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadow    color=black:\
boxborderw=10:box=1:boxcol    or=red@0.8,\
drawtext=fontfile='IndieFlower.ttf':enable='between(    t,5,10)':\
text='Caption 2 Scena 1':\
fontsize=60:fontcolor=whit    e:\
x=(w-(t-5)*500)*gt(w-(t-5)*500\,(w-text_w)/2)+(w-text_w)/2*lte(w-(t-5)*500\,(w-text_w)/2):y=    h-line_h-10:\
shadowx=3:shadowy=3:shadow    color=black:\
boxborderw=10:box=1:boxcol    or=red@0.8,\
fifo\
[final1];\
[1:v]\
format=yuv420p,\
scale=iw*10:ih*10,\
zoompan=z='min(pzoom+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/    zoom/2)':s=640x480,\
fade=t=in:st=0:d=1,\
drawtext=fontfile='IndieFlower.ttf':enable='between(    t,0,5)':\
text='Caption 1 Scena 2':\
fontsize=60:fontcolor=red:    \
x=t*300*lte(t*300\,(w-text_w)/2)+(w-text_w)/2*gt(t*300\,(w-t    ext_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadow    color=white:\
boxborderw=10:box=1:boxcol    or=black@0.8,\
drawtext=fontfile='IndieFlower.ttf':enable='between(    t,5,10)':\
text='Caption 2 Scena 2':\
fontsize=60:fontcolor=red:    \
x=(w-(t-5)*500)*gt(w-(t-5)*500\,(w-text_w)/2)+(w-text_w)/2*lte(w-(t-5)*500\,(w-text_w)/2):y=    h-line_h-10:\
shadowx=3:shadowy=3:shadow    color=white:\
boxborderw=10:box=1:boxcol    or=black@0.8,\
fifo\
[final2];\
[2:v]\
format=yuv420p,\
scale=iw*10:ih*10,\
zoompan=z='min(pzoom+0.0015,1.5)':d=1:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/    zoom/2)':s=640x480,\
fade=t=in:st=0:d=1,\
drawtext=fontfile='IndieFlower.ttf':enable='between(    t,0,5)':\
text='Caption 1 Scena 3':\
fontsize=60:fontcolor=red:    \
x=t*300*lte(t*300\,(w-text_w)/2)+(w-text_w)/2*gt(t*300\,(w-t    ext_w)/2):y=h-line_h-10:\
shadowx=3:shadowy=3:shadow    color=white:\
boxborderw=10:box=1:boxcol    or=black@0.8,\
drawtext=fontfile='IndieFlower.ttf':enable='between(    t,5,10)':\
text='Caption 2 Scena 3':\
fontsize=60:fontcolor=red:    \
x=(w-(t-5)*500)*gt(w-(t-5)*500\,(w-text_w)/2)+(w-text_w)/2*lte(w-(t-5)*500\,(w-text_w)/2):y=    h-line_h-10:\
shadowx=3:shadowy=3:shadow    color=white:\
boxborderw=10:box=1:boxcol    or=black@0.8,\
fifo\
[final3];\
[final1][final2][final3]    concat=n=3:v=1:a=0\
" \
-c:v libx264 \
-r 25 \
-pix_fmt yuv420p \
-t 30 \
o.mp4
Set the audio to loop,

-stream_loop -1 -i 1.mp3  \


If you don't set a duration limit like -t 30 \, add

-fflags +shortest -max_interleave_delta 50000