I want to create with ffmpeg a pure white video to use it as background. I mean a video that, played in a computer, you see as white. (In the examples I will pipe the output to ffplay so you don't need to delete the video later.)

To create a 3s 640x480 video (25 fps by default):

ffmpeg -f lavfi -i color=white:640x480:d=3 -f matroska - | ffplay -autoexit -

This is a small rectangle of the output against superuser page (which in my browser shows as white).

The first output against superuser page

Looking for an answer, I came to this question. The explanation is provided by Mulvya:

The padding is RGB 235, which is the upper limit in conventional video. So, a video player will expand 235 to show white. – Mulvya Oct 23 '15 at 17:44

But I found no player that show it as white. I tried with ffplay, MPC-HC and VLC both piping and creating an intermediate file.

With images as in the question, the solution seems to be adding the -format rgb32 option. But I get the same result with

ffmpeg -f lavfi -i color=white:640x480:d=3 -format rgb32 -f matroska - | ffplay -autoexit -

The -pixel_formatoption doesn't work either.

So... how do you create a pure white background video with ffmpeg?

  • 1
    With your first command, I get pure white (#FF) as confirmed by Photoshop. I also get white when I output to a webm and play in Firefox. Try adding -color_range 1 just before -f matroska. Also, upgrade your ffmpeg, in case you're using an old version. – Gyan Dec 7 '16 at 12:30
  • 2
    What about ffplay -f lavfi -i color=white:640x480:d=3 – Gyan Dec 7 '16 at 12:47
  • 1
    Which OS is this? – Gyan Dec 7 '16 at 15:05
  • 1
    I'm also using a compiled version. Try it with the Zeranoe build, in any case. – Gyan Dec 7 '16 at 15:25
  • 1
    Output to PNG. And try the builds here. – Gyan Dec 7 '16 at 15:51

As detailed in the comments, converting to a RGB format provides a full-range output.

-f lavfi -i color=white:640x480:d=3,format=rgb24

For other readers, I should note that I get a pure white display when running the OP's original command. I can't diagnose what's happening on OP's setup but there should be no special steps needed to generate a pure white output from ffmpeg other than color=white.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.