NoonanRosenblum
NoonanRosenblum

Reputation: 533

FFmpeg How disable video output?

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 :

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 ?

Upvotes: 1

Views: 3093

Answers (3)

Dan C
Dan C

Reputation: 21

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.

Upvotes: 1

Gyan
Gyan

Reputation: 92988

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.

Upvotes: 3

Rolf of Saxony
Rolf of Saxony

Reputation: 22443

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.

Upvotes: 1

Related Questions