tanersener/ffmpeg-video-slideshow-scripts

Transitions with fewer images

iamsysadmins opened this issue · 5 comments

Hello,
I'm trying to adapt the script to use it with fewer images, after modifying the script, removing the stream that I do not need, I get this error:
Filter split: output1 has a unconnected output

This in my modified script:

ffmpeg -y
-loop 1 -i ../photos/1.jpg
-loop 1 -i ../photos/2.jpg
-filter_complex "
[0:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1920/1280),min(iw,1920),-1)':h='if(gte(iw/ih,1920/1280),-1,min(ih,1280))',scale=trunc(iw/2)*2:trunc(ih/2)*2,setsar=sar=1/1,format=rgba,split=2[stream1out1][stream1out2];
[1:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1920/1280),min(iw,1920),-1)':h='if(gte(iw/ih,1920/1280),-1,min(ih,1280))',scale=trunc(iw/2)*2:trunc(ih/2)2,setsar=sar=1/1,format=rgba,split=2[stream2out1][stream2out2];
[stream1out1]pad=width=1920:height=1280:x=(1920-iw)/2:y=(1280-ih)/2:color=#00000000,trim=duration=3,select=lte(n,90)[stream1overlaid];
[stream1out2]pad=width=1920:height=1280:x=(1920-iw)/2:y=(1280-ih)/2:color=#00000000,trim=duration=1,select=lte(n,30)[stream1ending];
[stream2out1]pad=width=1920:height=1280:x=(1920-iw)/2:y=(1280-ih)/2:color=#00000000,trim=duration=2,select=lte(n,60)[stream2overlaid];
[stream2out2]pad=width=1920:height=1280:x=(1920-iw)/2:y=(1280-ih)/2:color=#00000000,trim=duration=1,select=lte(n,30),split=2[stream2starting][stream2ending];
[stream1ending][stream2starting]overlay=y='-h+t/1
1280':x=0,select=lte(n,30)[stream2blended];
[stream1overlaid][stream2blended][stream2overlaid]concat=n=3:v=1:a=0,format=yuv420p[video]"
-map [video] -vsync 2 -async 1 -rc-lookahead 0 -g 0 -profile:v main -level 42 -c:v libx264 -r 30 ../transition_wipe_in_vertical.mp4

[stream2ending] is not used. This is why it fails. Also fixed two expressions which fail later.
Can you try the following one?

ffmpeg -y \
-loop 1 -i ../photos/1.jpg \
-loop 1 -i ../photos/2.jpg \
-filter_complex "\
[0:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1920/1280),min(iw,1920),-1)':h='if(gte(iw/ih,1920/1280),-1,min(ih,1280))',scale=trunc(iw/2)*2:trunc(ih/2)*2,setsar=sar=1/1,format=rgba,split=2[stream1out1][stream1out2];\
[1:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1920/1280),min(iw,1920),-1)':h='if(gte(iw/ih,1920/1280),-1,min(ih,1280))',scale=trunc(iw/2)*2:trunc(ih/2)*2,setsar=sar=1/1,format=rgba,split=2[stream2out1][stream2out2];\
[stream1out1]pad=width=1920:height=1280:x=(1920-iw)/2:y=(1280-ih)/2:color=#00000000,trim=duration=3,select=lte(n\,90)[stream1overlaid];\
[stream1out2]pad=width=1920:height=1280:x=(1920-iw)/2:y=(1280-ih)/2:color=#00000000,trim=duration=1,select=lte(n\,30)[stream1ending];\
[stream2out1]pad=width=1920:height=1280:x=(1920-iw)/2:y=(1280-ih)/2:color=#00000000,trim=duration=2,select=lte(n\,60)[stream2overlaid];\
[stream2out2]pad=width=1920:height=1280:x=(1920-iw)/2:y=(1280-ih)/2:color=#00000000,trim=duration=1,select=lte(n\,30)[stream2starting];\
[stream1ending][stream2starting]overlay=y='-h+t/1*1280':x=0,select=lte(n\,30)[stream2blended];\
[stream1overlaid][stream2blended][stream2overlaid]concat=n=3:v=1:a=0,format=yuv420p[video]"\
 -map [video] -vsync 2 -async 1 -rc-lookahead 0 -g 0 -profile:v main -level 42 -c:v libx264 -r 30 ../transition_wipe_in_vertical.mp4

Great now work well.
Can you talk me which expresions has been fixed, I need use other scripts.

They are probably just copy/paste errors.

trunc(ih/2)2 updated as trunc(ih/2)*2

y='-h+t/11280' updated as y='-h+t/1*1280'

Thanks for your help, thank you very much

You are welcome