1

With ffmpeg 4.3.1, I want to use the "blackframe" filter.

This filter outputs text results in the console each time a black frame is detected in the input video.

ffmpeg -i Input.avi -filter_complex "blackframe" Output.mkv > [Parsed_blackframe_1 @ 0x7ff48c607a80] frame:206 pblack:100 ... 

I do not need to create the Output.mkv video, as console result is enough.

Unfortunately I am not able to find in the documentation how disable output video and still run the filter. From the main options section https://www.ffmpeg.org/ffmpeg.html#Main-options and examples elsewhere I tried :

  • -f null
  • or -y NULoption in the -pass option example of the doc

But none of these commands works :

ffmpeg -i Video.avi -filter_complex "black frame" -f null > Filter blackframe has an unconnected output ffmpeg -i Video.avi -filter_complex "black frame" -y NUL > [NULL @ 0x7ffbe7026200] Unable to find a suitable output format for 'NUL' > NUL: Invalid argument 

How can I disable video output ?

Where is it explain in the documentation ?

3 Answers 3

3

You're missing the output url in the null attempt. Just add a -

i.e.

ffmpeg -i Video.avi -vf "blackframe" -f null -

Since you're a running a filter on a single stream, -vf will do.

Sign up to request clarification or add additional context in comments.

1 Comment

I am expecting to lose my accepted answer. This is much more concise. +1
1

On Linux:

ffmpeg -i Video.avi -filter_complex "blackframe" -pass 1 -an -f rawvideo -y /dev/null 

Results in:

[Parsed_blackframe_0 @ 0x6e11940] frame:1 pblack:100 pts:2 t:0.041708 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:2 pblack:100 pts:4 t:0.083417 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:3 pblack:100 pts:6 t:0.125125 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:4 pblack:100 pts:8 t:0.166833 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:5 pblack:100 pts:10 t:0.208542 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:6 pblack:100 pts:12 t:0.250250 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:7 pblack:100 pts:14 t:0.291958 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:8 pblack:100 pts:16 t:0.333667 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:9 pblack:100 pts:18 t:0.375375 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:10 pblack:100 pts:20 t:0.417083 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:11 pblack:100 pts:22 t:0.458792 type:P last_keyframe:0 [Parsed_blackframe_0 @ 0x6e11940] frame:12 pblack:100 pts:24 t:0.500500 type:I last_keyframe:12 [Parsed_blackframe_0 @ 0x6e11940] frame:13 pblack:100 pts:26 t:0.542208 type:P last_keyframe:12 [Parsed_blackframe_0 @ 0x6e11940] frame:14 pblack:100 pts:28 t:0.583917 type:P last_keyframe:12 

The command specifies no audio and then dumps the raw video to /dev/null

ffmpeg documentation: https://ffmpeg.org/ffmpeg.html#Video-Options See: -pass

The command on Windows purports to be -y NUL rather than -y /dev/null but I have no way of testing it.

2 Comments

Thank you a lot. I did read the -pass section before posting and yet I did not understood that the first example was Windows, and the second was Linux. The second is working perfectly in my case.
Having found this Q&A trying to solve the same problem with audio files, I found that -f null -y NUL does indeed work under Windows. As a PSA, I'll add that I was actually interested in the diagnostic output that ffmpeg produces, (duration in particular) and that is output to stderr. So with JPSoft's TCC at least, adding 2>&1 redirects the diagnostic output to stdout. YAMMV if you use CMD.EXE and/or PowerShell
1

You would probably also want to have a look at video option -vn:

-vn (input/output)
As an input option, blocks all video streams of a file from being filtered or being automatically selected or mapped for any output. See -discard option to disable streams individually.
As an output option, disables video recording i.e. automatic selection or mapping of any video stream. For full manual control see the -map option.

https://www.ffmpeg.org/ffmpeg.html#toc-Video-Options

https://www.ffmpeg.org/ffmpeg.html#Main-options:~:text=As%20an%20output%20option%2C%20disables%20video,option.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.