Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-11T14:00:24.753Z
Answers.LastActivityDate: 2016-11-11T14:00:24.753Z
Answers.UserDisplayName: Tyler Liu
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-10T15:22:42.703Z
Answers.Text: It doesn't work for me. Still get grey color.
Answers.UserDisplayName: Tyler Liu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-10T15:26:56.397Z
Answers.Text: What command are you using?
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-10T15:34:03.843Z
Answers.Text: `ffmpeg -i input.png -vf "pad=iw+0:ih+300:0:300:#FFFFFF@1,format=rgb24" -y output.png`
Answers.UserDisplayName: Tyler Liu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-10T15:52:22.077Z
Answers.Text: Don't see anything wrong. How are you checking the output?
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-11T01:42:46.037Z
Answers.Text: 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.
Answers.UserDisplayName: Tyler Liu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-11T02:18:27.860Z
Answers.Text: I tried the version downloaded here: http://evermeet.cx/ffmpeg/  and it gave me white color even without `format=rgb24`!
Answers.UserDisplayName: Tyler Liu
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-11T02:47:14.647Z
Answers.Text: For PNG, that will be the case.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-03T19:04:34.140Z
Answers.Text: This worked for me but I had to put the `format=rgb24` at the beginning of the filter chain, not the end.
Answers.UserDisplayName: Meekohi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-23T19:25:54.933Z
Answers.LastActivityDate: 2015-10-24T10:22:26.427Z
Answers.LastEditDate: 2015-10-24T10:22:26.427Z
Answers.UserDisplayName: Gyan
Body: <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>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-23T17:41:10.357Z
Comments.Text: Please show the complete console output from your `ffmpeg` command.
Comments.UserDisplayName: llogan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-23T17:44:32.840Z
Comments.Text: The padding is RGB 235, which is the upper limit in conventional video. So, a video player will expand 235 to show white.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-23T18:22:14.280Z
Comments.Text: @mulvya that's great for conventional video but not if you plan to print it. Any way to override this
Comments.UserDisplayName: Sebastian Annies
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-23T18:28:46.160Z
Comments.Text: Outputting to PNG will get you pure white. Then using ffmpeg again to convert to JPG preserves the values.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-23T18:29:28.930Z
Comments.Text: 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
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-23T18:30:05.430Z
Comments.Text: Then ffmpeg -i franck-padded.png franck-padded.jpg
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-10-23T18:47:40.180Z
Comments.Text: That's a nice workaround. Thank you. Nevertheless I prefer a direct way so I don't lose time unnecessarily.
Comments.UserDisplayName: Sebastian Annies
Tags: <ffmpeg><color>
Title: ffmpeg: white padding is light grey but not white
UserDisplayName: Sebastian Annies
ThreadText: # 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):
  [![enter image description here](https://i.sstatic.net/jNMQp.jpg)](https://i.sstatic.net/jNMQp.jpg)
  
  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:
  
  ```bash
  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:
  
  ```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](https://en.wikipedia.org/wiki/Color_space) 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)
  
  [![enter image description here](https://i.sstatic.net/d66Dd.jpg)](https://i.sstatic.net/d66Dd.jpg)
  
  > **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
  
  ```
  
  
  ---
  
  