Skip to content

Pipelines

Pipelines are the core of Flex Video, defining how video is ingested, processed, and delivered.

Pipeline Types

SimplePipeline

SimplePipeline provides a high-level configuration interface:

{
  "id": "camera-1",
  "mode": "simple",
  "source": { ... },
  "encoding": { ... },
  "output": { ... }
}

Best for:

  • Standard transcoding workflows
  • Users who don't need GStreamer knowledge
  • Consistent, maintainable configurations

AdvancedPipeline

AdvancedPipeline accepts raw GStreamer pipeline strings:

{
  "id": "custom-pipeline",
  "mode": "advanced",
  "raw_pipeline": "videotestsrc ! videoconvert ! x264enc ! rtph264pay ! udpsink host=239.1.1.1 port=5004"
}

Best for:

  • Custom processing requirements
  • Unusual source/sink combinations
  • GStreamer experts

Source Configuration

Supported Sources

Scheme Description Example
rtsp:// RTSP stream rtsp://camera.local:8554/live
udp:// UDP unicast/multicast udp://239.1.1.1:5004
file:// Local file file:///video/sample.ts
test:// Test pattern test://smpte

RTSP Sources

"source": {
  "uri": "rtsp://192.168.1.100:8554/live",
  "latency_ms": 200
}

Latency tuning:

Network Recommended latency_ms
Wired LAN 50-100
WiFi 200-500
WAN/Internet 500-2000

UDP Multicast Sources

"source": {
  "uri": "udp://239.1.1.1:5004",
  "network_interface": "eth0"
}

Network Interface

Set network_interface when using multicast to ensure packets arrive on the correct interface.

Test Patterns

Available patterns for testing without a real source:

Pattern Description
smpte SMPTE color bars
ball Bouncing ball
snow Random noise
black Solid black
checkers-1 1px checkerboard
circular Circular pattern
zone-plate Zone plate

Encoding Configuration

"encoding": {
  "codec": "h264",
  "bitrate": 2000,
  "width": 1920,
  "height": 1080,
  "fps": 30,
  "quality": 7
}

Codecs

Codec License Efficiency Compatibility
h264 Free Good Excellent
h265 Licensed Better Good
av1 Free Best Limited

Bitrate Guidelines

Resolution Low Medium High
720p 1000 kbps 2000 kbps 4000 kbps
1080p 2000 kbps 4000 kbps 8000 kbps
4K 8000 kbps 15000 kbps 25000 kbps

Quality Preset

The quality setting (1-10) balances encoding speed vs. output quality:

Range Use Case
1-3 Real-time, low latency
4-6 Balanced (recommended)
7-10 High quality, archival

Output Configuration

"output": {
  "uri": "rtsp://0.0.0.0:8731/stream-name",
  "mtu": 1400
}

Outputs to the built-in RTSP server. Clients connect to rtsp://server-ip:8731/stream-name.

UDP Multicast Output

"output": {
  "uri": "udp://239.1.1.1:5004",
  "network_interface": "eth0",
  "mtu": 1400
}

MTU Settings

Value Use Case
1200 VPN, tunnels
1400 Default, safe
1500 Standard Ethernet
9000 Jumbo frames

Optional Features

Overlays

Add text or timestamp overlays:

"overlay": {
  "show_timestamp": true,
  "text": "Camera 1 - Main Entrance"
}

Transform

Apply video transformations:

"transform": {
  "mirror": false,
  "rotate": 90,
  "grayscale": false
}

Rotation values: 0, 90, 180, 270

Crop

Crop the video frame:

"crop": {
  "top": 100,
  "right": 0,
  "bottom": 100,
  "left": 0
}

Geolocation

Set static or dynamic position:

"geolocation": {
  "latitude": 38.8977,
  "longitude": -77.0365,
  "altitude": 100.0,
  "heading": 45.0,
  "is_dynamic": false
}

Set is_dynamic: true when position will be updated from KLV metadata.

Pipeline Lifecycle

┌─────────┐     play      ┌─────────┐
│  ready  │──────────────►│ playing │
└─────────┘               └─────────┘
     ▲                         │
     │         stop            │
     └─────────────────────────┘

On-Demand vs Auto-Start

Setting Behavior
on_demand: true Pipeline created in ready state, must call /play
on_demand: false Pipeline starts immediately on creation

Pipeline Limits

Pipeline limits are controlled by your license:

  • Check limits: GET /flex/licensed
  • Exceeding limits returns HTTP 402

Best Practices

  1. Use descriptive IDs: entrance-cam-h264 not pipe1
  2. Match resolution to source: Don't upscale unnecessarily
  3. Set appropriate latency: Higher for unreliable networks
  4. Use RTSP output: Better client compatibility than UDP
  5. Monitor pipeline state: Use SSE for real-time updates