Page 1 of 1

Pass Xvfb directly to ffmpeg

Posted: Mon Jan 08, 2018 2:54 pm
by mario90yxz
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: Select all

sudo Xvfb $DISPLAY -ac -screen 0 1680x900x24 -fbdir /tmp/screen/test.xwd > /dev/null 2>&1 &
ffmpeg read command:

Code: Select all

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 ' \
    'output_file.mkv'
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/1HWjEqr ... NWdp7/view

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

Thanks!