0

I have a script that creates a video from multiple sources. At the start of the video there is a 5 second long pause where some information is displayed.

I want to give a visual indicator of how long it is until the main video starts, with a circle in the top left corner. The circle would start completely transparent and slowly fill in grey round the circle as the video progresses. At 25% of the video, the top right quarter of the circle would be gray. At 50% the right half of the circle would be gray and so on.

I am imagining something similar to this solution which is a progress bar, but I'm not sure if it's possible/how to make it a circular one.

halfer
  • 19,824
  • 17
  • 99
  • 186
Ben Holness
  • 2,457
  • 3
  • 28
  • 49

1 Answers1

1

You can use the xfade filter with crop, split, and overlay. In this example video.mp4 is 1280x720 and circle.png is 100x100.

example of circular countdown

ffmpeg -i video.mp4 -t 5 -loop 1 -i circle.png -filter_complex "[0]crop=w=100:h=100:x=1280-100-5:y=5,split=2[bg1][bg2];[bg1][1]overlay=format=auto:eof_action=pass[ovr];[bg2][ovr]xfade=transition=radial:offset=0:duration=5[fg];[0][fg]overlay=W-w-5:5:format=auto:eof_action=pass,format=yuv420p[v]" -map "[v]" -map 0:a? -c:a copy -movflags +faststart output.mp4

Example of circle.png:

enter image description here

llogan
  • 121,796
  • 28
  • 232
  • 243
  • This is super close to what I want - is it possible to get the circle fully filled in? I'm going to try and understand the filter, but you probably know quickly :) Thanks! EDIT: Oh maybe it's just the png? Time to play... – Ben Holness Nov 09 '20 at 02:17
  • UPDATE: I made the png filled in and it was what I wanted, thanks! – Ben Holness Nov 09 '20 at 02:37
  • UPDATE 2: Is there a way to make it start filled in and fade out in a circle? Again I'll try and figure it out, but you probably know. – Ben Holness Nov 09 '20 at 02:40
  • @BenHolness Sorry, but I'm not understanding what you want to do in UPDATE 2. – llogan Nov 09 '20 at 03:08
  • The opposite of my original question - start with the circle fully filled in gray, then at 25% it is 3/4 full (with the top right quarter faded out), at 50% it is 1/2 full (left side is gray, right side is transparent) etc., until after 5 seconds it is completely transparent – Ben Holness Nov 09 '20 at 03:30
  • 1
    @BenHolness Change `[bg2][ovr]xfade` to `[ovr][bg2]xfade`. – llogan Nov 09 '20 at 04:02