2

I've been trying to figure out the way to merge image inputs over one video. Basically I have few images which I takes as input and then applies some filters and then merge it with video like below (multiple images with zoompan filter)

ffmpeg -i "inputs/image0.png" -i "inputs/image1.png" -i "inputs/image2.png" -i "inputs/image3.png" -i "inputs/background_video.mp4" -filter_complex "[4]split=2[color][alpha];[color]crop=iw/2:ih:0:0[color];[alpha]crop=iw/2:ih:iw/2:0[alpha];[color][alpha]alphamerge[ovrly];[0]scale=540:960,setsar=1[0_scaled];[1]scale=540:960,setsar=1[1_scaled];[2]scale=540:960,setsar=1[2_scaled];[3]scale=540:960,setsar=1[3_scaled];[0_scaled]scale=2700x4800,zoompan=z='min(zoom+0.0010,1.20)':x='iw/2-iw*(1/2-0/100)*on/201-iw/zoom/2':y='ih/2-ih*(1/2-0/100)*on/201-ih/zoom/2':d=25*8.04:s=540x960[v0];[1_scaled]scale=2700x4800,zoompan=z='min(zoom+0.0013,1.20)':x='iw/2-iw*(1/2-100/100)*on/151-iw/zoom/2':y='ih/2-ih*(1/2-0/100)*on/151-ih/zoom/2':d=25*6.04:s=540x960[v1];[2_scaled]scale=2700x4800,zoompan=z='min(zoom+0.0010,1.20)':x='iw/2-iw*(1/2-100/100)*on/201-iw/zoom/2':y='ih/2-ih*(1/2-100/100)*on/201-ih/zoom/2':d=25*8.04:s=540x960[v2];[3_scaled]scale=2700x4800,zoompan=z='min(zoom+0.0010,1.20)':x='iw/2-iw*(1/2-50/100)*on/201-iw/zoom/2':y='ih/2-ih*(1/2-50/100)*on/201-ih/zoom/2':d=25*8.04:s=540x960[v3];[v0][v1][v2][v3]concat=n=4:v=1:a=0,format=yuv420p[concatenated_video];[concatenated_video][ovrly]overlay=0:0" "outputs/zoomInTest.mp4"

I'm tried several similar ideas to get xfade working out but I'm getting issues mentioned below.

ffmpeg -loop 1 -t 8.04 -i "inputs/image0.png" -loop 1 -t 5.60 -i "inputs/image1.png" -loop 1 -t 8.36 -i "inputs/image2.png" -loop 1 -t 8.16 -i "inputs/image3.png" -i "inputs/background_video.mp4" -filter_complex "[4]split=2[color][alpha];[color]crop=iw/2:ih:0:0[color];[alpha]crop=iw/2:ih:iw/2:0[alpha];[color][alpha]alphamerge[ovrly];[0][1]xfade=transition=circleopen:duration=1.00:offset=7.54[v0];[1][2]xfade=transition=diagbl:duration=1.00:offset=13.14[v1];[2][3]xfade=transition=slideright:duration=1.00:offset=21.00[v2];[3]fade=t=in:st=29.0:d=1.0[v3];[v0][v1][v2][v3]concat=n=4:v=1:a=0,format=yuv420p[concatenated_video];[concatenated_video][ovrly]overlay=0:0" "outputs/fadeTestNew.mp4" 

Below picture is reference of my process. enter image description here

What I've tried?

1.Output wasn't being animated at all (solved)

I solved this issue by specifying -loop 1 -t 8.04 -i instead of only -i to all input images.

2.Filter wasn't mapped because was unused etc. (solved)

I solved this issue by removing scale filter which was producing outputs like [0_scaled] which were unused.

3.xfade filter doesn't work properly. (unsolved)

Watch above 2nd ffmpeg command which is the last update on my command. the thing is first two input image is being animated perfectly(like I want first input to be fade out by transition circle open at around 7.54s and it works well too but rest are just messed up and can't describe what happens!

I found out that xfade filter requires 2x input so I could only use transition on first 3 input and for 4th image I used fade filter to fade it out on last second.

[TLDR]: All I want is to use all this 4 image. transition them via xfade filter at different time like first transition at 8sec, 2nd at 14sec and 3rd at 22sec, and map them all on my background video and generate final output video!

Thanks!

[Update 1]: I've managed to merge all transitions but above issue stays same because in new video the transition are being placed on different time(my video is 30sec long but now it's being outputted of 37sec). anyway you can check my new latest command here.

ffmpeg -loop 1 -t 8.54 -i "inputs/image0.png" -loop 1 -t 6.10 -i "inputs/image1.png" -loop 1 -t 8.86 -i "inputs/image2.png" -loop 1 -t 8.66 -i "inputs/image3.png" -i "inputs/background_video.mp4" -filter_complex "[4]split=2[color][alpha];[color]crop=iw/2:ih:0:0[color];[alpha]crop=iw/2:ih:iw/2:0[alpha];[color][alpha]alphamerge[ovrly];[0][1]xfade=transition=circleopen:duration=1.00:offset=7.54[v0];[v0][2]xfade=transition=diagbl:duration=1.00:offset=12.14[v1];[v1][3]xfade=transition=slideright:duration=1.00:offset=20.00[v2];[v2][3]xfade=transition=slideright:duration=1.00:offset=27.00[v3];[v3]concat=n=1:v=1:a=0,format=yuv420p[concatenated_video];[concatenated_video][ovrly]overlay=0:0" "outputs/fadeTestNew2.mp4" 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.