I’m trying to stream my xvfb-run screen with puppeteer to rtmp using ffmpeg. But I’m only getting part of the screen. I’ve tried different ffmpeg commands and xvfb-run settings, but no luck.
I’ve dealt with similar streaming challenges using xvfb and ffmpeg. One thing that often gets overlooked is the importance of synchronization between the virtual framebuffer and ffmpeg’s capture rate. Try adding the ‘-framerate’ option to your ffmpeg command to match the refresh rate of your xvfb screen:
Also, ensure your puppeteer script isn’t causing any unexpected scrolling or resizing that might affect the capture. You might want to add a short delay after the page load before starting the ffmpeg capture to allow everything to stabilize.
If you’re still having issues, consider using a tool like ‘x11vnc’ to mirror your xvfb screen, then capture from that. It can sometimes provide a more stable source for ffmpeg to work with.
I’ve encountered similar issues when streaming xvfb screens. Have you considered using a virtual framebuffer like Xvfb with a fixed resolution that matches your streaming dimensions? This approach often resolves partial screen capture problems.
For your ffmpeg command, try specifying the exact dimensions you want to capture:
This explicitly tells ffmpeg to grab the full 1024x8000 screen. Also, the ‘ultrafast’ preset might help with real-time streaming performance.
If you’re still having issues, you could try using a tool like pyvirtualdisplay in conjunction with selenium instead of puppeteer. This combination has worked well for me in similar setups.