Answers.Body: <p>I eventually found an answer to my question: <strong>FFmpeg <a href="https://ffmpeg.org/ffmpeg-filters.html#delogo" rel="nofollow noreferrer">delogo filter</a></strong></p>
  <p><code>delogo</code> options I used for the videos in the question is: (for testing you can set <code>show=1</code>)</p>
  <p><code>delogo=x=85:y=47:w=300:h=40:show=0</code></p>
  <p>Sample <code>ffmpeg</code>/<code>ffplay</code> <code>-vf</code> options for encoding, <code>delogo</code> + <code>drawtext</code> filters:</p>
  <pre><code>-vf &quot;delogo=x=85:y=47:w=300:h=40:show=0,drawtext=text='SampleText':fontfile=&quot;${FONTFILE}&quot;:fontcolor=white:fontsize=34:x=93:y=54:alpha=0.9&quot;
  </code></pre>
  <p><code>delogo</code> is pretty neat, I wonder how they did this. Quite fast too.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-26T01:18:41.007Z
Answers.LastActivityDate: 2023-10-26T01:26:44.143Z
Answers.LastEditDate: 2023-10-26T01:26:44.143Z
Answers.UserDisplayName: Majal
Body: <p>As shown in these <a href="https://cdn.vox-cdn.com/uploads/chorus_asset/file/22291118/ASL_Bible__1_.jpg" rel="nofollow noreferrer">video screen captures</a>, I would like to <strong>replace</strong> the text in the upper left of the videos to another language.</p>
  <p>What I am thinking is first to create a <strong>gradient box</strong> with colors that are <strong>automatically sampled</strong> along the edges of the box. Then it would be easy to <a href="https://ffmpeg.org/ffmpeg-filters.html#drawtext-1" rel="nofollow noreferrer"><code>drawtext</code></a> the replacement text. For each <a href="https://www.jw.org/finder?wtlocale=ASL&amp;pub=nwt" rel="nofollow noreferrer">video file</a>, the background gradient doesn't change, so it can be sampled only once for each file.</p>
  <p>Is this possible in FFmpeg? Other ideas on how to achieve the text replacement is also welcome.</p>
  <p><a href="https://i.sstatic.net/wLVla.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wLVla.jpg" alt="enter image description here" /></a></p>
  
Tags: <ffmpeg>
Title: Can FFmpeg create a gradient box with colors sampled from the box edges?
UserDisplayName: Majal
ThreadText: # Can FFmpeg create a gradient box with colors sampled from the box edges?
  
  (Asked by: username_0 on 2023-10-24)
  
  As shown in these [video screen captures](https://cdn.vox-cdn.com/uploads/chorus_asset/file/22291118/ASL_Bible__1_.jpg), I would like to **replace** the text in the upper left of the videos to another language.
  
  What I am thinking is first to create a **gradient box** with colors that are **automatically sampled** along the edges of the box. Then it would be easy to [`drawtext`](https://ffmpeg.org/ffmpeg-filters.html#drawtext-1) the replacement text. For each [video file](https://www.jw.org/finder?wtlocale=ASL&pub=nwt), the background gradient doesn't change, so it can be sampled only once for each file.
  
  Is this possible in FFmpeg? Other ideas on how to achieve the text replacement is also welcome.
  
  [![enter image description here](https://i.sstatic.net/wLVla.jpg)](https://i.sstatic.net/wLVla.jpg)
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-10-26. Score: 1 | Accepted answer
  
  I eventually found an answer to my question: **FFmpeg [delogo filter](https://ffmpeg.org/ffmpeg-filters.html#delogo)**
  
  `delogo` options I used for the videos in the question is: (for testing you can set `show=1`)
  
  `delogo=x=85:y=47:w=300:h=40:show=0`
  
  Sample `ffmpeg`/`ffplay` `-vf` options for encoding, `delogo` + `drawtext` filters:
  
  ```
  -vf "delogo=x=85:y=47:w=300:h=40:show=0,drawtext=text='SampleText':fontfile="${FONTFILE}":fontcolor=white:fontsize=34:x=93:y=54:alpha=0.9"
  
  ```
  
  `delogo` is pretty neat, I wonder how they did this. Quite fast too.
  
  
  ---
  
  