<p>ffmpeg -y -i scene_2.mp4 -filter_complex <br />
&quot;[0:v]scale=405:720:force_original_aspect_ratio=increase,crop=405:720,gblur=sigma=20[bg]; <br />
[0:v]scale=406:229[ov]; <br />
[bg][ov]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[mix]&quot; <br />
-map [mix] -map 0:a? -c:v libx264 -c:a aac out.mp4 -y</p>

CC BY-SA 4.0
2024-05-27T12:35:44.950Z
2024-05-27T12:35:44.950Z
Ravi Pratap Rai
<p>Accepted answer works perfectly, I only needed to change the overlay a bit into <code>overlay=(W-w)/2:(H-h)/2[mix]</code> because the blurry effect appeared at the bottom of the video all the time</p>

CC BY-SA 4.0
2021-01-08T09:26:46.853Z
2021-01-08T09:26:46.853Z
Balla Győző
<p>Solved with 5 separated commands:</p>

<pre><code>ffmpeg -i tmpVideo.mp4 scale=1080:1080 container.mp4
ffmpeg -i container.mp4 gblur=sigma=20 blurred.mp4
ffmpeg -i tmpVideo.mp4 scale=-1:1080 content.mp4
ffmpeg -i container.mp4 -i blurred.mp4 -filter_complex "[0:v][1:v]overlay=0:0" mix.mp4
ffmpeg -i mix.mp4 -i content.mp4 -filter_complex "[0:v][1:v]overlay=(W-w)/2:0" output.mp4
</code></pre>

CC BY-SA 4.0
2019-06-08T05:56:41.687Z
Are you sure that your first 3 commands are correct without something as `-vf`?
MarianD
CC BY-SA 4.0
2019-05-24T21:31:11.057Z
2019-05-24T21:31:11.057Z
jeudesprits
<p>You're missing the input to the filtergraph, for example <code>0:v</code>. There are other issues though, so this is what works for me:</p>

<pre><code>ffmpeg -i VID_20190619_205627.mp4 -filter_complex \
"[0:v]scale=1080:1080,setdar=1:1,gblur=sigma=20[bg]; \
[0:v]scale=-1:1080[ov]; \
[bg][ov]overlay=(W-w)/2:0[mix]" \
-map [mix] -r 25 out.mp4 -y
</code></pre>

<ul>
<li>the first chain of the filtergraph scales the input video to 1080 x 1080, forces the display aspect ratio to 1:1 and blurs the video. This is the background (<code>bg</code>)</li>
<li>the second chain takes the input video again and scales it to ? x 1080. This is the video that will be overlaid (<code>ov</code>)</li>
<li>the last chain overlays the scaled video (<code>ov</code>) on the blurred background (<code>bg</code>), and produced the output (<code>mix</code>), which is then chosen as the output with <code>-map</code>.</li>
</ul>

<p>Note that the blurred background is stretched in this way.</p>

<p>Depending on the type of input, you might want to force the frame rate with <code>-r 25</code> or similar, and to copy the audio track with <code>-map 0:a -c:a copy</code>.</p>

CC BY-SA 4.0
2019-06-19T19:31:37.910Z
2019-06-19T19:31:37.910Z
mcont
<p>The Original video resolution is 720:1280 and I want to:</p>

<ol>
<li>copy the original video, scale to 1080:1080 and blur.</li>
<li>again copy the original video and scale to 608:1080.</li>
<li>Finally move blurred to 1080:1080 box and move second(608:1080) scaled copy above the blurred copy.</li>
</ol>

<p><strong>Structure</strong>:</p>

<pre><code>Box(1080:1080)
  Blurred(Original -&gt; 1080:1080 -&gt; Blur)
  Scaled(Original -&gt; 608:1080)
</code></pre>

<p><code>ffmpeg</code> command:</p>

<pre><code>ffmpeg -i tmpVideo.mp4 -vf -filter_complex \
"split[main][copy]; \
[main]scale=1080:1080[container]; \
[copy]scale=-1:1080,split[content, copy1]; \
[copy1]gblur=sigma=20[blurred]; \
[container][blurred]overlay=0:0[mix]; \
[mix][content]overlay=W/2:0" \
output.mp4
</code></pre>

<p>The error I'm getting:</p>

<pre><code>Unable to find a suitable output format for 'split[main][copy]; [main]scale=1080:1080[container]; [copy]scale=-1:1080,split[content, copy1]; [copy1]gblur=sigma=20[blurred]; [container][blurred]overlay=0:0[mix]; [mix][content]overlay=W/2:0'
split[main][copy]; [main]scale=1080:1080[container]; [copy]scale=-1:1080,split[content, copy1]; [copy1]gblur=sigma=20[blurred]; [container][blurred]overlay=0:0[mix]; [mix][content]overlay=W/2:0: Invalid argument
</code></pre>

<p><em>How should I proceed?</em></p>

<ffmpeg>
Convert video from 9:16 to 1:1 with blurred box using ffmpeg?
jeudesprits
# Convert video from 9:16 to 1:1 with blurred box using ffmpeg?

(Asked by: username_0 on 2019-05-24)

The Original video resolution is 720:1280 and I want to:

copy the original video, scale to 1080:1080 and blur.
again copy the original video and scale to 608:1080.
Finally move blurred to 1080:1080 box and move second(608:1080) scaled copy above the blurred copy.

Structure:
Box(1080:1080)
  Blurred(Original -> 1080:1080 -> Blur)
  Scaled(Original -> 608:1080)

ffmpeg command:
ffmpeg -i tmpVideo.mp4 -vf -filter_complex \
"split[main][copy]; \
[main]scale=1080:1080[container]; \
[copy]scale=-1:1080,split[content, copy1]; \
[copy1]gblur=sigma=20[blurred]; \
[container][blurred]overlay=0:0[mix]; \
[mix][content]overlay=W/2:0" \
output.mp4

The error I'm getting:
Unable to find a suitable output format for 'split[main][copy]; [main]scale=1080:1080[container]; [copy]scale=-1:1080,split[content, copy1]; [copy1]gblur=sigma=20[blurred]; [container][blurred]overlay=0:0[mix]; [mix][content]overlay=W/2:0'
split[main][copy]; [main]scale=1080:1080[container]; [copy]scale=-1:1080,split[content, copy1]; [copy1]gblur=sigma=20[blurred]; [container][blurred]overlay=0:0[mix]; [mix][content]overlay=W/2:0: Invalid argument

How should I proceed?

**Tags:** ffmpeg


---

## 4 answers

### Answer by username_4 on 2019-06-19. Score: 4 | Accepted answer

You're missing the input to the filtergraph, for example 0:v. There are other issues though, so this is what works for me:
ffmpeg -i VID_20190619_205627.mp4 -filter_complex \
"[0:v]scale=1080:1080,setdar=1:1,gblur=sigma=20[bg]; \
[0:v]scale=-1:1080[ov]; \
[bg][ov]overlay=(W-w)/2:0[mix]" \
-map [mix] -r 25 out.mp4 -y


the first chain of the filtergraph scales the input video to 1080 x 1080, forces the display aspect ratio to 1:1 and blurs the video. This is the background (bg)
the second chain takes the input video again and scales it to ? x 1080. This is the video that will be overlaid (ov)
the last chain overlays the scaled video (ov) on the blurred background (bg), and produced the output (mix), which is then chosen as the output with -map.

Note that the blurred background is stretched in this way.
Depending on the type of input, you might want to force the frame rate with -r 25 or similar, and to copy the audio track with -map 0:a -c:a copy.


---

### Answer by username_1 on 2024-05-27. Score: -1

ffmpeg -y -i scene\_2.mp4 -filter\_complex   
"[0:v]scale=405:720:force\_original\_aspect\_ratio=increase,crop=405:720,gblur=sigma=20[bg];   
[0:v]scale=406:229[ov];   
[bg][ov]overlay=(main\_w-overlay\_w)/2:(main\_h-overlay\_h)/2[mix]"   
-map [mix] -map 0:a? -c:v libx264 -c:a aac out.mp4 -y


---

### Answer by username_2 on 2021-01-08. Score: -1

Accepted answer works perfectly, I only needed to change the overlay a bit into `overlay=(W-w)/2:(H-h)/2[mix]` because the blurry effect appeared at the bottom of the video all the time


---

### Answer by username_0 on 2019-05-24. Score: -1

Solved with 5 separated commands:
ffmpeg -i tmpVideo.mp4 scale=1080:1080 container.mp4
ffmpeg -i container.mp4 gblur=sigma=20 blurred.mp4
ffmpeg -i tmpVideo.mp4 scale=-1:1080 content.mp4
ffmpeg -i container.mp4 -i blurred.mp4 -filter_complex "[0:v][1:v]overlay=0:0" mix.mp4
ffmpeg -i mix.mp4 -i content.mp4 -filter_complex "[0:v][1:v]overlay=(W-w)/2:0" output.mp4

> **Comments:**
> **username_3**: Are you sure that your first 3 commands are correct without something as `-vf`?  

---

