[FFmpeg-user] drawbox: text subpixel rendering (IO bootleneck)

Nikita Zlobin nick87720z at gmail.com
Wed Jan 26 00:57:54 EET 2022


Found reason - it's due to 'format=gray' before [new] pad. After I
removed that conversion - it's again at full fps even with all ffmpeg
job done in one instance, with only cat for loopback.

Output from it goes to overlay, which supports only yuv and rgb. Not
sure, if that's reason.

But still - why would not this choke cause cpu load?

In Tue, 25 Jan 2022 05:58:04 +0500
Nikita Zlobin <nick87720z at gmail.com> wrote:

> I managed to get it working with overlay, using tee & named fifo.
> 
> In first attempt I had two ffmpeg instance:
> 1 - creating new image, merging with accumulator image and sending to
> tee, which makes split job, redirecting it to second ffmpeg.
> 2 - takes output from ffmpeg-1 and shifts, preparing for new merge,
> and feeds it to fifo, where ffmpeg-1 reads it again. But before
> ffmpeg-2 starts, ffmpeg-1 is seeded by null "starter" frame,
> generated by awk, so that loop can start (I tried - it will not
> without initial seed).
> 
> That was able to reach 1150 fps.
> 
> I expected, that doing all job in one ffmpeg would give better speed.
> Actual ffmpeg command:
> 
> stdbuf -o0 ffmpeg -nostdin -v verbose \
>   -vcodec rawvideo -f rawvideo -pix_fmt gray -s 1x1    -i pipe:0 \
>   -vcodec rawvideo -f rawvideo -pix_fmt gray -s ${w}x${h}        \
>   -i "${loop_src}" -filter_complex "
>   [0:v]
>       scale = iw : 128 : flags = neighbor,
>       geq = lum='
>         if( gt(Y, H - p(X,Y) * H / 255 ),
>             80
>         )',
>       scale = iw : $h : flags = bicubic,
>       format = gray
>   [new];
>   [1:v]
>       convolution = 0 0 1 : 0mode = row,
>       format = gray
>   [acc_out];
>   [acc_out] [new]
>       overlay = W-1 : 0,
>       format = gray
> " -vcodec rawvideo -f rawvideo - | stdbuf -o0 tee "${loop_src}"
> 
> and seed command:
> 
> stdbuf -o0 awk 'BEGIN { 
>   for (i = 0; i < ('$w'*'$h'); i++)
>     printf "\0"
>   exit
> }' > "${loop_src}" &
> 
> (as for loop_sink - it was used for second loop).
> 
> But instead - strange bootleneck appeared, keeping fps between 200 and
> 100. However, it's not cpu load - I can barely notice it. Suspecting
> IO problem. At least during start - visible graphic movement speed
> erratically increased, but otherwise was constrained.
> 
> I tried to change stdbuf -o to have buffer with size just to
> hold output frame, but it did not make a difference.
> 
> Is it possible to reduce it without second ffmpeg instance?



More information about the ffmpeg-user mailing list