CasparCG+CEF on Ubuntu 24, headless (1001th thread)

Hi!

I have a machine with Decklink card. The machine is intended to be standalone node for video processing (Decklink In → Decklink Out).

When starting to install/set up CasparCG+CEF I found that CEF really does not like headless systems. This leads to crashes of internal processes, lots of errors in logs and etc…

Managed to pack all software into docker image. With some configuration CasparCG works, overlays images and HTML on top of video, logs messages, responds to AMCP and sends OSC.

From what I’ve researched all the processing takes milliseconds, so available system resources are not an issue.

However, logs are filled with messages from CEF. Here crashed processes (code 132), d-bus errors, outdated endpoints and such. I’m sure CEF performs loads of unnecessary activities and fails on it.

Surprisingly, HTML overlaying works even with this in logs.

Now I’d like some assistance with docker configuration? Really would like CasparCG+CEF to use hardware resources if possible and CEF to not make whole system look like it’s about to permanently shut down due to errors =)

Here’s server.config file:

<?xml version="1.0" encoding="utf-8"?> debug media/ templates/ data/ logs/ secret PAL 1 true low disabled 1 false 9222 --no-sandbox --disable-gpu --disable-gpu-compositing --disable-dev-shm-usage --disable-dbus --remote-debugging-address=0.0.0.0 5250 AMCP localhost 8000

And here’s command line for docker:

DECKLINK_DEVICE=/dev/blackmagic-io0
COMM_PORT=5250
SERVER_CFG=/home/admin/casparcg/server.cfg

echo " OK"
docker run -d 
--name casparcg 
--privileged 
--user $(id -u):$(id -g) 
--device=/dev/dri:/dev/dri 
-v /etc/timezone:/etc/timezone:ro 
-v /etc/localtime:/etc/localtime:ro 
--device=$DECKLINK_DEVICE:/dev/blackmagic-io0 
-v /usr/lib/libDeckLinkAPI.so:/usr/lib/libDeckLinkAPI.so:ro 
-v $WD:/opt/casparcg 
-v $SERVER_CFG:/opt/casparcg/server.cfg 
-p $COMM_PORT:5250 
-p 6250:6250 
-p 9222:9222 
casparcg

Start.sh file (it is main entry point of docker image) :

#!/bin/bash
set -e

# Start Xvfb on display :99
Xvfb :99 -screen 0 1920x1080x24 -ac &
sleep 2

export DISPLAY=:99
export QT_QPA_PLATFORM=xcb

#Do NOT set EGL_PLATFORM=surfaceless - we want Xvfb
#Force software GL to avoid any GPU probing

export LIBGL_ALWAYS_SOFTWARE=1

cd /opt/casparcg

#1. Start the Media Scanner in the background
echo "Starting CasparCG Media Scanner..."
Create a symbolic link so the scanner finds its expected file name
ln -sf /opt/casparcg/server.cfg casparcg.config
/usr/bin/casparcg-scanner &

# Give the scanner a couple of seconds to spin up and bind to port 8000
sleep 2

# 2. Start CasparCG Server in the foreground

echo "Starting CasparCG Server..."
exec /usr/bin/casparcg-server-2.5 server.cfg

And, finally, dockerfile:

FROM ubuntu:24.04

# Install locales and generate UTF-8

RUN apt-get update && apt-get install -y locales && 
   locale-gen en_US.UTF-8 && 
   locale-gen ru_RU.UTF-8 && 
   rm -rf /var/lib/apt/lists/*

# Set the environment to use UTF-8

ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

ENV DEBIAN_FRONTEND=noninteractive

# Install Xvfb, dependencies, AND the missing libc++ library

RUN apt-get update && apt-get install -y xvfb 
   libnss3 libatk-bridge2.0-0 libgtk-3-0 libasound2t64 
   libx11-xcb1 libxcomposite1 libxdamage1 libxrandr2 
   libgbm1 libpango-1.0-0 libcairo2 libxshmfence1 
   libdrm2 mesa-utils 
   libc++1 libc++abi1 
     && rm -rf /var/lib/apt/lists/*

WORKDIR /opt/casparcg

# Copy and install the packages
COPY .deb /tmp/
RUN apt-get update && apt-get install -y /tmp/.deb && rm /tmp/*.deb

# Copy startup script
COPY server.cfg /opt/casparcg/

COPY start.sh /start.sh
RUN chmod +x /start.sh

# Create required directories and user
RUN useradd -m -s /bin/bash casparcg

# Create X11 socket directory with proper permissions BEFORE switching user
RUN mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix

USER casparcg

EXPOSE 5250
CMD ["/start.sh"]

Have i completely misconfigured the system?

Thanks

There is a bunch of CEF related fixes and updates in the git master they should help with some of the CEF related junk. It might be worth having an agent analyze your issues against the code to see if anything still needs fixed.