<p>Here's the filtergraph for the video portion,</p>

<pre><code>[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];
</code></pre>

CC BY-SA 4.0
2018-10-23T10:52:37.720Z
The result is almost perfect, unfortunately there are yellow noise lines in the box and there is no red border over the circle https://i.imgur.com/Mem2wKf.jpg
Sauron
CC BY-SA 4.0
2018-10-23T11:44:39.047Z
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
CC BY-SA 4.0
2018-10-23T10:27:37.713Z
2018-10-23T10:27:37.713Z
Gyan
<p>I cannot figure out how to add video over video circular at specific time</p>

<p>The following command</p>

<pre><code>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
</code></pre>

<p>Return</p>

<p><a href="https://i.sstatic.net/o08sj.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/o08sj.jpg" alt="enter image description here"></a></p>

<p>That's great, but I need it circular like this</p>

<p><a href="https://i.sstatic.net/7Izaa.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7Izaa.jpg" alt="enter image description here"></a></p>

<p>I'm trying with</p>

<pre><code>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
</code></pre>

<p>The result is not what I expect.</p>

<p>To fast generate blank.mp4 and yellow.mp4 use</p>

<pre><code>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
</code></pre>

<ffmpeg>
FFmpeg video over video circular at specific time
Sauron
# FFmpeg video over video circular at specific time

(Asked by: username_0 on 2018-10-23)

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

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

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

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2018-10-23. Score: 1 | Accepted answer

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];

> **Comments:**
> **username_0**: The result is almost perfect, unfortunately there are yellow noise lines in the box and there is no red border over the circle https://i.imgur.com/Mem2wKf.jpg  
> **username_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.  

---

