[FFmpeg-user] Question about random() expression

Michael Koch astroelectronic at t-online.de
Thu Dec 28 01:20:21 EET 2023


Am 27.12.2023 um 23:59 schrieb Jim DeLaHunt:
> Michael:
>
> On 2023-12-27 13:51, Michael Koch wrote:
>> ...I'm using this command line to print four consecutive random numbers:
>> ...
> I do not have an answer to your question about the behaviour of the 
> random() function. However, I cannot reproduce your results on my 
> machine. I get an error complaining about the video filter syntax 
> instead.

If not on a Windows machine, you may have to encapsulate the filter 
thread in double quotes.
Please try this command:
ffmpeg -filter_threads 1 -loglevel repeat -f lavfi -i 
color=gray:size=1x1,format=gray -vf 
"geq=lum='st(0,0.123);print(random(0));print(random(0));print(random(0));print(random(0))'" 
-frames 1 -y out.png

>
> Could you perhaps make a simpler command line invocation, which just 
> runs random() and does not generate a grey image or write a file?
>

I don't know how I could simplify it. random() is an expression. To use 
it, I need a filter that accepts an expression. For the filter I need an 
image to work on. Even if it has only one pixel, as in my example.

Michael



More information about the ffmpeg-user mailing list