[FFmpeg-devel] [PATCH] avutil/eval: Use even better PRNG

Michael Koch astroelectronic at t-online.de
Fri Jan 19 10:53:46 EET 2024


There is still a small problem with the random generator, but this has 
nothing to do with the recent changes.
If the random() expression is used in the geq filter, then multiple 
pixels get the same sequence of random numbers.
As can be shown with this command, where the frame has only two pixels:

ffmpeg -loglevel repeat -f lavfi -i nullsrc=size=1x2,format=gray -vf 
"geq=lum='print(random(0));print(random(0));print(random(0))'" -frames 1 
-y out.png

I think it's because the filter is executed in multiple threads.
-filter_threads 1 fixes the problem, but it slows down the whole filter 
thread.

Michael




More information about the ffmpeg-devel mailing list