---
title: "Feed"
description: "Managing feed operations and output routing using the Python API"
url: https://developer.disguise.one/python-api/guides/feed/
---

# Feed Operations in Disguise

This guide provides an overview of how to use the Disguise Python API to manage and interact with Feeds, which are used to route content from screens to physical outputs.

* * *

## Feed Scene

A [`FeedScene`](/python-api/docs/feedscene) is the top-level object for managing a feed setup. It contains a collection of [`FeedRect`](/python-api/docs/feedrect) objects that define the mapping. You can find a feed scene by iterating through `system.scenes` and checking the type and name.

| Task | Python |
| :-- | :-- |
| **Find a Feed Scene** | `feed_scene = next((s for s in system.scenes if isinstance(s, FeedScene) and s.name == "MyFeedScene"), None)` |

### Get all Feed Rectangles

```python
if feed_scene:
    rects = feed_scene.feedRects
```

### Create a new Feed Rectangle

```python
if feed_scene:
    new_rect = feed_scene.add()
```

Returns a new [`FeedRect`](/python-api/docs/feedrect) object.

### Remove a Feed Rectangle

```python
if feed_scene and rect_to_remove:
    feed_scene.remove(rect_to_remove)
```

### Get used output heads

```python
if feed_scene:
    used_heads = feed_scene.getUsedHeads()
```

Returns a list of integer head indices.

### Configure an output head

```python
if feed_scene:
    resolution = Int2(1920, 1080)
    head_config = feed_scene.ensureHeadConfig(0, resolution)
```

Configures head 0 with a specific resolution. Returns a [`FeedHeadConfig`](/python-api/docs/feedheadconfig).

* * *

## Feed Rectangle (`FeedRect`)

A [`FeedRect`](/python-api/docs/feedrect) defines a rectangular region of a screen and maps it to a physical output.

| Property | Description | Example |
| :-- | :-- | :-- |
| `screen` | The source screen object to take content from. | `feed_rect.screen = my_screen` |
| `head` | The integer index of the destination output head. | `feed_rect.head = 0` |
| `rect` | A [`Rect`](/python-api/docs/rect) object defining the position and size on the output. | `feed_rect.rect.x = 100`<br>`feed_rect.rect.w = 1920` |
| `screenRect` | A [`Rect`](/python-api/docs/rect) object defining the source region from the screen. | `feed_rect.screenRect.u = 0.0`<br>`feed_rect.screenRect.v = 0.0`<br>`feed_rect.screenRect.uw = 1.0`<br>`feed_rect.screenRect.vh = 1.0` |
| `rotationIndex` | Rotation of the rectangle (0=0°, 1=90°, 2=180°, 3=270°). | `feed_rect.rotationIndex = 1` |
| `deformStack` | The [`DeformStack`](/python-api/docs/deformstack) used for mesh deformations. | `deform_stack = feed_rect.deformStack` |
| `mask` | A [`DxTexture`](/python-api/docs/dxtexture) to use as a mask. | `mask_texture = find_texture("MyMask")`<br>`feed_rect.mask = mask_texture` |
| `active` | (Read-only) Returns `True` if the rect is active. | `is_active = feed_rect.active` |

* * *

## Feed Head Configuration (`FeedHeadConfig`)

A [`FeedHeadConfig`](/python-api/docs/feedheadconfig) resource allows you to configure properties for a specific output head, such as resolution and background color.

| Property | Description | Example |
| :-- | :-- | :-- |
| `resolution` | The resolution of the output head as an [`Int2`](/python-api/docs/int2) object. | `head_config.resolution = Int2(1920, 1080)` |
| `clearColour` | The background color of the output as a [`Colour`](/python-api/docs/colour) object. | `head_config.clearColour = Colour(0.0, 0.0, 0.0, 1.0)` |
| `framesLatency` | The latency of the output in frames. | `head_config.framesLatency = 2` |
| `name` | The name of the head configuration. | `head_config.name = "Main LED"` |

* * *

## Feed Projection

A [`FeedProjection`](/python-api/docs/feedprojection) is a type of projection that uses a [`FeedScene`](/python-api/docs/feedscene) to map content to outputs. This is often used on a `Video` layer to direct its content through a specific feed setup.

### Assign a Feed Scene to a projection

```python
feed_projection = next((p for p in project.projections if isinstance(p, FeedProjection) and p.name == "MyFeedProjection"), None)
feed_scene = next((s for s in system.scenes if isinstance(s, FeedScene) and s.name == "MyFeedScene"), None)
if feed_projection and feed_scene:
    feed_projection.feed_scene = feed_scene
```

### Assign a Feed Projection to a layer

```python
video_layer = next((l for l in guisystem.track.layers if l.name == "MyVideoLayer"), None)
feed_projection = next((p for p in project.projections if isinstance(p, FeedProjection) and p.name == "MyFeedProjection"), None)
if video_layer and feed_projection:
    video_layer.projection = feed_projection
```

* * *

## VFC and Output Configuration

Hardware outputs are configured on a `Machine` resource. This includes settings for VFC cards, which handle the physical video outputs.

| Task | Python |
| :-- | :-- |
| **Get a machine object** | `machine = system.machines[0]` |
| **Get VFC card type** | `card_type = machine.vfcCardType(0)`<br>`0` is the slot index. |
| **Get VFC firmware version** | `fw_version = machine.vfcFwVersion(0)` |
| **Get number of VFC ports** | `num_ports = machine.vfcNumPorts(0)` |
| **Get VFC port settings** | `port_settings = machine.vfcPort(slot_index, port_index)` |
| **Set VFC port video format** | `port_settings.videoFormat = VFC_VIDEO_FORMAT_2160p_60_00` |
| **Get output settings** | `output_settings = machine.output(0)`<br>`0` is the output head index. Returns an `OutputSettings` object. |
| **Set output resolution and rate** | `output_settings.resolution = Int2(1920, 1080)`<br>`output_settings.rate = 59.94` |
| **Set output bit depth** | `output_settings.bitDepth = machine.BITS_10` |
| **Set d3net feed output settings** | `d3net_settings = machine.d3net`<br>`d3net_settings.outputEnabled = True`<br>`d3net_settings.outputAddress = "10.0.1.100"` |

* * *

## Warping and Deformation (`DeformStack`)

You can apply warping, lens distortion, and other deformations to a [`FeedRect`](/python-api/docs/feedrect) by adding items to its [`DeformStack`](/python-api/docs/deformstack). Each item in the stack is a different type of deformer.

| Task | Python |
| :-- | :-- |
| **Get the deform stack** | `deform_stack = feed_rect.deformStack` |
| **Clear all deformers** | `deform_stack.clear()` |

### Add a Lens deformer

```python
lens_deform = deform_stack.add(DeformStackItem_Lens)
if lens_deform:
    lens_deform.enabled = True
    lens_deform.amount = 0.5
```

### Add a Circular deformer

```python
circular_deform = deform_stack.add(DeformStackItem_Circular)
if circular_deform:
    circular_deform.innerRadius = 0.2
    circular_deform.outerRadius = 0.8
```

### Add a Mesh deformer

```python
mesh_deform = deform_stack.add(DeformStackItem_Mesh)
mesh = next((m for m in project.meshes if isinstance(m, Mesh) and m.name == "MyWarpMesh.obj"), None)
if mesh_deform and mesh:
    mesh_deform.mesh = mesh
```
