<p>You can use <a href="https://ffmpeg.org/download.html" rel="nofollow">ffmpeg</a>*, a command-line tool, to do this.</p>

<p>Let's say your source video is <code>360x640</code>, then to make it 4:3, use</p>

<pre><code>ffmpeg -i input.mp4 -vf pad=854:640:247:0 -c:v libx264 -crf 20 -c:a copy output.mp4
</code></pre>

<p>where <code>854</code> is used because it's <code>4/3</code> of <code>640</code>, and <code>247</code> places the video in the center of the padded canvas. See details for the pad filter <a href="https://ffmpeg.org/ffmpeg-filters.html#pad-1" rel="nofollow">here</a>.</p>

<p>Similarly for 16:9, use</p>

<pre><code>ffmpeg -i input.mp4 -vf pad=1138:640:389:0 -c:v libx264 -crf 20 -c:a copy output.mp4
</code></pre>

<p>where <code>1138</code> is used because it's <code>16/9</code> of <code>640</code>, and <code>389</code> for centering.</p>

<p>The width value you specify should be an even integer, so you may have to round up/down your calculated width.</p>

<p>*get the latest nightly or snapshot binary for your platform.</p>

CC BY-SA 3.0
2016-02-16T15:09:16.387Z
@Mulvya Thanks for the reply. I will try that later on and accept the answer once I did it :)
Serge Inácio
CC BY-SA 3.0
2016-02-18T17:08:32.000Z
I tried it out. didn't have success yet, but I guess this is the way to do it.
Serge Inácio
CC BY-SA 3.0
2016-02-16T10:39:10.010Z
2016-02-16T14:41:16.067Z
2016-02-16T14:41:16.067Z
Gyan
<p>I have several vertical videos which I would like to display in the 16/9 or 4/3 format.</p>

<p>I would like to have the video centered and have a black Background.</p>

<p>I normally use Handbrake to compress my videos but did not find an option to do that.</p>

<p>Is there another Video compressor (open source) who allows to do that? Other wise I have to compress it with handbrake and add the background with Premiere, which takes ages.</p>

<p>Really would like an easier solution.</p>

<p>Thanks in advance for any response.</p>

<video><formats><handbrake>
Add Black background to a vertical video
Serge Inácio
# Add Black background to a vertical video

(Asked by: username_0 on 2016-02-16)

I have several vertical videos which I would like to display in the 16/9 or 4/3 format.

I would like to have the video centered and have a black Background.

I normally use Handbrake to compress my videos but did not find an option to do that.

Is there another Video compressor (open source) who allows to do that? Other wise I have to compress it with handbrake and add the background with Premiere, which takes ages.

Really would like an easier solution.

Thanks in advance for any response.

**Tags:** video, formats, handbrake


---

## 1 answers

### Answer by username_1 on 2016-02-16. Score: 1 | Accepted answer

You can use ffmpeg*, a command-line tool, to do this.
Let's say your source video is 360x640, then to make it 4:3, use
ffmpeg -i input.mp4 -vf pad=854:640:247:0 -c:v libx264 -crf 20 -c:a copy output.mp4

where 854 is used because it's 4/3 of 640, and 247 places the video in the center of the padded canvas. See details for the pad filter here.
Similarly for 16:9, use
ffmpeg -i input.mp4 -vf pad=1138:640:389:0 -c:v libx264 -crf 20 -c:a copy output.mp4

where 1138 is used because it's 16/9 of 640, and 389 for centering.
The width value you specify should be an even integer, so you may have to round up/down your calculated width.
*get the latest nightly or snapshot binary for your platform.

> **Comments:**
> **username_0**: @Mulvya Thanks for the reply. I will try that later on and accept the answer once I did it :)  
> **username_0**: I tried it out. didn't have success yet, but I guess this is the way to do it.  

---

