Hi all,
So a bit of background. I’m running LightBurn on Linux Mint 21.1 (Ubuntu 21.1 based). I had a camera that was working OK, but had a lens that was too narrow. I picked up another with a wider lens that happened to be a higher resolution - 16MP vs 4MP I believe. Very similar to the original one otherwise, but I started to get the “allocation failed” error. I found an earlier thread on here (https://forum.lightburnsoftware.com/t/ubuntu-linux-camerabin-error-allocation-failed/94067) that is now closed but the suspicion there was a mismatch in some library versions.
That didn’t quite track for me, as the old camera and new one both use the same driver. So I started to suspect that the real cause at least for me was the increased resolution. Allocation usually refers to memory allocation, and I figured the memory allocation required for the image buffers for the new camera was probably 4x the old one at least. But LightBurn defaults to the max resolution (and switching between “Default” and “Max Resolution” in settings made no difference) and I couldn’t find a way to override that.
Finally I found this on another forum. Basically it involves creating a virtual camera with only a single resolution and feeding the real camera thru that, then using the virtual camera in LightBurn. I created a little shell script with this:
#! /bin/bash
# Create a virtual camera at /dev/video7 named VirtualCam
sudo modprobe v4l2loopback devices=1 video_nr=7 card_label="VirtualCam" exclusive_caps=1
# Forward video from /dev/video0 to /dev/video7 at the given resolution
ffmpeg -f video4linux2 -framerate 30 -video_size 1600x1200 -input_format mjpeg -i /dev/video0 -f v4l2 -pix_fmt yuv420p /dev/video7
You may need to edit to select a different resolution and/or video device depending on your setup.
I know I had to install ffmpeg (sudo apt install ffmpeg) but I’m not sure if v4l2loopback was already installed or if it got installed with the v4l2 utilities I installed earlier.
Run the script in a terminal and it will keep running outputting some statistics. Start LightBurn and if everything is right, select “VirtualCam” as your camera.
It would be really great if LightBurn could add a dropdown or something to allow selecting a specific resolution rather than just “Default” and “Max”.
Hope this helps if you’re having this problem!
Eddie