Hi,
I would like to share my experience with regards to multi GPU offload:
- For encoding, it can be done adding “gpu” parameter for the video stream to the encoder of the ffmpeg_consumer.cpp
av_opt_set(enc.get()->priv_data, "gpu", gpu_spec.c_str(), 0);
- For mixing, the solution is a combination of system configuration and code changes.
- System configuration: As the opengl context via X11 is needed for mixing, in order to be able to choose the GPU on which the mixing should be done we need in linux so called “multi-seat” configuration, for simplicity we assume that we have two GPUs on which we want to do mixing, so it can be summarized as follows:
- By default the system has (Seat0) with two GPUs in it
- Create Seat1 with one GPU with its corresponding framebuffer
- Configure display manager to start two X servers with two seats
- Code change: x11_util.cpp: Change the code from
Display* disp = XOpenDisplay(nullptr);
to
Display* disp = XOpenDisplay( "localhost:x.y");
where x is the device and y is the screen, i.e. if we want to access the framebuffer of second X server we started we can use localhost:1.0 and all this to be configurable.
As a result of all above, a multi GPU offload for encoding and mixing is done, on dual-core system for CasparCG server, both from docker and standalone.
Thanks to @Julusian for the guidelines!
Hope this will help to somebody!