<p>For the blur effect command, you needed to swap a few widths with heights then rescale it so the original video fits in properly above the blurred video:</p>
<pre><code>ffmpeg -i input.mp4 -vf 'split[original][copy];[copy]scale=-1:ih*(16/9)*(16/9),crop=w=ih*9/16,gblur=sigma=20[blurred];[blurred][original]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2' output.mp4
</code></pre>
<hr />
<p>If you want black bars instead, <a href="https://stackoverflow.com/questions/55383442/ffmpeg-how-to-convert-horizontal-video-169-to-vertical-video-916-with-black">it was covered in this post</a>, but for the tl;dr, it's this:</p>
<pre><code>ffmpeg -i input.mp4 -vf &quot;pad=iw:2*trunc(iw*16/18):(ow-iw)/2:(oh-ih)/2,setsar=1&quot; -c:a copy output.mp4
</code></pre>

CC BY-SA 4.0
2021-09-18T07:20:42.927Z
2021-09-18T07:20:42.927Z
sim2kid
<p>To rotate, you can just edit the video metadata. For example the following command produce output that is shown 90 degree rotated in VLC, you may use -90, depending on orientetion of your video.</p>
<pre><code>ffmpeg -i input.mp4 -metadata:s:v rotate=90 output.mp4
</code></pre>
<p>I don't know but if the player is inept to read and apply this, it mightn't work.</p>

CC BY-SA 4.0
2021-08-05T06:04:44.727Z
2021-08-05T06:04:44.727Z
Abdullah Ibn Fulan
<p>I want to make a horizontal video get converted to vertical video using FFMPEG for automation purposes. I tried with this, which works for vertical to horizontal</p>
<pre><code>    ffmpeg -i input.mp4 \
  -vf 'split[original][copy];[copy]scale=ih*16/9:-1,crop=h=iw*9/16,gblur=sigma=20[blurred];[blurred][original]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2' \
  output.mp4
</code></pre>
<p>And tried to change the &quot;16/9&quot; and &quot;9/16&quot; parameters backwards so it makes the reverse procedure, but i get an error.</p>
<p>I don't really need the blur thing, because i want to put some images on the black boxes that will result from doing this process.</p>

<video><ffmpeg><aspect>
Horizontal to vertical video using ffmpeg
Joaquín de la Iglesia
# Horizontal to vertical video using ffmpeg

(Asked by: username_0 on 2021-03-17)

I want to make a horizontal video get converted to vertical video using FFMPEG for automation purposes. I tried with this, which works for vertical to horizontal
    ffmpeg -i input.mp4 \
  -vf 'split[original][copy];[copy]scale=ih*16/9:-1,crop=h=iw*9/16,gblur=sigma=20[blurred];[blurred][original]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2' \
  output.mp4

And tried to change the "16/9" and "9/16" parameters backwards so it makes the reverse procedure, but i get an error.
I don't really need the blur thing, because i want to put some images on the black boxes that will result from doing this process.

**Tags:** video, ffmpeg, aspect


---

## 2 answers

### Answer by username_1 on 2021-09-18. Score: 1

For the blur effect command, you needed to swap a few widths with heights then rescale it so the original video fits in properly above the blurred video:
ffmpeg -i input.mp4 -vf 'split[original][copy];[copy]scale=-1:ih*(16/9)*(16/9),crop=w=ih*9/16,gblur=sigma=20[blurred];[blurred][original]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2' output.mp4


If you want black bars instead, it was covered in this post, but for the tl;dr, it's this:
ffmpeg -i input.mp4 -vf "pad=iw:2*trunc(iw*16/18):(ow-iw)/2:(oh-ih)/2,setsar=1" -c:a copy output.mp4


---

### Answer by username_2 on 2021-08-05. Score: 0

To rotate, you can just edit the video metadata. For example the following command produce output that is shown 90 degree rotated in VLC, you may use -90, depending on orientetion of your video.
ffmpeg -i input.mp4 -metadata:s:v rotate=90 output.mp4

I don't know but if the player is inept to read and apply this, it mightn't work.


---

