4

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?

20
  • 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
    Commented Dec 7, 2016 at 12:30
  • 2
    What about ffplay -f lavfi -i color=white:640x480:d=3
    – Gyan
    Commented Dec 7, 2016 at 12:47
  • 1
    Which OS is this?
    – Gyan
    Commented Dec 7, 2016 at 15:05
  • 1
    I'm also using a compiled version. Try it with the Zeranoe build, in any case.
    – Gyan
    Commented Dec 7, 2016 at 15:25
  • 1
    Output to PNG. And try the builds here.
    – Gyan
    Commented Dec 7, 2016 at 15:51

2 Answers 2

5

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.

1

This isn't answering the OP's question, but for anyone else finding this question when looking for how to use ffmpeg to generate a solid color image, using @Gyan's answer, the full command is as follows:

ffmpeg -f lavfi -i color=white:1920x1080:d=3,format=rgb24 -frames:v 1 white-1920x1080.png

To overwrite the output previous file, if any, add -y to the options.

1
  • Here, d sets the time duration per frame to d seconds*, but it errors with HH:MM:SS.ms syntax, I don't know why. Also, I don't understand how d relates to -framerate and -r rate, which d uses as a 'timebase'. *Supposedly. If -frames:v is 45, my video won't in fact have 45 seconds worth of video in it.
    – Unknow0059
    Commented Apr 29 at 7:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .