user26662: I'd like to convert videos to black and white but also specify the threshold of what to convert to black/white.
I'm currently using cv2 to do this successfully using the 2 lines below (first converts to grayscale then B&W). But it would help my workflow to do everything with FFMPEG if possible.
    grayFrame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    (thresh, BW) = cv2.threshold(grayFrame, 10, 255, cv2.THRESH_BINARY)


user40660: The main answer didn't work for me, this did:
ffmpeg -i input.mkv -f lavfi -i color=gray:s=1280x720 -f lavfi -i color=black:s=1280x720 -f lavfi -i color=white:s=1280x720 -filter_complex "[0:v]scale=1280x720,threshold" output.mkv


user1760: Use the threshold filter:

ffmpeg -i main_1280x720.mp4 -f lavfi -i color=gray:s=1280x720 -f lavfi -i color=black:s=1280x720 -f lavfi -i color=white:s=1280x720 -filter_complex threshold output.mkv

This filter requires four video streams to perform thresholding:

main input
threshold
min
max

You can optionally add the format filter for a grayscale pixel format: threshold,format=gray (assuming your output format supports that otherwise additional pixel format conversion will automatically take place).

26662: <p>I'd like to convert videos to black and white but also specify the threshold of what to convert to black/white.</p>

<p>I'm currently using cv2 to do this successfully using the 2 lines below (first converts to grayscale then B&amp;W). But it would help my workflow to do everything with FFMPEG if possible.</p>

<pre><code>    grayFrame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    (thresh, BW) = cv2.threshold(grayFrame, 10, 255, cv2.THRESH_BINARY)
</code></pre>
 40660: <p>The main answer didn't work for me, this did:</p>
<pre><code>ffmpeg -i input.mkv -f lavfi -i color=gray:s=1280x720 -f lavfi -i color=black:s=1280x720 -f lavfi -i color=white:s=1280x720 -filter_complex &quot;[0:v]scale=1280x720,threshold&quot; output.mkv
</code></pre>
 1760: <p>Use the <a href="https://ffmpeg.org/ffmpeg-filters.html#threshold" rel="nofollow noreferrer">threshold</a> filter:</p>

<p><a href="https://i.stack.imgur.com/umOvC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/umOvC.png" alt="enter image description here"></a></p>

<pre><code>ffmpeg -i main_1280x720.mp4 -f lavfi -i color=gray:s=1280x720 -f lavfi -i color=black:s=1280x720 -f lavfi -i color=white:s=1280x720 -filter_complex threshold output.mkv
</code></pre>

<p>This filter requires four video streams to perform thresholding:</p>

<ol>
<li>main input</li>
<li>threshold</li>
<li>min</li>
<li>max</li>
</ol>

<p>You can optionally add the <a href="https://ffmpeg.org/ffmpeg-filters.html#format" rel="nofollow noreferrer">format</a> filter for a grayscale pixel format: <code>threshold,format=gray</code> (assuming your output format supports that otherwise additional pixel format conversion will automatically take place).</p>
