I’m experimenting with HTML5 graphics in CasparCG and wondered about audio support.
Right now it seems that any sound played inside an HTML template isn’t passed into the main CasparCG audio mix. It just plays locally on the system, not out through DeckLink SDI.
Is that correct?
And if so, is there any plan for HTML audio to be routed through the CasparCG mixer and embedded into the SDI output in future versions?
(I see that there is an old post from 2019 about this - but that is 6 years ago )
The trick is, to route the system audio to the Decklink. You need to make sure, that no system sounds occure (silent theme in Windows) so that you don’t hear any plings on your video
But a better solution would make sense. Have you already posted an issue on GitHub?
The workaround method noted by @didikunz has a major advantage it can play dynamically loaded audio through to a computer output.
There is a slightly clunky method that works for a limited set of applications. This solution passes the audio through the CasparCG audio mixing and hence into the SDI output. However, the method only works if the audio content is already available as a file that CasparCG can play (wav, mp3 etc).
The audio files are saved in the CasparCG media store. The template has to "know” the file names and it asks CasparCG to play the file using middleware to issue an AMCP PLAY command to the server. The middleware can be a simple node.js application that sets up a websocket. The template sends a request to the websocket, passing it the name of the file to play. The node application runs in the background on the CasparCG server machine, using localhost to send AMCP command(s) to the server. If the audio plays overlap the command to the websock has to include the channel and layer to use for the named audio.
Somewhere I have an example node application and I am happy to share the code. I think it was less than 200 lines so it may be possible to include inline in this thread.
There is active work being done regarding this. There is a way to hook into the HTML producer to get audio chunk from cef. There is actually a PR ( feat/cef audio v2 by niklaspandersson · Pull Request #1590 · CasparCG/server · GitHub ) where me and Julian have experimented with how to get this working. The current state is that it seems to work on Linux now (with limited testing). On windows the first (few) packet(s) “escapes” to system audio before the capture kicks in. After that it seems to work (agan, with limited testing).
There is only support for “simple” framerates, like 30, 50 60 fps. 59.94 for example is not supported yet. Any help we can get testing this is greatly appreciated.