<p>The accepted answer doesn't work for me. I find a work around to this problem. PNG images doesn't have this issue. So you could first convert the file into PNG, then do the padding and convert it back to original image type. Let's say you have a file named <code>input.jpeg</code>, try something like this:</p>

<pre><code>ffmpeg -i input.jpeg -y temp.png
ffmpeg -i temp.png -vf "pad=iw+0:ih+300:0:300:#FFFFFF@1" -y output.jpeg
</code></pre>

CC BY-SA 3.0
2016-11-11T14:00:24.753Z
2016-11-11T14:00:24.753Z
Tyler Liu
<p>The end of the filter chain should output full RGB, like this:</p>

<p>Windows batch:</p>

<pre class="lang-bash prettyprint-override"><code>ffmpeg.exe -i "https://gooseberry.blender.org/wp-content/uploads/2014/01/franck.jpg" ^
  -filter_complex ^
   scale=iw*min(852/iw\,480/ih):ih*min(852/iw\,480/ih),^
pad=852:480:(852-iw*min(852/iw\,480/ih))/2:(480-ih*min(852/iw\,480/ih))/2:white,^
format=rgb24 franck-padded.jpg
</code></pre>

<p>Linux bash:</p>

<pre class="lang-bash prettyprint-override"><code>ffmpeg -i "https://gooseberry.blender.org/wp-content/uploads/2014/01/franck.jpg" \
  -filter_complex \
   "scale=iw*min(852/iw\,480/ih):ih*min(852/iw\,480/ih),\
pad=852:480:(852-iw*min(852/iw\,480/ih))/2:(480-ih*min(852/iw\,480/ih))/2:white,\
format=rgb24" franck-padded.jpg
</code></pre>

<p>The important part is <strong>format=rgb24</strong> which keeps or converts the final filter output to the RGB pixel format, which allows full range values from 0-255. Without that final filter, ffmpeg will convert the filter output to the YUV pixel format where the range of legal values is 16 to 235 for luma (brightness) - 16 maps to black and 235 to white - and 16 to 240 for the chroma components (color). (The default YUV <a href="https://en.wikipedia.org/wiki/Color_space" rel="noreferrer">colorspace</a> range is a legacy of analog television signals and carried over into the digital realm by the MPEG committee and hence still widely adhered to by most digital video formats)</p>

<p><a href="https://i.sstatic.net/d66Dd.jpg" rel="noreferrer"><img src="https://i.sstatic.net/d66Dd.jpg" alt="enter image description here"></a></p>

CC BY-SA 3.0
2016-11-10T15:22:42.703Z
It doesn't work for me. Still get grey color.
Tyler Liu
CC BY-SA 3.0
2016-11-10T15:26:56.397Z
What command are you using?
Gyan
CC BY-SA 3.0
2016-11-10T15:34:03.843Z
`ffmpeg -i input.png -vf "pad=iw+0:ih+300:0:300:#FFFFFF@1,format=rgb24" -y output.png`
Tyler Liu
CC BY-SA 3.0
2016-11-10T15:52:22.077Z
Don't see anything wrong. How are you checking the output?
Gyan
CC BY-SA 3.0
2016-11-11T01:42:46.037Z
I open the output in both Chrome and Preview on Mac and I confirm that the color is grey instead of white. FFmpeg is based on an old version (2015-02), I will try the latest version soon.
Tyler Liu
CC BY-SA 3.0
2016-11-11T02:18:27.860Z
I tried the version downloaded here: http://evermeet.cx/ffmpeg/  and it gave me white color even without `format=rgb24`!
Tyler Liu
CC BY-SA 3.0
2016-11-11T02:47:14.647Z
For PNG, that will be the case.
Gyan
CC BY-SA 3.0
2017-08-03T19:04:34.140Z
This worked for me but I had to put the `format=rgb24` at the beginning of the filter chain, not the end.
Meekohi
CC BY-SA 3.0
2015-10-23T19:25:54.933Z
2015-10-24T10:22:26.427Z
2015-10-24T10:22:26.427Z
Gyan
<p>I want to generate 16:9 thumbnails from videos with white padding but the resulting picture has grey padding instead of white. This is the command line (input here is a jpg but the effect is the same when using a video):</p>

<pre><code>ffmpeg.exe -i "https://gooseberry.blender.org/wp-content/uploads/2014/01/franck.jpg" -filter_complex scale=iw*min(852/iw\,480/ih):ih*min(852/iw\,480/ih),pad=852:480:(852-iw*min(852/iw\,480/ih))/2:(480-ih*min(852/iw\,480/ih))/2:white,fps=fps=50/5.000000 output.jpg
</code></pre>

<p>the resulting image (text and white box added with paint): 
<a href="https://i.sstatic.net/jNMQp.jpg" rel="noreferrer"><img src="https://i.sstatic.net/jNMQp.jpg" alt="enter image description here"></a></p>

<p>even though the padding color is white it's light grey in reality. Is there a way to get it 'whiter'? It's especially ugly if you plan to print it on paper. </p>

CC BY-SA 3.0
2015-10-23T17:41:10.357Z
Please show the complete console output from your `ffmpeg` command.
llogan
CC BY-SA 3.0
2015-10-23T17:44:32.840Z
The padding is RGB 235, which is the upper limit in conventional video. So, a video player will expand 235 to show white.
Gyan
CC BY-SA 3.0
2015-10-23T18:22:14.280Z
@mulvya that's great for conventional video but not if you plan to print it. Any way to override this
Sebastian Annies
CC BY-SA 3.0
2015-10-23T18:28:46.160Z
Outputting to PNG will get you pure white. Then using ffmpeg again to convert to JPG preserves the values.
Gyan
CC BY-SA 3.0
2015-10-23T18:29:28.930Z
So, first ffmpeg.exe -i franck.jpg -filter_complex "scale=iw*min(852/iw\,480/ih):ih*min(852/iw\,480/ih),pad=852:480:(852-iw*min(852/iw\,480/ih))/2:(480-ih*min(852/iw\,480/ih))/2:white,fps=fps=50/5.000000 franck-padded.png
Gyan
CC BY-SA 3.0
2015-10-23T18:30:05.430Z
Then ffmpeg -i franck-padded.png franck-padded.jpg
Gyan
CC BY-SA 3.0
2015-10-23T18:47:40.180Z
That's a nice workaround. Thank you. Nevertheless I prefer a direct way so I don't lose time unnecessarily.
Sebastian Annies
<ffmpeg><color>
ffmpeg: white padding is light grey but not white
Sebastian Annies
# ffmpeg: white padding is light grey but not white

(Asked by: username_0 on 2015-10-23)

I want to generate 16:9 thumbnails from videos with white padding but the resulting picture has grey padding instead of white. This is the command line (input here is a jpg but the effect is the same when using a video):
ffmpeg.exe -i "https://gooseberry.blender.org/wp-content/uploads/2014/01/franck.jpg" -filter_complex scale=iw*min(852/iw\,480/ih):ih*min(852/iw\,480/ih),pad=852:480:(852-iw*min(852/iw\,480/ih))/2:(480-ih*min(852/iw\,480/ih))/2:white,fps=fps=50/5.000000 output.jpg

the resulting image (text and white box added with paint): 

even though the padding color is white it's light grey in reality. Is there a way to get it 'whiter'? It's especially ugly if you plan to print it on paper.

**Tags:** ffmpeg, color

> **Comments:**
> **username_1**: Please show the complete console output from your `ffmpeg` command.  
> **username_2**: The padding is RGB 235, which is the upper limit in conventional video. So, a video player will expand 235 to show white.  
> **username_0**: @mulvya that's great for conventional video but not if you plan to print it. Any way to override this  
> **username_2**: Outputting to PNG will get you pure white. Then using ffmpeg again to convert to JPG preserves the values.  
> **username_2**: So, first ffmpeg.exe -i franck.jpg -filter_complex "scale=iw*min(852/iw\,480/ih):ih*min(852/iw\,480/ih),pad=852:480:(852-iw*min(852/iw\,480/ih))/2:(480-ih*min(852/iw\,480/ih))/2:white,fps=fps=50/5.000000 franck-padded.png  
> **username_2**: Then ffmpeg -i franck-padded.png franck-padded.jpg  
> **username_0**: That's a nice workaround. Thank you. Nevertheless I prefer a direct way so I don't lose time unnecessarily.  

---

## 2 answers

### Answer by username_2 on 2015-10-23. Score: 6 | Accepted answer

The end of the filter chain should output full RGB, like this:
Windows batch:
ffmpeg.exe -i "https://gooseberry.blender.org/wp-content/uploads/2014/01/franck.jpg" ^
  -filter_complex ^
   scale=iw*min(852/iw\,480/ih):ih*min(852/iw\,480/ih),^
pad=852:480:(852-iw*min(852/iw\,480/ih))/2:(480-ih*min(852/iw\,480/ih))/2:white,^
format=rgb24 franck-padded.jpg

Linux bash:
ffmpeg -i "https://gooseberry.blender.org/wp-content/uploads/2014/01/franck.jpg" \
  -filter_complex \
   "scale=iw*min(852/iw\,480/ih):ih*min(852/iw\,480/ih),\
pad=852:480:(852-iw*min(852/iw\,480/ih))/2:(480-ih*min(852/iw\,480/ih))/2:white,\
format=rgb24" franck-padded.jpg

The important part is format=rgb24 which keeps or converts the final filter output to the RGB pixel format, which allows full range values from 0-255. Without that final filter, ffmpeg will convert the filter output to the YUV pixel format where the range of legal values is 16 to 235 for luma (brightness) - 16 maps to black and 235 to white - and 16 to 240 for the chroma components (color). (The default YUV colorspace range is a legacy of analog television signals and carried over into the digital realm by the MPEG committee and hence still widely adhered to by most digital video formats)

> **Comments:**
> **username_3**: It doesn't work for me. Still get grey color.  
> **username_2**: What command are you using?  
> **username_3**: `ffmpeg -i input.png -vf "pad=iw+0:ih+300:0:300:#FFFFFF@1,format=rgb24" -y output.png`  
> **username_2**: Don't see anything wrong. How are you checking the output?  
> **username_3**: I open the output in both Chrome and Preview on Mac and I confirm that the color is grey instead of white. FFmpeg is based on an old version (2015-02), I will try the latest version soon.  
> **username_3**: I tried the version downloaded here: http://evermeet.cx/ffmpeg/  and it gave me white color even without `format=rgb24`!  
> **username_2**: For PNG, that will be the case.  
> **username_4**: This worked for me but I had to put the `format=rgb24` at the beginning of the filter chain, not the end.  

---

### Answer by username_3 on 2016-11-11. Score: -1

The accepted answer doesn't work for me. I find a work around to this problem. PNG images doesn't have this issue. So you could first convert the file into PNG, then do the padding and convert it back to original image type. Let's say you have a file named input.jpeg, try something like this:
ffmpeg -i input.jpeg -y temp.png
ffmpeg -i temp.png -vf "pad=iw+0:ih+300:0:300:#FFFFFF@1" -y output.jpeg


---

