WELCOME TO MY DIGITAL GARDEN & TECHNICAL ARCHIVE READ MORE →

1. The Golden Rule: Channels and Layers #

Before sending any media to the screen, you need to understand where it is going. CasparCG uses a coordinate system based on Channels and Layers.

  • Channel: Represents a physical or virtual output (like an SDI output card, an NDI stream, or a screen window).
  • Layer: Inside each channel, you can stack multiple layers of media. Layers are ordered by number, and higher numbers always sit on top of lower numbers.

In AMCP syntax, you target these using the format [channel]-[layer]. For example, 1-10 targets Channel 1, Layer 10.


2. Playing Videos (The PLAY Command) #

The PLAY command is the workhorse of CasparCG. It loads and starts a media file immediately.

Basic Playback

To play a video file named intro.mp4 (assuming it is in your server's media folder), drop the file extension and use:

PLAY 1-10 "intro"

Adding a Loop

Need a background animation to play infinitely? Just add LOOP to the end of the command:

Plaintext

PLAY 1-10 "background_loop" LOOP

Adding a Fade Transition

If you want to seamlessly crossfade from the currently playing video on layer 10 to a new one, you can add a transition. The most common transition is MIX, followed by the duration in frames (not seconds).

For a 25-frame crossfade (which is 1 second in a 25fps or 50i setup):

Plaintext

PLAY 1-10 "new_video" MIX 25

3. Controlling Templates (The CG Commands) #

HTML or Flash graphics (like lower thirds, scorebugs, and tickers) require a different set of commands because they accept live data and have built-in intro/outro animations.

Templates use an additional layer identifier called a [cg_layer] to manage multiple graphics within the same video layer.

Adding and Playing a Template

Use CG ADD to load a graphic. The 1 right after the template name tells the graphic to play its intro animation immediately.

Plaintext

CG 1-20 ADD 1 "my_lower_third" 1 "{ \\"name\\": \\"John Doe\\", \\"title\\": \\"Guest\\" }"

Breakdown: Play on Channel 1, Layer 20, CG Layer 1. Load "my_lower_third", auto-play it, and send it JSON data.

Updating a Template Live

If you want to change the text on screen without re-triggering the intro animation, use CG UPDATE:

Plaintext

CG 1-20 UPDATE 1 "{ \\"name\\": \\"Jane Smith\\", \\"title\\": \\"Host\\" }"

Invoking the Next State

Many complex graphics have multiple animation steps. For example, a sports graphic might animate on, then reveal a secondary stat when triggered. To push a template to its next animation state, use CG NEXT:

Plaintext

CG 1-20 NEXT 1

Stopping a Template Nicely

Never use the standard STOP command on a template unless you want it to vanish abruptly. To trigger the template's built-in outro animation so it gracefully leaves the screen, use CG STOP:

Plaintext

CG 1-20 STOP 1

4. Fading Out and Clearing #

Eventually, you need to get things off your screen.

Fading out whatever is on a channel

If you want to fade out a layer or an entire channel smoothly before clearing it, you can animate its opacity using the MIXER command.

To fade out the entirety of Channel 1 over 25 frames:

Plaintext

MIXER 1-0 OPACITY 0 25

(Note: 1-0 targets the whole channel rather than a specific layer. Once the opacity hits 0, the media is technically still playing invisibly, so you'll want to clear it afterward).

Clearing (Hard Cut)

The CLEAR command instantly unloads the media and frees up server resources.

To clear a specific layer (e.g., Layer 10):

Plaintext

CLEAR 1-10

To hit the panic button and instantly clear everything on Channel 1:

Plaintext

CLEAR 1

5. Extras: PRINT and ROUTE #

Once you master the basics, these two commands open up advanced workflow possibilities.

The PRINT Command

If you ever need to take a snapshot of what is currently live on air, PRINT is your best friend.

Plaintext

PRINT 1

This command instantly renders a frame of Channel 1's current output and saves it as an image file in your CasparCG media folder. It’s incredibly useful for generating thumbnails, archiving lower thirds, or troubleshooting.

The ROUTE Command

Routing allows you to take the live output of one channel (or layer) and pipe it directly into another. It is the secret weapon for creating complex picture-in-picture (PiP) or multibox layouts.

To route the entirety of Channel 1 into Channel 2, Layer 10:

Plaintext

PLAY 2-10 route://1

You can then apply standard MIXER commands (like scaling and positioning) to layer 2-10 to shrink the routed video down into a box, all while Channel 1 remains unaffected.