Skip to main content

Overview

FFmpeg profiles define transcoding settings for channel streams, including video/audio codecs, bitrates, resolution, hardware acceleration, and more. Each channel is assigned an FFmpeg profile that controls how media is processed for streaming.

Get All FFmpeg Profiles

Retrieve a list of all FFmpeg profiles.
GET /api/ffmpeg/profiles

Response

profiles
array
Array of FFmpeg profile objects

Example Request

curl http://localhost:8409/api/ffmpeg/profiles

Example Response

[
  {
    "id": 1,
    "name": "Default",
    "threadCount": 0,
    "hardwareAcceleration": "None",
    "vaapiDisplay": null,
    "vaapiDriver": "Default",
    "vaapiDevice": null,
    "qsvExtraHardwareFrames": null,
    "resolution": "1920x1080",
    "scalingBehavior": "ScaleAndPad",
    "videoFormat": "H264",
    "videoProfile": "high",
    "videoPreset": "medium",
    "allowBFrames": true,
    "bitDepth": "EightBit",
    "videoBitrate": 10000,
    "videoBufferSize": 20000,
    "tonemapAlgorithm": "Hable",
    "audioFormat": "Aac",
    "audioBitrate": 192,
    "audioBufferSize": 384,
    "normalizeLoudnessMode": "Off",
    "audioChannels": 2,
    "audioSampleRate": 48000,
    "normalizeFramerate": true,
    "deinterlaceVideo": true
  }
]

Create FFmpeg Profile

Create a new FFmpeg profile with transcoding settings.
POST /api/ffmpeg/profiles/new

Request Body

All fields from the FFmpeg profile object are required except hardware-specific fields.
Hardware acceleration fields (vaapiDisplay, vaapiDriver, vaapiDevice, qsvExtraHardwareFrames) are only required when using the corresponding hardwareAcceleration type.

Example Request

curl -X POST http://localhost:8409/api/ffmpeg/profiles/new \
  -H "Content-Type: application/json" \
  -d '{
    "name": "HD Quality",
    "threadCount": 4,
    "hardwareAcceleration": "None",
    "vaapiDisplay": null,
    "vaapiDriver": "Default",
    "vaapiDevice": null,
    "qsvExtraHardwareFrames": null,
    "resolutionId": 2,
    "scalingBehavior": "ScaleAndPad",
    "videoFormat": "H264",
    "videoProfile": "high",
    "videoPreset": "medium",
    "allowBFrames": true,
    "bitDepth": "EightBit",
    "videoBitrate": 5000,
    "videoBufferSize": 10000,
    "tonemapAlgorithm": "Hable",
    "audioFormat": "Aac",
    "audioBitrate": 192,
    "audioBufferSize": 384,
    "normalizeLoudnessMode": "Off",
    "audioChannels": 2,
    "audioSampleRate": 48000,
    "normalizeFramerate": true,
    "deinterlaceVideo": true
  }'

Example Response

{
  "id": 5
}

Update FFmpeg Profile

Update an existing FFmpeg profile.
PUT /api/ffmpeg/profiles/update

Request Body

Same as create, but must include the profile fFmpegProfileId:
fFmpegProfileId
integer
required
ID of the profile to update

Example Request

curl -X PUT http://localhost:8409/api/ffmpeg/profiles/update \
  -H "Content-Type: application/json" \
  -d '{
    "fFmpegProfileId": 5,
    "name": "HD Quality Updated",
    "threadCount": 6,
    "videoBitrate": 6000,
    ...
  }'

Delete FFmpeg Profile

Delete an FFmpeg profile.
DELETE /api/ffmpeg/delete/{id}

Path Parameters

id
integer
required
ID of the profile to delete

Response

status
integer
  • 200 OK - Profile deleted successfully
  • 409 Conflict - Profile is in use by a channel

Example Request

curl -X DELETE http://localhost:8409/api/ffmpeg/delete/5
Profiles assigned to channels cannot be deleted. Assign channels to a different profile first.

Get Resolution by Name

Retrieve resolution details by name for use in profile creation.
GET /api/ffmpeg/resolution/by-name/{name}

Path Parameters

name
string
required
Resolution name (e.g., “1920x1080”, “1280x720”)

Response

id
integer
Resolution ID for use in profile creation
name
string
Resolution name
width
integer
Horizontal resolution in pixels
height
integer
Vertical resolution in pixels
isCustom
boolean
Whether this is a custom resolution

Example Request

curl http://localhost:8409/api/ffmpeg/resolution/by-name/1920x1080

Example Response

{
  "id": 2,
  "name": "1920x1080",
  "width": 1920,
  "height": 1080,
  "isCustom": false
}

Hardware Acceleration

ErsatzTV supports multiple hardware acceleration platforms:

Intel QSV

Quick Sync Video for Intel CPUs with integrated graphics

NVIDIA NVENC

Hardware encoding on NVIDIA GPUs

VA-API

Video Acceleration API for Intel and AMD GPUs

Apple VideoToolbox

Hardware acceleration on macOS and iOS

AMD AMF

Advanced Media Framework for AMD GPUs

Video4Linux2

Hardware encoding on embedded Linux devices

Hardware Acceleration Setup

Hardware acceleration requires proper drivers and device access. See Hardware Acceleration Guide for setup instructions.

VA-API Configuration

For VA-API acceleration:
  • Display: /dev/dri/renderD128 (or your device path)
  • Driver: Select based on your GPU
    • iHD - Modern Intel GPUs
    • i965 - Older Intel GPUs
    • RadeonSI - AMD GPUs
  • Device: Usually same as display

QSV Configuration

  • Set qsvExtraHardwareFrames to 64 or higher for complex content
  • Requires Intel CPU with integrated graphics
  • Best performance with recent Intel generations

Video Codecs

H.264 (AVC)

  • Most compatible codec
  • Wide device support
  • Profiles: baseline, main, high
  • Recommended for general use

H.265 (HEVC)

  • Better compression than H.264
  • Lower bitrate for same quality
  • Requires newer devices/players
  • Profiles: main, main10

MPEG-2

  • Legacy codec for compatibility
  • Larger file sizes
  • Universal support
  • Use for older devices

AV1

  • Next-generation codec
  • Best compression efficiency
  • Limited hardware support
  • CPU-intensive encoding

Copy Mode

  • No transcoding
  • Source stream copied directly
  • Fastest, lowest CPU usage
  • Requires compatible source

Audio Codecs

AAC

  • Standard for modern streaming
  • Good quality at low bitrates
  • Wide device support
  • Recommended: 192 kbps for stereo

AC-3 (Dolby Digital)

  • Supports multichannel audio
  • Compatible with most devices
  • Higher bitrates than AAC
  • Recommended: 384 kbps for 5.1

AAC LATM

  • AAC variant for MPEG-TS streams
  • Use for IPTV/broadcast applications

Copy Mode

  • No audio transcoding
  • Preserves original audio
  • Requires compatible source and client

Bitrate Guidelines

Video Bitrates

ResolutionH.264H.265Use Case
1920x10808-12 Mbps6-9 MbpsFull HD
1280x7204-6 Mbps3-5 MbpsHD
854x4802-3 Mbps1.5-2.5 MbpsSD
640x4801-2 Mbps0.8-1.5 MbpsLow quality

Audio Bitrates

ConfigurationBitrateUse Case
Stereo (2.0)128-192 kbpsStandard quality
Stereo (2.0)256 kbpsHigh quality
5.1 Surround384-448 kbpsHome theater
Mono64-96 kbpsVoice/podcast
Buffer size should typically be 2x the target bitrate for smooth streaming.

Best Practices

Test Profiles

Test new profiles with sample content before production use

Match Source

Target resolution and bitrate appropriate for your source content

Hardware First

Use hardware acceleration when available for better performance

Profile Per Use

Create different profiles for different quality tiers or device types

Troubleshooting

Transcoding Errors

If streams fail to start:
  1. Check FFmpeg logs for errors
  2. Verify hardware acceleration is properly configured
  3. Test with software encoding (hardwareAcceleration: "None")
  4. Ensure FFmpeg has required codecs

Poor Quality

If stream quality is poor:
  1. Increase videoBitrate and videoBufferSize
  2. Use a slower videoPreset (e.g., “slow” instead of “fast”)
  3. Consider higher resolution
  4. Check source quality

High CPU Usage

If CPU usage is too high:
  1. Enable hardware acceleration
  2. Reduce resolution or bitrate
  3. Use faster videoPreset
  4. Increase threadCount
  5. Consider using H.264 instead of H.265/AV1

Next Steps

Hardware Acceleration

Configure GPU-accelerated transcoding

Transcoding Guide

Learn about transcoding concepts and optimization

Build docs developers (and LLMs) love