Broadcasting
This document explains how to send the CBMKit character picture and sound to YouTube, Twitch, or CHZZK.
To install the plugin and the local AI, see GETTING_STARTED.md. To connect viewer live chat, see CHAT.md.
0. Set the run type to Broadcast
The features in this document work when the run type is Broadcast. Broadcast is the default.
| Method | Value |
|---|---|
| Editor menu | Tools > CBM > Broadcast (in the Run Type section). Saves only RunType to Config/DefaultGame.ini |
| Project Settings | Plugins > CBM > Services > Run Type = Broadcast |
| Command line | -CBMRunType=broadcast. Overrides the Project Settings value |
| While running | Console CBMKit.RunType broadcast, the Run Type switch in the Developer Panel or the OBS dock, or /api/runtype?value=broadcast |
What works in the Broadcast run type:
- Works: reactions to viewer live chat, Co-stream (main and guest characters), topic flow, OBS dock and overlays, Stream Deck commands, vision input from the game viewport, a monitor, or a window (section 2.8).
- Does not work: microphone voice input and the STT service (not loaded), webcam input.
- Memory file:
Saved/CBMKit/memory_broadcast.db.
For 1:1 conversation through a microphone, use the Companion run type. See COMPANION.md.
1. Overview
There are two ways to send the stream.
| Method | How it works | What to install | Use |
|---|---|---|---|
| OBS (recommended, default) | OBS Studio captures the UE window (Game Capture or Window Capture) and the UE process sound (Application Audio Capture) and sends the stream | OBS Studio (you install it) | Normal streams. Place chat, alerts, and overlays in the same OBS scene |
| Built-in ffmpeg (advanced, optional) | The CBMKitBroadcast module captures the UE back buffer and game audio and sends them to ffmpeg (NVENC) for RTMP/SRT output or a recording file |
ffmpeg.exe (you install it) | Streaming from UE without OBS, unattended recording, clean feed from a RenderTarget |
- The plugin package does not contain ffmpeg.exe.
- To use built-in ffmpeg output, install ffmpeg yourself and tell the plugin where it is (section 4.1). ffmpeg is LGPL/GPL software. If you redistribute ffmpeg to other people, you must follow its license terms (section 4.6).
- OBS output needs no plugin settings. The
CBMKitBroadcastmodule runs ffmpeg only when you runCBMBroadcast.Startor setbAutoStart = true. If you use only OBS, this module does nothing.
Not supported yet
The plugin does not have these features now:
- OBS WebSocket control (scene switching, start/stop streaming)
- Spout2 output
- NDI output
- Virtual camera output
2. OBS setup (recommended)
2.1 How to run UE
OBS captures the window that UE draws. If you capture the editor main window, the editor UI (Outliner, Details panel, and so on) goes into the stream. Run the game in a separate window that shows only the game.
| Run method | How | Executable shown in the window list |
|---|---|---|
| Packaged game (recommended for streams) | <YourProject>.exe -windowed -ResX=1920 -ResY=1080 |
<YourProject>.exe (Shipping build: <YourProject>-Win64-Shipping.exe) |
| Editor Standalone | Toolbar ⋮ next to Play > Standalone Game, or command line UnrealEditor.exe <path>\<YourProject>.uproject -game -windowed -ResX=1920 -ResY=1080 |
UnrealEditor.exe |
| Editor PIE in a new window | Toolbar ⋮ next to Play > New Editor Window (PIE) |
UnrealEditor.exe (same process as the editor main window) |
To fix the resolution at 1920x1080:
- Add the command line arguments
-windowed -ResX=1920 -ResY=1080. For a packaged game, add them to the end of the shortcut's Target field. - While running, type
r.SetRes 1920x1080win the console (~). Thewat the end means windowed mode. - For Standalone and PIE in a new window, set Editor Preferences > Level Editor > Play > Play in New Window > New Window Size to 1920 x 1080.
- Set the OBS canvas (section 2.5) to 1920x1080 as well. Then the picture goes in 1:1 with no scaling. On a 1920x1080 monitor the window border makes the window larger than the screen. In that case, scale the source in OBS or use a 1440p or larger monitor.
Behavior when the window loses focus:
- Sound: The engine default (
[Audio] UnfocusedVolumeMultiplier=0.0inBaseEngine.ini) sets game sound to 0 when the window loses focus. When you click OBS or a chat window, the character voice disappears from the stream. Add this to your project'sConfig/DefaultEngine.ini:ini [Audio] UnfocusedVolumeMultiplier=1.0 - Frame rate: PIE runs inside the editor. If Editor Preferences > General > Performance > Use Less CPU when in Background is on, the frame rate drops when the editor is in the background. Turn this option off, or run a packaged game or Standalone.
2.2 Video capture: Game Capture or Window Capture
In OBS, add Sources > + > Game Capture or Window Capture.
| Source | Settings | When to use |
|---|---|---|
| Game Capture (try first) | Mode: Capture specific window > Window: the [<YourProject>.exe] or [UnrealEditor.exe] entry |
UE renders with D3D12, and Game Capture supports D3D12. The capture works even when other windows cover the UE window |
| Window Capture (when Game Capture is black) | Window: the UE window > Capture Method: Windows 10 (1903 and up) | Uses Windows Graphics Capture (WGC). Not affected by admin rights or hook problems. Turn off Capture Cursor |
For both: if you minimize the UE window, the picture freezes or turns black. Putting it behind other windows is fine.
Fixing a black screen
- Match privileges: If UE (or the editor) runs as administrator, run OBS as administrator too. With different privileges, Game Capture cannot attach to the UE process. Running both as a normal user is recommended.
- Match the GPU (laptops and PCs with integrated + dedicated GPU): In Windows Settings > System > Display > Graphics, set both
obs64.exeand the UE executable to High performance (dedicated GPU). If OBS and UE run on different GPUs, the picture is black. - Switch to Window Capture: If the two steps above do not help, use Window Capture with Capture Method Windows 10 (1903 and up) (WGC).
- Turn the Game Capture option Use anti-cheat compatibility hook on and off and check each.
- In the OBS log (Help > Log Files > View Current Log), check the errors on the
game-capturelines.
2.3 Audio: capture only the UE sound
The character TTS voice plays inside UE. Capture only the UE process sound in OBS.
- In OBS, add Sources >
+> Application Audio Capture (BETA) > Window: the UE window ([<YourProject>.exe]or[UnrealEditor.exe]). - Requires OBS 28 or later and Windows 10 2004 (build 19041) or later.
- If Desktop Audio is also on, the UE sound goes in twice. Set Settings > Audio > Global Audio Devices > Desktop Audio to Disabled, or mute Desktop Audio in the Audio Mixer. For sound from other programs (for example, browser alerts), add one Application Audio Capture source per program.
- On Windows older than 10 2004, Application Audio Capture is not available. Use Desktop Audio and mute the programs that must not go into the stream.
In the Broadcast run type, CBMKit does not open the microphone. To put a human voice in the stream, add the microphone in OBS with Sources > + > Audio Input Capture. This sound is not sent to the characters.
Lip-sync offset
Mouth shapes and the TTS voice are driven by the same audio inside UE, so they match on the UE screen. If they do not match in OBS, the video capture and the audio capture have different delays.
- In OBS, open Audio Mixer >
⋮(or gear) on the UE audio source > Advanced Audio Properties. - Change the Sync Offset (ms) of that source. A positive value delays the sound. If the sound comes before the mouth shape, try values from +30 to +100 ms.
- Record about 10 seconds with OBS Start Recording and play it back to check. This is more accurate than the stream preview.
- If the picture comes before the sound (rare), add Filters > Render Delay to the UE capture source.
2.4 Transparent background (chroma key)
OBS Game Capture and Window Capture do not receive the alpha channel of the UE picture. To place the character over another background, make the UE background a solid color and remove it in OBS with a chroma key.
The sample map /CBMKit/Samples/Maps/CBM_BroadCastLevel is a furnished room. It does not have a solid-color background. Add one yourself:
- Create a material: Content Browser > Material (for example
M_ChromaGreen) > Details > Shading Model: Unlit > connect a Constant3Vector(0, 1, 0)to Emissive Color. - Place a background plane: Place Actors > Shapes > Plane (or Cube). Stand it behind the character so that it covers the whole view of the level's camera, and assign the material. If the floor or other meshes show in the camera view, assign the same material to them or hide them.
- In the background plane's Details, turn off Cast Shadow so the plane does not cast shadows on the character. An Unlit material does not receive light, so the character's shadow does not appear on the background.
- If an
ExponentialHeightFogactor changes the background color, hide or delete the fog actor. - Turn off Project Settings > Rendering > Auto Exposure, or fix exposure in a PostProcess Volume. Otherwise exposure changes change the background color.
- In OBS: UE capture source > Filters >
+> Chroma Key > Key Color Type: Green. Because of the tone mapper, the green on screen can differ from(0, 255, 0). If green remains, set Key Color Type to Custom Color, pick the actual background color on screen, and adjust Similarity, Smoothness, and Key Color Spill Reduction. - If the character's clothes or hair contain green, use blue
(0, 0, 1).
2.5 Encoder (NVENC recommended)
OBS Settings > Output > Output Mode: Advanced > Streaming tab:
| Item | Recommended value | Note |
|---|---|---|
| Video Encoder | NVIDIA NVENC H.264 | NVENC is separate encoding hardware inside the GPU. It does not compete much with UE rendering and local AI work. Do not use x264 (CPU) |
| Rate Control | CBR | |
| Bitrate | 6000 Kbps | For 1080p30. For 1080p60 use 6000 to 8000 Kbps. For a normal Twitch account, 6000 Kbps or lower is safe |
| Keyframe Interval | 2 s | Recommended by YouTube, Twitch, and CHZZK |
| Preset | P4 to P5 | A higher number gives better quality and more GPU encoder load |
| Tuning | High Quality | |
| Multipass Mode | Two Passes (Quarter Resolution) | |
| Profile | high |
Settings > Video: Base (Canvas) Resolution 1920x1080, Output (Scaled) Resolution 1920x1080, FPS 30 (or 60). Settings > Output > Audio tab: Audio Bitrate 160. Settings > Audio > Sample Rate: 48 kHz.
If you do not need 60 fps, use 30 fps. This lowers UE rendering, OBS compositing, and encoding load.
2.6 Stream keys
OBS Settings > Stream:
| Platform | Service | Server | Stream key |
|---|---|---|---|
| YouTube | Select YouTube from the list | Use the default | Connect Account, or the stream key in YouTube Studio > Go live |
| Twitch | Select Twitch from the list | Auto or a nearby region | Connect Account, or the Primary Stream key in Twitch Creator Dashboard > Settings > Stream |
| CHZZK | Custom... if it is not in the list | Copy the Stream URL from CHZZK Studio > broadcast settings exactly | The Stream Key on the same screen |
rtmp://global-rtmp.lip2.navercorp.com:8080/relayis often used as the CHZZK RTMP address, but no official document confirms it. Always use the value that CHZZK Studio shows.- A stream key works like a password. Do not show the OBS settings window in a screen share or on stream.
2.7 Control dock and overlays (CBM web control)
When the game runs (packaged game, Standalone, or PIE), CBMKit opens a web server that only this PC can reach. The OBS dock, OBS browser sources, and Stream Deck all connect to this server.
| Item | Value |
|---|---|
| Address | http://127.0.0.1:18050. Other PCs cannot open it |
| Connections page | http://127.0.0.1:18050/home. Lists all addresses below and the Stream Deck commands |
| Settings | Project Settings > Plugins > CBM > Operator: Enable Control Server (default on), Control Port (default 18050), Control Token (default empty). Applied when the game starts |
| Page files | <LocalAIRoot>/frontend/web/*.html. If you edit a file, reload the page. No rebuild is needed |
<LocalAIRoot> is the LocalAIRoot value in Project Settings > Plugins > CBM > Services. When it is empty, it is <Plugin>/ThirdParty/LocalAI. When the plugin is installed in the engine (Fab), the editor uses %LOCALAPPDATA%/CBMKit/LocalAI.
If Control Token has a value, add ?token=<value> to every address (&token=<value> if the address already has ?). Programs can also send the token in the X-CBM-Token header. A wrong token returns error 401.
2.7.0 Operator Panel (Unreal window)
The Operator Panel is an Unreal window for the operator during a stream. The window title is CBM Operator Panel.
- Open it with Tools > CBM > Operator Panel (visible only in the Broadcast run type) or the console command
CBMKit.Operator. - It opens automatically when the game starts in the Broadcast run type and when the run type changes to Broadcast. To stop this, turn off
Open Operator Panelin Project Settings > Plugins > CBM > Operator. - If you open it in the Companion run type, it shows only the line "The Operator Panel is used in the Broadcast run type." and the Open Developer Panel button.
| Section | Function |
|---|---|
| Status | State of the language model, speech synthesis, and connected chat platforms. The line below shows the vision input source |
| OBS / Stream Deck Connection | Web control server address. Open in Browser opens the connections page. When the server is off, it shows Off (Project Settings → CBM → Enable Control Server) |
| Controls | Turn state and pending input count, Stop Speaking, Clear Queue, Idle Talk and Co-stream on/off |
| Characters | Per-character status values -/+, current emotion, emotion selection with Expression and Motion, Mode selection |
| Input | Target (Auto or a character), Send as Instruction. Enter also sends as an instruction |
| Topic | Start a topic (topic field + scenario + Start), Next Step, Stop, viewer topic suggestions |
| Pending Inputs | Up to 8 inputs in the queue |
| Recent Turns | The last 8 turns: input, answering character, response time |
Metrics (response time, sync rate, uptime), the conversation log (prompts per turn), STT state, vision input selection, and the run type switch are in the Developer Panel. Open it with Tools > CBM > Developer Panel or the console command CBMKit.DevPanel. The window title is CBM Developer Panel. It opens in both run types and does not open automatically.
2.7.1 OBS dock (stream control)
- In OBS, select Docks > Custom Browser Docks.
- Enter dock name
CBMand URLhttp://127.0.0.1:18050/dock, then click Apply. - Attach the new dock to an edge of the OBS window. The dock is designed for a width of 300 to 500 px.
Dock sections:
| Section | Function |
|---|---|
| Top | Run type switch (Companion / Broadcast), state (Loading services / Generating reply / Speaking / Waiting), queued input count, Stop Speaking, Clear Queue, Idle Talk and Co-stream on/off (a button that is on is green) |
| Now Speaking | The sentence that is playing now and the speaking character |
| Topic | Start a topic (topic field + scenario + Start), Next Step, Stop, current step and turn count. The chips below are viewer topic suggestions (Viewer Topic Suggestions). Click a chip to put it into the topic field. Clear Suggestions removes them |
| Send | An instruction for the characters. Select the answering character in the target list (Auto or a character), then Send as Instruction. The Broadcast run type has no microphone input |
| Characters | Per character: emotion, mode, Expression and Motion buttons, status values (for example mood) -/+ |
| Recent Turns | Character replies of the last 5 turns |
The vision input selection at the top (Vision Input: None / Game Viewport / Monitor / Window) is shown in the Broadcast run type. If you switch to Companion, only the run type switch and the line "In Companion, use the settings window in the Game Viewport (gear button, F10)." remain. The dock reads the state every 0.5 seconds. If the game is not running, the dock shows Game is not running. When the game starts again, the dock reconnects without any action in OBS.
2.7.2 Overlays (browser sources)
Add them in OBS with Sources > + > Browser. All overlays have a transparent background, so keep the OBS default Custom CSS (background-color: rgba(0, 0, 0, 0)). Turn off Shutdown source when not visible.
| Overlay | URL | Width x Height | Visible when |
|---|---|---|---|
| Subtitle | http://127.0.0.1:18050/overlay/subtitle |
Same as canvas (1920 x 1080) | While a character speaks. Disappears hold seconds after speech ends |
| Topic | http://127.0.0.1:18050/overlay/topic |
700 x 200 | While a topic is in progress. Disappears when it ends |
| Voice input | http://127.0.0.1:18050/overlay/voice |
Same as canvas (1920 x 1080) | For hold seconds after microphone speech is recognized. Shows the recognized sentence as is. Microphone input exists only in the Companion run type, so in Broadcast this overlay stays empty |
Values to add after the address (join several with &):
| Overlay | Value | Default | Meaning |
|---|---|---|---|
| Subtitle | size |
36 | Font size (px) |
| Subtitle | color |
%23ffffff |
Text color. Write # as %23 |
| Subtitle | outline |
%23000000 |
Outline color |
| Subtitle | name=0 |
(name shown) | Hide the character name |
| Subtitle | hold |
1.5 | Seconds to keep the text after speech ends |
| Subtitle | align |
center |
left, center, right |
| Topic | size |
28 | Font size (px) |
| Topic | label |
(none) | Small text above the topic. Example: label=Today's%20topic |
| Topic | step=0 |
(step shown) | Hide the step line |
| Voice input | size |
36 | Font size (px) |
| Voice input | color |
%23b0e7ff |
Text color |
| Voice input | outline |
%23000000 |
Outline color |
| Voice input | label |
(none) | Small name above the sentence. When empty, the Companion user name is used. When that is also empty, You |
| Voice input | name=0 |
(name shown) | Hide the name line |
| Voice input | hold |
6 | Seconds to show the text after recognition |
| Voice input | align |
left |
left, center, right |
Example: http://127.0.0.1:18050/overlay/subtitle?size=44&hold=2&color=%23ffe066
Order the OBS source list from the top as Subtitle > Voice input > Topic > UE capture. A source higher in the list is drawn in front.
Subtitles appear only while TTS audio plays. If the TTS service is off and characters answer with text only, no subtitle appears.
2.7.3 Stream Deck buttons
In Stream Deck, put the address in the Website action and turn on GET request in background. The button then sends the command without opening a browser. Hotkey tools and other programs can call the same addresses with GET or POST (JSON body). In an address, + is read as a space. To send a literal +, use POST with a JSON body.
| Address | Action |
|---|---|
/api/stop |
Stop speaking |
/api/clear |
Clear the queue |
/api/idle, /api/room |
Idle Talk / Co-stream on or off. ?on=1 or ?on=0. Toggles when omitted |
/api/say?text=hello |
Send as an instruction (empty as = as=system). as=chat sends it as chat (author=<nickname>). character=<answering character>. as=manager returns an error in Broadcast |
/api/topic/start?topic=dinner tonight |
Start a topic. Set a scenario with scenario=debate |
/api/topic/next, /api/topic/stop |
Next step / stop the topic |
/api/topic/clear-suggestions |
Clear viewer topic suggestions |
/api/emotion?character=<name>&emotion=happy |
Change the expression. motion=1 also plays the motion |
/api/state?character=<name>&state=mood&delta=10 |
Add to a status value. value=70 sets it to that value |
/api/action?character=<name>&action=wave |
Trigger a character action event (OnCharacterAction) |
/api/event?name=door opened&detail= |
Tell the characters about a game event |
/api/mode?mode=singing |
Change the broadcast mode. Empty = the mode in the character definition |
/api/world?world=virtual_station |
Change the world setting. Empty = the world in the character definition |
/api/runtype?value=companion |
Change the run type. value is companion or broadcast. Empty = switch to the other one |
/api/vision?value=desktop |
Change the vision input: none, viewport, desktop, window. webcam returns an error in Broadcast |
/api/status |
Current state as JSON, including runType (companion/broadcast) and vision (the value names above) |
For character, use the CharacterId from the character definition or the name shown on screen. When empty, the character that is speaking now is used. Every command returns {"ok":true} or {"ok":false,"error":"..."}. For character definitions, modes, worlds, emotions, and status values, see CHARACTERS.md.
In the Broadcast run type, /api/mic, /api/ptt, and /api/username return {"ok":false,"error":"companion only"}. In the Companion run type, /api/room, /api/topic/..., and as=chat on say return "broadcast only".
2.7.4 Topic flow during a stream
- Prepare a scenario before the stream (optional). Open Tools > CBM > Prompt Editor…, select one in the Scenarios group, or create one with Add Scenario. Scenario files are
<LocalAIRoot>/prompts/<language>/scenarios/<name>.txt. - During the stream, type a topic in the dock's topic field, select a scenario, and click Start. Without a scenario (Default Flow), the flow is introduction > talking points > wrap-up (
system/topic_default.txt). - The characters speak for the set number of turns in each step, then go to the next step. Chat is still handled first. To skip ahead, click Next Step. To end, click Stop.
- When a viewer writes chat such as
!topic cats, the characters do not answer it. It goes into the suggestion chips in the dock. Click a chip only when you accept it. Change the prefixes withTopic Suggest Prefixin Project Settings > Plugins > CBM > Topic (default!topic, !주제; separate several with commas). - Put the topic overlay (section 2.7.2) in the scene to show the current topic and step on stream.
Topic Planner (default on) uses the same LLM as the conversation to split a topic into talking points and to summarize each step. With the local model on the rtx5070 profile, planning for a 5-step, 14-turn topic took about 11 seconds in total (TTS playback time not included).
2.8 Vision input (optional)
To let the characters see the screen and talk about it, set Vision Source in Project Settings > Plugins > CBM > Vision to Game Viewport, Desktop, or Window. The Broadcast run type cannot use Webcam. While running, change it with /api/vision?value=... or the vision input selection in the dock.
This needs the image input model (mmproj). Open Tools > CBM > Install/Repair Local AI…, check Image Input (VLM) Model, and click Install. The other Vision settings are the same as in COMPANION.md. In Broadcast, these apply: Vision On Chat (attach an image to chat turns, default off) and Vision On Idle Talk (attach an image to Idle Talk turns, default on).
3. GPU / VRAM
VRAM use when UE, the local AI, and OBS run together on one PC with an RTX 5070 12 GB (recommended minimum):
| Item | VRAM | Note |
|---|---|---|
| Local AI (rtx5070 profile: Gemma 4 E4B + ZONOS3-Mini TTS, with image input) | About 7.0 GB | The Broadcast run type does not load STT (whisper), so it uses less than this |
| Total with UE 1080p + NVENC encoding | About 9.5 GB of 12 GB | |
| OBS (capture + scene compositing) | Not measured | Grows with the number of scene sources (browser sources, images, and so on) |
- About 2.5 GB remains free. Each OBS browser source (chat, alerts) adds VRAM. Before going live, check that Task Manager > Performance > GPU > Dedicated GPU memory stays below 12 GB.
- The rtx4090 profile (24 GB cards) uses about 11 GB for the AI. If OBS or other programs use VRAM and memory runs short, install the smaller profile: Tools > CBM > Install/Repair Local AI… > Profile =
rtx5070. - Tools > CBM > Run TTS on GPU off moves TTS to the CPU and frees about 1.3 GB of VRAM. The first voice then plays later.
- NVENC is separate hardware, so encoding itself does not compete much with CUDA/Vulkan work. OBS scene compositing and scaling use the 3D engine. Keep the canvas and the UE window at the same resolution (1920x1080) so there is no scaling.
- Do not run OBS output and built-in ffmpeg output at the same time. This uses NVENC sessions and VRAM twice.
4. Advanced: built-in ffmpeg output (CBMKitBroadcast)
Without OBS, the UE app encodes its rendered picture and game audio with ffmpeg (NVENC) on the same PC, and sends them over RTMP/SRT or records them to a file.
4.1 Install ffmpeg (you install it)
The plugin package does not contain ffmpeg.exe. Install it in one of these ways:
- With setup.ps1: Tools > CBM > Install/Repair Local AI… runs
<LocalAIRoot>/setup/setup.ps1. Unless you run it with-SkipFfmpeg, it downloads the BtbN FFmpeg-Builds LGPL-3.0 shared build (n8.1,win64-lgpl-shared) to<LocalAIRoot>/runtime/ffmpeg/on your PC, together withLICENSE.txt. After the install it checks thath264_nvencis available. This build has no GPL components (libx264, x265, and so on). - Manual download: Download a Windows build listed on the ffmpeg website (gyan.dev, BtbN, and others), extract it to any folder, and set
Ffmpeg Path(below). NVENC needs a build that supports your NVIDIA driver.
The plugin looks for ffmpeg.exe in this order:
- Project Settings > Plugins > CBM Broadcast > Ffmpeg Path (a relative path resolves against the project folder)
<LocalAIRoot>/runtime/ffmpeg/ffmpeg.exe, then<LocalAIRoot>/runtime/ffmpeg/bin/ffmpeg.exeffmpeg.exeon thePATHenvironment variable
If none is found, CBMBroadcast.Start fails with ffmpeg.exe not found (FfmpegPath setting, <LocalAIRoot>/runtime/ffmpeg/ffmpeg.exe, PATH).
4.2 Quick start
- Install ffmpeg (section 4.1).
- Enter
Output UrlandStream Keyin Project Settings > Plugins > CBM Broadcast. IfOutput Urlis empty, the plugin records toSaved/Recordings/CBM_<time>.mkv. - Start the game and type in the console (
~): CBMBroadcast.Start. To set the URL for this run only:CBMBroadcast.Start rtmp://...orCBMBroadcast.Start D:/rec/test.mkvCBMBroadcast.Stats: sent, duplicated, and dropped frames, ffmpeg fps, bitrate, and speedCBMBroadcast.Stop- Blueprint:
CBM Broadcast Subsystem>StartBroadcast,StopBroadcast,IsBroadcasting,GetState,GetStats,SetCaptureRenderTarget, eventsOnBroadcastStateChangedandOnBroadcastError. - With
bAutoStart = true, output starts as soon as the game viewport exists.
ffmpeg log: Saved/Logs/CBMBroadcast_ffmpeg.log (includes the full command line).
DefaultGame.ini example
[/Script/CBMKitBroadcast.CBMBroadcastSettings]
FfmpegPath=(FilePath="C:/Tools/ffmpeg/bin/ffmpeg.exe")
OutputUrl=rtmp://a.rtmp.youtube.com/live2
StreamKey=xxxx-xxxx-xxxx-xxxx
Width=1920
Height=1080
Fps=30
VideoBitrateKbps=6000
Encoder=h264_nvenc
FallbackEncoder=libx264
NvencPreset=p4
NvencTune=ll
KeyframeIntervalSeconds=2
AudioBitrateKbps=160
AudioSampleRate=48000
CaptureSource=GameViewport
bIncludeUI=True
bAutoStart=False
A stream key works like a password. Do not put it in DefaultGame.ini if that file goes into version control. Put it in the per-user Saved/Config/Windows/Game.ini (editor: Saved/Config/WindowsEditor/Game.ini), or pass it on the command line:
-ini:Game:[/Script/CBMKitBroadcast.CBMBroadcastSettings]:StreamKey=xxxx
Encoder fallback (LGPL build)
Hardware encoders (h264_nvenc and other nvenc, _amf, _qsv encoders) are tested briefly in the background before start. If the test fails, output starts with FallbackEncoder (default libx264). The LGPL build from setup.ps1 has no libx264, so on a PC without NVENC the fallback also fails. In that case, list the encoders in that build with ffmpeg -hide_banner -encoders and set FallbackEncoder to one of them, or install a GPL build that has libx264 yourself (redistributing a GPL build brings GPL obligations).
4.3 RTMP addresses by platform
| Platform | Output Url | Note |
|---|---|---|
| YouTube | rtmp://a.rtmp.youtube.com/live2 |
Key in YouTube Studio > Go live. Backup: rtmp://b.rtmp.youtube.com/live2?backup=1 |
| Twitch | rtmp://live.twitch.tv/app |
For regional servers see https://help.twitch.tv/s/twitch-ingest-recommendation (for example rtmp://seo.contribute.live-video.net/app) |
| CHZZK | rtmp://global-rtmp.lip2.navercorp.com:8080/relay |
Often used, but no official document confirms it. Copy the Stream URL from CHZZK Studio > broadcast settings exactly. |
| SRT server | srt://host:port?streamid=... |
Sent as mpegts |
- When
Stream Keyis set, the plugin appends/<key>tortmp(s)://...URLs. If the key is already in the URL, leaveStream Keyempty. - Recommended: 1080p30 at 6000 kbps or 1080p60 at 6000 to 8000 kbps, keyframe every 2 seconds, AAC 160k 48 kHz. This range works for YouTube, Twitch, and CHZZK. For a normal Twitch account, staying at or below 6000 kbps is safe.
4.4 Local tests
Recording test:
CBMBroadcast.Start Recordings/test.mkv
... wait 10 seconds
CBMBroadcast.Stop
ffprobe -hide_banner Saved/Recordings/test.mkv
Use .mkv or .flv. An .mp4 file is playable only if ffmpeg exits normally (CBMBroadcast.Stop). If the process is killed, the moov atom is missing. Relative paths resolve against Saved/.
Local RTMP receive test (ffmpeg receives, no server needed):
ffmpeg -listen 1 -i rtmp://127.0.0.1:1935/live/test -c copy received.flv
Then in UE: CBMBroadcast.Start rtmp://127.0.0.1:1935/live/test. To watch directly:
ffplay -listen 1 -fflags nobuffer rtmp://127.0.0.1:1935/live/test
SRT: ffplay "srt://127.0.0.1:9000?mode=listener" and CBMBroadcast.Start srt://127.0.0.1:9000.
(ffprobe and ffplay are in the bin folder of the build that setup.ps1 downloads.)
4.5 How it works
The module copies the back buffer (or a RenderTarget) on the render thread, scales it to the output size on the GPU, and reads it back asynchronously, so the game thread does not wait. A writer thread sends one frame to ffmpeg every 1/fps seconds by wall clock. If no new frame is ready, it repeats the previous frame. Game audio is taken from the main submix, converted to 48 kHz stereo, and sent to ffmpeg through a named pipe with the same wall clock, so audio and video stay in sync. ffmpeg runs in a Windows Job Object, so it does not keep running if UE exits.
- Pixel format:
B8G8R8A8,R8G8B8A8, andA2B10G10R10(10-bit) back buffers are converted to 8-bit on the GPU. HDR output (scRGB/PQ) is not supported. - Encoder lag: If the encoder cannot keep up with real time, frames are dropped and the lag in
CBMBroadcast.Statsgrows. OnlyStopwaits for ffmpeg to exit, for up toStop Timeout Seconds. - Clean feed without UI: Set
Capture SourcetoRender Target (clean feed)and assign theUTextureRenderTarget2Dthat a SceneCapture2D draws to (RTF_RGBA8; Capture Source = Final Color (LDR) in RGB recommended). At runtime, change it withSetCaptureRenderTarget.bIncludeUI=falsewithGame Viewport (backbuffer)works only when the viewport renders to a separate target (PIE). Otherwise the plugin logs a warning and captures the back buffer with UI. - In PIE,
Game Viewport (backbuffer)captures the whole window that holds the game viewport. In the editor main window this includes the editor UI. For real streams, run Standalone (-game) or New Editor Window (PIE).
Performance notes (with LLM, STT, and TTS running)
- GPU: one scaling draw and an 8 MB copy (1080p) per frame. NVENC is a separate hardware unit and does not compete much with CUDA/Vulkan work. About 0.3 GB VRAM.
- CPU: at 1080p30, about 250 MB/s of readback copy plus pipe writes. The libx264 fallback uses a lot of CPU, so check in the log that output started with NVENC.
- If you do not need 60 fps, 30 fps halves GPU load and bandwidth.
4.6 ffmpeg license (LGPL)
- The BtbN
win64-lgpl-sharedbuild that setup.ps1 downloads is LGPL-3.0 (--enable-version3, no GPL or nonfree components). The plugin does not link ffmpeg. It runs ffmpeg as a separate process. - Downloading and using it on your own PC needs no notice.
- If you redistribute ffmpeg to other people (for example, in your packaged game folder, or in an offline bundle made with
setup/make_bundle.ps1that includesruntime/ffmpeg), do the following: - Include
runtime/ffmpeg/LICENSE.txt. - State where the source is: ffmpeg.org, github.com/BtbN/FFmpeg-Builds.
- Ship the shared build (DLLs) as is, so users can replace the DLLs.
- Redistributing a GPL build (with libx264) brings GPL-3.0 notice and source obligations.
- The Fab package does not include ffmpeg.
5. Troubleshooting
| Symptom | Cause / check | Fix |
|---|---|---|
| OBS Game Capture is black | Different privileges, OBS and UE on different GPUs, UE window minimized | Section 2.2 "Fixing a black screen". Last resort: Window Capture with Windows 10 (1903 and up) |
| Editor UI shows in the OBS preview | The editor main window is captured | Run Standalone Game, New Editor Window (PIE), or a packaged game (section 2.1) |
| The character voice disappears when you click OBS or a chat window | Engine default UnfocusedVolumeMultiplier=0.0 |
Add UnfocusedVolumeMultiplier=1.0 under [Audio] in your project's Config/DefaultEngine.ini (section 2.1) |
| The character voice plays twice / echo | Application Audio Capture and Desktop Audio are both on | Disable Desktop Audio (section 2.3) |
/api/mic returns companion only |
The run type is Broadcast | Microphone input is Companion only. The dock has no microphone button. See COMPANION.md |
| No "Application Audio Capture" source in the list | OBS older than 28 or Windows older than 10 2004 | Update OBS and Windows. If not possible, use Desktop Audio |
| Mouth and sound do not match (OBS) | Different delays of video capture and audio capture | Advanced Audio Properties > Sync Offset, check with a recording (section 2.3) |
| Green remains at the character's edges after chroma key | Tone mapping changes the background color, green reflections on the character | Custom key color + Key Color Spill Reduction, or a blue background (section 2.4) |
| Frame drops / slow AI replies during a stream | Not enough VRAM (12 GB card) | Check Dedicated GPU memory in Task Manager, use fewer OBS browser sources, use 30 fps (section 3) |
| OBS stats show "Encoding overloaded" | NVENC preset too high, or x264 in use | Encoder NVENC H.264, preset P4 (section 2.5) |
CBMBroadcast.Start > ffmpeg.exe not found |
ffmpeg not installed or path not set | Install it (section 4.1) and set Ffmpeg Path |
Encoder h264_nvenc unavailable, falling back to libx264, then failure |
No NVIDIA GPU or driver, and the LGPL build has no libx264 | List encoders with ffmpeg -hide_banner -encoders and set FallbackEncoder (section 4.2) |
| Built-in output stutters or the lag in Stats keeps growing | The encoder cannot keep up with real time | Check speed= in Saved/Logs/CBMBroadcast_ffmpeg.log (below 1.0x is too slow). Use Fps 30 and a lower bitrate |
An .mp4 recording does not play |
UE exited without Stop, so the moov atom is missing | Use .mkv or .flv |
| CHZZK output does not connect | The RTMP address is different | Copy the Stream URL and Stream Key from CHZZK Studio exactly |
The dock shows Game is not running |
The game is not running, or Enable Control Server is off |
Start the game and check the address in the OBS / Stream Deck Connection line of the Operator Panel (section 2.7) |
The dock or an overlay shows Token does not match, or error 401 |
Control Token is set |
Add ?token=<value> to the address (section 2.7) |
Control server could not bind 127.0.0.1:18050 in the Output Log |
Another program or a second game window uses the same port | Close the other game window, or change Control Port and the OBS addresses together |
| The subtitle overlay is empty | TTS is off and characters answer with text only, or the browser source was shut down while hidden | Check the TTS service state, turn off Shutdown source when not visible on the browser source |