>CasparCG Setup
[[Documentation/Server/Overview|SPX Graphics Controller]] can integrate with CasparCG Server for professional broadcast playout. This guide covers configuring CasparCG servers in SPX.
---
## Prerequisites
> [!warning] If SPX is used with CasparCG, version 2.4.0 Stable is recommended. See [CasparCG Releases](https://github.com/CasparCG/server/releases).
## Adding CasparCG Servers
Starting from v1.0.12, SPX does not have a CasparCG server assigned by default in the [[Documentation/Server/Configurations|configuration]].
### Via Web Interface
1. Go to **Configuration** page
2. Scroll down to **CasparCG servers** section
3. Click **Add Server** or use the **[ + ]** button
4. Enter server details:
- **Name**: Server identifier (e.g., `OVERLAY`)
- **Host**: IP address or `localhost`
- **Port**: CasparCG port (default: `5250`)
5. Click **Save** at the bottom of the page
6. An empty line will appear to add another server
### Via Configuration File
Edit [[Documentation/Server/Configurations|config.json]] directly:
```json
{
"casparcg": {
"servers": [
{
"name": "OVERLAY",
"host": "localhost",
"port": "5250"
},
{
"name": "VIDEOWALL",
"host": "128.120.110.1",
"port": "5250"
}
]
}
}
```
## Server Naming
### Recommended Names
The name `OVERLAY` is preferred, since this name is used in all [SPX Store](https://spxgraphics.com/store) [[Documentation/Graphic Templates/Overview|templates]] and the default template pack which comes with the application.
**Common server names:**
- `OVERLAY` - For on-screen graphics (most common)
- `VIDEOWALL` - For video wall displays
- `FULLSCREEN` - For full-screen graphics
- `BACKUP` - For backup/overflow
> [!note] Use only alphanumeric names for CasparCG servers, without special characters or spaces.
## Template Server Assignment
Each SPX template has a setting for choosing a target CasparCG server. This server is assigned in the template settings within [[Documentation/Graphics Controller/Project Settings|Project Settings]].
The default value comes from the HTML source code of the template as the `playserver` parameter of the TemplateDefinition object. The name must match one of the configured servers for playout to work.
## Template Source Configuration
SPX has three options for loading templates. See [[Documentation/Server/Configurations|General Settings - Template Source]] for details:
1. **`spx-ip-address`** (default) - Templates loaded via HTTP from SPX
2. **`casparcg-template-path`** - Templates loaded from CasparCG's file system
3. **`http://<ip-address>`** - Manual HTTP address
### Template Path Considerations
When using `casparcg-template-path`:
- Templates **must be in two places**: SPX `ASSETS/templates` folder **and** CasparCG's templates folder
- Changes made to either location should also be done to the other
- Consider using `rsync` or other mirroring techniques to keep folders synchronized
## Troubleshooting
### Server Not Found Error
If a server name is not found during production, you'll see an error message:
```
Template requests CasparCG server [SERVERNAME] but a server by that name was not found in SPX configuration. Make sure app configuration and project settings match. This does not effect web playout.
```
**Solutions:**
1. Verify server name matches exactly (case-sensitive)
2. Check server is added in Configuration
3. Ensure server name uses only alphanumeric characters
4. Restart SPX server after configuration changes
### Connection Issues
If CasparCG playout fails:
1. **Check CasparCG is running** - Verify CasparCG Server is started
2. **Verify network connectivity** - Test connection to CasparCG host/port
3. **Check firewall** - Ensure ports are not blocked
4. **Increase log level** - Set `loglevel` to `verbose` or `debug` to see detailed messages
5. **Check CasparCG logs** - Review CasparCG Server console for errors
### Template Loading Issues
If templates don't load in CasparCG:
1. **Verify template source setting** - Check `general.templatesource` in config
2. **Check template path** - Ensure templates exist in the correct location
3. **Verify HTTP access** - If using HTTP, ensure SPX is accessible from CasparCG
4. **Check template definition** - Ensure template has valid `SPXGCTemplateDefinition`
## Configuration Example
Complete example with multiple servers:
```json
{
"general": {
"templatesource": "spx-ip-address",
"port": "5656"
},
"casparcg": {
"servers": [
{
"name": "OVERLAY",
"host": "localhost",
"port": "5250"
},
{
"name": "VIDEOWALL",
"host": "192.168.1.100",
"port": "5250"
},
{
"name": "BACKUP",
"host": "192.168.1.101",
"port": "5250"
}
]
}
}
```
## CasparCG Configuration Recommendations
The `casparcg.config` file controls how CasparCG Server behaves. The following settings are recommended when using CasparCG with SPX.
### Media Path
By default, CasparCG looks for media in its own installation directory. Point the `media-path` to SPX's `ASSETS/media/` folder so both applications share the same media files without duplication:
```xml
<paths>
<media-path>C:/path/to/SPX/ASSETS/media/</media-path>
...
...
</paths>
```
> [!note] Use forward slashes in the path, even on Windows. The trailing slash is required.
### Video Mode
Set `video-mode` to match your broadcast standard. For 1080p at 50 fps (common in PAL regions):
```xml
<video-mode>1080p5000</video-mode>
```
Common values:
| Value | Resolution | Frame Rate | Region |
|---|---|---|---|
| `1080p5000` | 1080p | 50 fps | PAL |
| `1080p6000` | 1080p | 60 fps | NTSC |
| `1080i5000` | 1080i | 50 fields | PAL |
| `1080i5994` | 1080i | 59.94 fields | NTSC |
| `720p5000` | 720p | 50 fps | PAL |
### HTML Renderer
Add enable GPU acceleration for the HTML renderer to ensure smooth playback of animated graphics templates:
```xml
<html>
<enable-gpu>true</enable-gpu>
</html>
```
- **`enable-gpu`** — Enables hardware-accelerated rendering. Recommended for any system with a dedicated GPU.
## Restart Required
> [!warning] The SPX server process must be restarted whenever changes are made to the CasparCG server configuration.
---
## Read Next
- [[Documentation/Graphic Templates/Overview|Graphic Templates Overview]] - Learn how templates reference CasparCG servers
- [[Documentation/Renderer/Web Render|Web Render]] - Configure renderer output
- [[FAQ/Troubleshooting|Troubleshooting]] - More troubleshooting tips
- [[Documentation/Renderer/Workflows/SDI-NDI-2110|SDI/NDI/2110]] - Professional video outputs