wiki:

Null


Version 8 (modified by rogerdpack, 3 years ago) (diff)

add a nullsink example

There are several ways to "output to null" in FFmpeg (like a null sink). This can be helpful for benchmarking purposes, for instance testing encoding speeds (without having to worry about the cost of disk writes) etc.

There is the null muxer, use it like this:

   ffmpeg -i INPUT -f null out.null # file out.null will not be created, decoding will occur, no encoding will occur

or just output to /dev/null (or the reserved filename NUL in windows) for your file to just disappear, if you want to perform encoding but not create a file

   ffmpeg -i INPUT -f mpeg4 -f mp4 -y /dev/null # no file is created, encoding and placing in container occur

See also the "-benchmark" FFmpeg command line parameter which outputs some statistics when it ends:

  ffmpeg -benchmark -i input output
...
bench: utime=53.670s
bench: maxrss=145227776kB

There is also a "nullsink" (null video sink) however, in order to have it work you have to be careful, because by default FFmpeg is "greedy" and will grab whatever stream it can find, so if your filter_complex output doesn't "output" anything, it will just re-encode the inputs and ignore the filter, etc. Here is an example of its use:

 ffmpeg -benchmark -i INPUT   -filter_complex "[0] split [splitout1][splitout2];[splitout1]nullsink"  -map "[splitout2]" out.mp4

in the FFMpeg output it specifies (in this case)

  split:output1 -> Stream #0:0 (libx264)

which means the second output from the split is being encoded (the first output has effectively been sent to the nullsink).