I'm trying to pass Xvfb buffor directly to ffmpeg inside Docker. This is approach give me really big performance benefits.

This is how I'm doing it:

Xvfb write the screen output:
[code]sudo Xvfb $DISPLAY -ac -screen 0 1680x900x24 -fbdir /tmp/screen/test.xwd > /dev/null 2>&1 &[\code]

ffmpeg read command:

ffmpeg -hide_banner -loglevel debug -loop 1 ' \
    '-re -i /tmp/screen/test.xwd ' \
    '-f alsa -i default -strict -2 -ac 2 -preset ultrafast -f ' \
    '-c:av copy ' \

The problem is: ffmpeg missed many frames and the video should be 3 minutes long, but is half of expected time (video accelerates at some point).
On following video you can see the problem: https://drive.google.com/file/d/1HWjEqrtPfZCRSndxpUpY1iXsrfMNWdp7/view

I guess there is a problem with ffmpeg command and it requires some tweaks, but no idea how to configure it properly.