Skip to main content

Overview

Ant Media Server provides real-time adaptive bitrate (ABR) transcoding, allowing you to deliver streams at multiple quality levels. This ensures viewers get the best possible experience based on their network conditions and device capabilities. The transcoding engine is powered by FFmpeg and can encode streams in real-time with GPU acceleration support.

How It Works

When transcoding is enabled, Ant Media Server:
  1. Receives the source stream (typically at the highest quality)
  2. Encodes multiple renditions at different resolutions and bitrates
  3. Packages all renditions into HLS/DASH playlists
  4. Allows players to switch between qualities based on network conditions
Transcoding workflow

Encoder Settings

Transcoding profiles are defined using the EncoderSettings class:

Parameters Explained

forceEncode=false prevents upscaling. If the source is 720p and you request 1080p with forceEncode=false, that rendition will be skipped.

Configuration

Via Web Panel

Navigate to Settings → Advanced Settings and configure:
  1. Enable Adaptive Bitrate Streaming
  2. Add encoder settings as JSON array:

Via REST API

Update application settings:

Per-Stream Configuration

You can also set encoding profiles for individual streams:

Adaptive Stream Structure

When transcoding is active, the MuxAdaptor creates multiple output streams:

Output Files

For a stream with ID stream123, transcoding produces:
Always use the _adaptive.m3u8 playlist in your player for automatic quality switching.

GPU Acceleration

Ant Media Server supports hardware-accelerated encoding:

NVIDIA GPU (NVENC)

Enable in application settings:

Intel Quick Sync (QSV)

Performance Comparison

GPU encoding trades some quality for performance. For best quality, use software encoding with optimized presets.

Transcoding Modes

Real-time Transcoding

Default mode - streams are transcoded as they arrive:

VOD Transcoding

Recorded files can be transcoded after the stream ends:

Quality Ladder Recommendations

Standard Ladder (Mobile + Desktop)

Mobile-Only Ladder

4K Streaming Ladder

Monitoring Transcoding

Check Stream Resolutions

Response includes active renditions:

Server Resources

Monitor CPU/GPU usage:

Troubleshooting

Check:
  • Encoder settings are properly configured
  • Source stream resolution is higher than target
  • forceEncode is set correctly
  • FFmpeg is properly installed
Solution: Enable DEBUG logging for io.antmedia.muxer.MuxAdaptor
Causes:
  • Too many renditions configured
  • Software encoding without GPU
  • Source resolution too high
Solutions:
  • Reduce number of renditions
  • Enable GPU acceleration (NVENC/QSV)
  • Use faster encoding presets
Issue: Player doesn’t switch between qualitiesCauses:
  • Using wrong playlist (not _adaptive.m3u8)
  • Player doesn’t support ABR
  • Network conditions stable
Solution: Ensure you’re using the master playlist and a modern player (HLS.js, Video.js, etc.)

Best Practices

Start Conservative

Begin with 2-3 renditions and add more based on viewer analytics and server capacity.

Match Your Audience

Configure renditions based on your viewers’ devices and network conditions.

Use GPU Encoding

Enable hardware acceleration for high-volume streams to reduce CPU load.

Test Quality Ladder

Validate visual quality at each bitrate using actual devices and network conditions.