<p>Yes, you do need a ffmpeg build with gray pixel format enabled. You should get your binary from the Windows link at <a href="https://ffmpeg.org/download.html" rel="nofollow noreferrer">ffmpeg</a>. Download the latest 32-bit static build.</p>

<p>You can check if your build has gray enabled by running </p>

<pre><code>ffmpeg -pix_fmts | findstr /r gray
</code></pre>

<p>It should list an entry for gray. </p>

<p>And use <code>format=gray</code> in your <code>vf</code> chain and <code>-pix_fmt yuv420p</code> together for broad compatibility.</p>

<blockquote>
  <p>The command below is for linux. <a href="https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/findstr" rel="nofollow noreferrer"><code>grep</code></a> will work as <a href="http://man7.org/linux/man-pages/man1/grep.1.html" rel="nofollow noreferrer"><code>findstr</code></a>!</p>

<pre><code>ffmpeg -pix_fmts | grep -i gray
</code></pre>
</blockquote>

CC BY-SA 3.0
2016-03-31T10:55:24.007Z
Running your command on my current FFMPEG results in 
  IO... gray                   1             8
  IO... gray16be               1            16
  IO... gray16le               1            16
Does this mean it has gray enabled?
WoogieBoogie
CC BY-SA 3.0
2016-03-31T11:16:54.290Z
Ok, just follow the last line of my answer. Should work with your current build.
Gyan
CC BY-SA 3.0
2016-03-31T12:43:31.907Z
Running the command 
ffmpeg -i input.mov -vf format=gray -pix_fmt yuv420p output.mp4
results in a black screen.  I wonder if trying to do the conversion from .mov to mp4 at the same time is the problem? Now I think of it I'll try separate commands
WoogieBoogie
CC BY-SA 3.0
2016-03-31T12:49:12.770Z
Separating out the conversion from .mov -> .mp4 and the conversion to grayscale (using your commands) worked. Thanks :)
WoogieBoogie
CC BY-SA 4.0
2016-03-31T09:55:20.923Z
2019-01-15T10:24:35.947Z
2019-01-15T10:24:35.947Z
Gyan
<p>I am currently using an FFMPEG command like:</p>

<p>ffmpeg -i input.mov -vf scale=1920:1080 output.mp4</p>

<p>to convert varying input format file to a fixed resolution MP4 output file.  One final step I need is to make the output Black and White (the input files will be full color).</p>

<p>I have tried both 
    -pix_fmt gray 
and
    -vf format=gray,format=yuv422p</p>

<p>but both just result in a black output video.</p>

<p>After much trawling of google, it looks like the FFMPEG exe I downloaded (for windows) wasn't compiled with the "-enable-gray" option, but I don't know if this makes any difference and don't know how to obtain a windows FFMPEG with this option enabled (building FFMPEG myself looks like a lot of hard work).
Any advice welcome!  Thanks.</p>

<p>PS I should add that the conversion I'm currently doing and any grayscale conversion could be separate steps if required.</p>

<ffmpeg>
Convert variable input formats to black and white MP4
WoogieBoogie
# Convert variable input formats to black and white MP4

(Asked by: username_0 on 2016-03-31)

I am currently using an FFMPEG command like:

ffmpeg -i input.mov -vf scale=1920:1080 output.mp4

to convert varying input format file to a fixed resolution MP4 output file. One final step I need is to make the output Black and White (the input files will be full color).

I have tried both
-pix\_fmt gray
and
-vf format=gray,format=yuv422p

but both just result in a black output video.

After much trawling of google, it looks like the FFMPEG exe I downloaded (for windows) wasn't compiled with the "-enable-gray" option, but I don't know if this makes any difference and don't know how to obtain a windows FFMPEG with this option enabled (building FFMPEG myself looks like a lot of hard work).
Any advice welcome! Thanks.

PS I should add that the conversion I'm currently doing and any grayscale conversion could be separate steps if required.

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2016-03-31. Score: 4 | Accepted answer

Yes, you do need a ffmpeg build with gray pixel format enabled. You should get your binary from the Windows link at ffmpeg. Download the latest 32-bit static build.
You can check if your build has gray enabled by running 
ffmpeg -pix_fmts | findstr /r gray

It should list an entry for gray. 
And use format=gray in your vf chain and -pix_fmt yuv420p together for broad compatibility.

The command below is for linux. grep will work as findstr!
ffmpeg -pix_fmts | grep -i gray

> **Comments:**
> **username_0**: Running your command on my current FFMPEG results in    IO... gray                   1             8   IO... gray16be               1            16   IO... gray16le               1            16 Does this mean it has gray enabled?  
> **username_1**: Ok, just follow the last line of my answer. Should work with your current build.  
> **username_0**: Running the command  ffmpeg -i input.mov -vf format=gray -pix_fmt yuv420p output.mp4 results in a black screen.  I wonder if trying to do the conversion from .mov to mp4 at the same time is the problem? Now I think of it I'll try separate commands  
> **username_0**: Separating out the conversion from .mov -> .mp4 and the conversion to grayscale (using your commands) worked. Thanks :)  

---

