1

I cannot figure out how to add video over video circular at specific time

The following command

ffmpeg -y -i blank.mp4 -i yellow.mp4 -filter_complex "[1:v]scale=0.15*iw:-1,pad=iw+20:ih+20:10:10:color=red,setpts=PTS-STARTPTS+2/TB[v1];[0:0][v1]overlay=W-w-20:H-h-20:eof_action=pass:enable='between(t\,2,4)'[vo1]; [0:a]adelay=0|0[a0]; [1:a]adelay=2000|2000[a1];[a0][a1]amix=inputs=2[outa]" -map "[vo1]" -map "[outa]" -c:a aac -c:v libx264 -preset slow output.mp4

Return

enter image description here

That's great, but I need it circular like this

enter image description here

I'm trying with

ffmpeg -y -i blank.mp4 -i yellow.mp4 -filter_complex "[1:v]geq='st(3,pow(X-(W/2),2)+pow(Y-(H/2),2));if(lte(ld(3),pow(min(W/2,H/2),2)),255,0)':128:128,scale=0.15*iw:-1,pad=iw+20:ih+20:10:10:color=red,setpts=PTS-STARTPTS+2/TB[v1];[0:0][v1]overlay=W-w-20:H-h-20:eof_action=pass:enable='between(t\,2,4)'[vo1]; [0:a]adelay=0|0[a0]; [1:a]adelay=2000|2000[a1];[a0][a1]amix=inputs=2[outa]" -map "[vo1]" -map "[outa]" -c:a aac -c:v libx264 -preset slow output.mp4

The result is not what I expect.

To fast generate blank.mp4 and yellow.mp4 use

ffmpeg -y -f lavfi -i "color=black:s=1280x720:r=25" -f lavfi -i "anullsrc=r=44100:cl=stereo" -c:a aac -c:v libx264 -preset slow -t 5 blank.mp4
ffmpeg -y -f lavfi -i "color=yellow:s=1280x720:r=25" -f lavfi -i "anullsrc=r=44100:cl=stereo" -c:a aac -c:v libx264 -preset slow -t 2 yellow.mp4
1

Here's the filtergraph for the video portion,

[1:v]format=yuva444p,geq=lum='p(X,Y)':a='st(1,pow(min(W/2,H/2),2))+st(3,pow(X-(W/2),2)+pow(Y-(H/2),2));if(lte(ld(3),ld(1)),255,0)',split[vid][border];[border]drawbox=c=red:t=fill,geq=lum='p(X,Y)':a='st(1,min(W/2,H/2))+st(3,abs(pow(pow(X-(W/2),2)+pow(Y-(H/2),2),0.5)));if(between(ld(3),ld(1),ld(1)-10),255,0)'[border];[vid][border]overlay,scale=0.15*iw:-1,setpts=PTS-STARTPTS+2/TB[v1];[0:0][v1]overlay=W-w-20:H-h-20:eof_action=pass:enable='between(t\,2,4)'[vo1];
  • The result is almost perfect, unfortunately there are yellow noise lines in the box and there is no red border over the circle i.imgur.com/Mem2wKf.jpg – Sauron Oct 23 '18 at 10:52
  • 1
    The geq filter recently became multithreaded. This appears to be a bug related to that. Add -filter_complex_threads 1 for expected result. File a bug report at trac.ffmpeg.org. – Gyan Oct 23 '18 at 11:44

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.