1

I am using an ffmpeg complex filter to:

  1. turn a number of images into a slideshow
  2. scale the slideshow to 1/6th of its original size
  3. loop the slideshow infinitely
  4. set the looping slideshow as a picture-in-picture over another looping video

then add audio from another file which determines the maximum length of the final video.

Everything is working except step 3.

Here is my code (broken down into individual lines):

ffmpeg -y 
-loop 1 -t 5.5 -i /uploads/2021/07/slide04-scaled.jpg 
-loop 1 -t 5.5 -i /uploads/2021/07/Slide05-scaled.jpg 
-loop 1 -t 5.5 -i /uploads/2021/07/Slide06-scaled.jpg 
-i /slowwmo-videos/intro.mp4 
-i /uploads/2021/07/busy_bees_01.mp3 
-filter_complex 
"
[1]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+5/TB[a1];
[2]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+10/TB[a2];
[0][a1]overlay[b2];
[b2][a2]overlay[slides];
[slides]loop=loop=-1,scale=iw/6:ih/6,format=yuv420p,fps=fps=25[pip];
[3][pip]overlay=W-w-100:200[v]
" 
-map [v]:v:0 -map 4:a:0 -vcodec libx264 -profile:v main -video_track_timescale 25000 -pix_fmt yuv420p -s 1280x720 -acodec aac -af aresample=44100 -shortest /slowwmo-videos/busy_bees/7494.ts
Dzseti
  • 447
  • 1
  • 7
  • 18

1 Answers1

1
ffmpeg -y
-framerate 25 -loop 1 -t 5.5 -i /uploads/2021/07/slide04-scaled.jpg
-framerate 25 -loop 1 -t 5.5 -i /uploads/2021/07/Slide05-scaled.jpg
-framerate 25 -loop 1 -t 5.5 -i /uploads/2021/07/Slide06-scaled.jpg 
-stream_loop -1 -i /slowwmo-videos/intro.mp4 
-i /uploads/2021/07/busy_bees_01.mp3
-filter_complex
"[0][1]xfade=transition=fade:duration=0.5:offset=5[fade];
 [fade][2]xfade=transition=fade:duration=0.5:offset=9.5,scale=iw/6:-1,loop=loop=-1:size=375[pip];
 [3:v]scale=1280:720[bg];[bg][pip]overlay=W-w-100:200,format=yuv420p[v]"
-map "[v]" -map 4:a -c:v libx264 -c:a aac -shortest output.ts
llogan
  • 121,796
  • 28
  • 232
  • 243
  • Thanks, @llogan. I've been checking out your solution, but have a version of ffmpeg without the xfade filter that I'm now getting sorted – Dzseti Aug 05 '21 at 18:52
  • Latest version of ffmpeg complied for Centos 7 including xfade filter and, @llogan, your code is working. Many thanks – Dzseti Aug 05 '21 at 19:45