Extract Boost, FFmpeg and CEF from the docker images via sudo ./tools/linux/extract-deps-from-docker. Alternatively these can be prepared manually by following the steps laid out in each Dockerfile
mkdir build && cd build
cmake ../src
make -j8
When we tried to run the build we got an error message.missing āErrNo.ā
We included the follwoing to resolve the error.
In Casparcg server master folder inside src>tools there is a bin2c.cpp file.There we have added
#include<errno.h>
From staging folder we were able to start CasparCG 2.2 linux server successfully
Hey @Syscaspar - thank you for putting this info up here. I have struggled with getting things working on Linux and the official documentation seems to be lacking a bit. (Iām looking at submitting some changes once Iāve got everything running correctly!)
A few questions, if you donāt mind:
Do you have any updates to this method or is this still working well for you?
Is this running on Ubuntu Desktop or Server?
Are you using this on a headless server or with a GUI/desktop on the Caspar box?
What have you been struggling with for building? Those steps work for me, but only on ubuntu18.04. On any other version or distro, āExtract Boost, FFmpeg and CEFā step has to be done differently.
Those steps are targetting Ubuntu desktop. Doing it on server should work too, but will likely need more dependencies installed. (Also expect it to install a lot more packages than those listed)
Thanks @Julusian, I am indeed trying to install and run on a headless server, running in AWS ec2. (A g3.4xlarge instance)
Running CGC results in
[0618/203706.396046:ERROR:browser_main_loop.cc(1653)] Unable to open X display.
Iām making some slow progress in understanding the issues Iām facing but youāll still need to bear with me! Here is what I know so far:
Xvfb doesnāt support hardware acceleration so itās no good as a dummy X server.
Maybe an X server (dummy or otherwise) isnāt necessary anymore as the Nvidia driver supports EGL, although exactly how Iām supposed to use the info in that blog post is way beyond me right now!
And so it looks like I might be able to somehow manually link CasparCG to the correct drivers and also to use an āOpenGL contextā, as per the Nvidia blog, but I will need a bit of help to join up those dots (if indeed that is the correct path to go down).
Xvfb doesnāt support hardware acceleration so itās no good as a dummy X server.
Ah. Itās been a while since I have tried any of this, so I was probably thinking of a 2.1 (cpu mixer) setup without a gpu then.
Maybe an X server (dummy or otherwise) isnāt necessary anymore as the Nvidia driver supports EGL
I looked into using EGL a while ago, but SFML which is used to get the OpenGL context only works with X11. I havent checked since then, so it might have changed in newer versions.
Hi @peedrr have you made any progress on the headless server?, Iām looking to do the same but on google cloudā¦ for now Iām stuck at the same point as you.
btw for me was a lot easier to install and build Casparcg using the Building inside Docker procedure and then just use ./tools/linux/extract-from-docker.
Not really, no. Iām hoping to take another bash at it one evening this week. Current thoughts are to implement VirtualGL as it seems to do whatās needed, plus it has a very short guide specifically for Nvidia Headless Servers which seems to fit the bill.
Iāll post my findings in here, but let me know if you get a chance to try this out before me. Would be good to pool our knowledge on here.
Iāve got to say, Iām slightly relieved to hear that Iām not alone in this struggle, although Iām finding it hard to believe that weāre trailblazers! Surely others in this community have already solved this problem. If anyone has any specific pointers, or knows of others who are running CasparCG headless on Linux, please shout! Iām keen to get a detailed how-to guide together.
@Julusian - has CPU Mixer development been abandoned? I always thought this sounded promising, especially for cloud stuff where GPU is still a bit of a novelty and often difficult to configure
VirtualGL looks interesting. Not 100% sure if it will just work though, as caspar expects an x server to get the opengl context from, so it might still require running one manually. But VirtualGL looks like it could still be useful to provide access to an xserver/opengl over ssh.
has CPU Mixer development been abandoned?
All I know is that it has been removed from 2.2 as it was a burden and to allow some abstractions to be removed.
Personally I agree that it has its uses. Cloud instances is a good example, or even caspar channels which dont need any compositing. (eg a channel being a simple html ā decklink)
I donāt fully understand but I was thinking the sameā¦ I did find this on StackOverflow about creating an OpenGL context without an X server.
NVIDIA recently published an article detailing how to use OpenGL on headless systems, which is a very similar use case as the question describes.
In summary:
Link to libOpenGL.so and libEGL.so instead of libGL.so. (Your linker options should therefore be -lOpenGL -lEGL
Call eglGetDisplay, then eglInitialize to initialize EGL.
Call eglChooseConfig with the config attribute EGL_SURFACE_TYPE followed with EGL_PBUFFER_BIT.
Call eglCreatePbufferSurface, then eglBindApi(EGL_OPENGL_API);, then eglCreateContext and eglMakeCurrent.
From that point on, do your OpenGL rendering as usual, and you can blit your pixel buffer surface wherever you like. This supplementary article from NVIDIA includes a basic example and an example for multiple GPUs. The PBuffer surface can also be replaced with a window surface or pixmap surface, according to the application needs.
The linked source URL (in my previous post) gives an example, the following snippet compiles an application with support for both EGL and GLX contexts.
Depends on what functionality you need.
Caspar currently has a hard dependency on a running X server because of the library used to setup OpenGL, but that can easily be replaced with EGL, a few messages back I linked to a very outdated branch where I was playing around with that. I think that would be a pretty easy port, so doing something like that is an option.
However, CEF/Chromium also requires a running X server. I did not look much into fixing that, and that is going to be a much more difficult task to fix. It might be possible with a recompilation of CEF. Ozone looks to be the required thing to configure Log in with Atlassian accounthttps://chromium.googlesource.com/chromium/src/+/master/docs/ozone_overview.md.
I didnāt have a need to run caspar on a headless machine, I was only experimenting so that is where I stopped.
I donāt fully understand but I was thinking the sameā¦
What I was trying to say is that Caspar needs an X server to setup OpenGL. But even with X running, it is not easily possible to run caspar over ssh, but VirtualGL looks like it might resolve that ssh problem.
Does anybody have any progress on the front of running CasparCG on a linux server?
I have one running VNC (for headless streaming with VLC) and tried running CasparCG, but I got the message that I do not have a GPU.
Iād love to look into some light use of Caspar for Video Mixing and Overlaying, with a maximum of 1080p (but even 720p would be fine with me).
Looking forward to hearing and learning more.
Hi trying to get going on Ubuntu 18.045 and CasparCG 2.2 as described in at the top of this post as I cannot find any other guide. Maybe I should be using a newer guide/ versions? If so, can someone please point me in the direction?
Followed the guide above, all looked good until the end, got these errors:
Hi, I would recommend building with Docker using this guide: server/BUILDING.md at master Ā· CasparCG/server Ā· GitHub If your situation requires building without the use of Docker, troubleshooting might take longer, but the problem that it is encountering according to the log you posted is likely missing libsnappy1v5 and libopencore-amrnb0. You can install them via apt.
You will be able to run the server using run.sh script in the folder you build it in. For build extracted from docker, it will be in casparcg_server subfolder.
Ok thank you. I went through everything from the GitHub you linked, seems to have made it a little furtherā¦
Error still seems to be looking for lopencore-amrnb
[ 99%] Building CXX object shell/CMakeFiles/casparcg.dir/linux_specific.cpp.o
[100%] Linking CXX executable casparcg
/usr/bin/ld: cannot find -lopencore-amrnb
collect2: error: ld returned 1 exit status
shell/CMakeFiles/casparcg.dir/build.make:183: recipe for target āshell/casparcgā failed
make[2]: *** [shell/casparcg] Error 1
CMakeFiles/Makefile2:808: recipe for target āshell/CMakeFiles/casparcg.dir/allā failed
make[1]: *** [shell/CMakeFiles/casparcg.dir/all] Error 2
Makefile:83: recipe for target āallā failed
make: *** [all] Error 2
I cannot find info on lopencore-amrnbā¦
Should I be looking for libopencore-amrnb0 and lopencore-amrnb is a typo or something?
If I do-
apt install libopencore-amrnb0
I get:
Reading package listsā¦ Done
Building dependency tree
Reading state informationā¦ Done
libopencore-amrnb0 is already the newest version (0.1.3-2.1).
libopencore-amrnb0 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 72 not upgraded.