Skip to content

Compression Settings

Martin Pulec edited this page Jan 3, 2024 · 22 revisions

Table of contents

Video compression settings

Uncompressed video

Whenever running UltraGrid with uncompressed video, it is desirable to use Jumbo frames if possible (see here):

uv -m 8500 <other_parameters> receiver

This tells UltraGrid to use Jumbo Frames (You have to have Jumbo frames enabled along the whole path, see Setup how to set it up on endpoints).

DXT Compression

To compress the video, use the option -c with one of the following parameters

  • RTDXT:DXT1 - GPU DXT1 compression - decreases bandwidth to 1/4 for YUV 4:2:2 or to 1/8 for RGBA
  • RTDXT:DXT5 - GPU DXT5 YCoCg,a bit more exacting version of DXT, with lower compression ratio, but higher quality.
  • cuda_dxt - DXT1/DXT5 using CUDA, superior performance than GLSL based RTDXT but requires a NVIDIA GPU

The resulting command can be

uv -t decklink:mode=Hi50:codec=UYVY -c RTDXT:DXT1 192.0.43.10

  • Sender - Centaurus, 8bit, compressed via RTDXT using DXT5 YCoCg compression (Linux only)

uv -t dvs -c RTDXT:DXT5 192.0.43.20

  • cuda_dxt, AV Foundation (macOS)

uv -t avroundation -c cuda_dxt 192.0.43.10

  • receiver (any platform/GPU)

uv -d gl

Note: To see preliminaries for RTDXT please see the preliminaries page.

GPUJPEG compression

Sending

If GPUJPEG support is compiled in and NVIDIA card is present, you can use GPU-accelerated JPEG compression, eg:

uv -t decklink -c gpujpeg <receiver>

You can also set quality (and optionally reset interval) of compression:

uv -t decklink -c gpujpeg:90 # default is 90, range [1..100]; restart interval can be appended

Lastly, you can also set CUDA device index, eg:

uv -t decklink -c gpujpeg --cuda-device <device_index>

where available devices can be listed with –cuda-device help.

Receiving

You do not need any special settings on the receiver.

Receiver needs to be CUDA-capable and has to have compiled in JPEG support in order to use accelerated decompression. If not, libavcodec fallback decoder will be used.

GPUJPEG with alpha channel

Starting with current UltraGrid and GPUJPEG version 0.20.2, you can natively encode an alpha for input codec RGBA. Usage is very simple:

uv -t testcard:codec=RGBA -c GPUJPEG:alpha

The keyword alpha is mandatory, otherwise the alpha channel will be dropped.

Similarly to JPEG without the alpha channel, no special configuration is needed on the receiver.

Note on transmit errors

Please note that JPEG compression is quite sensitive to transmission errors (eg. lost packets), so if you use a lossy network, you may want to use some of FEC schemes.

Libavcodec compressions

See page Libavcodec Compression.

Comprimato J2K

J2K encode

Examples:

uv -c cmpto_j2k[optional_parameters] [--cuda-device <first>[,<second>]]

Parameters:

  • rate - target bitrate
  • quality - decimal number 0-1, higher is better (default 0.7)
  • mem_limit - memory limit that encoder can occupy (default 1 GB), recommended as much as possible (without affecting other application)
  • tile_limit - number of concurrently compressed images - higher number increases parallelism but also can decrease latency (default 1)
  • pool_limit - maximal number of frames enqueued at a time, similar the above but not passed to the cmpto_j2k but guarded by UG (default 4; similar rules as for tile_limit apply)
  • cuda-device - CUDA device(s) to use

J2K decode

Usage:

uv [--param param=val[param2=val2]] [--cuda-device <first>[,<second>]]

Following options are available:

  • j2k-dec-mem-limit - same as for encoder
  • j2k-dec-tile-limit - same as pool_limit for encoder
  • j2k-queue-len - maximal number of frames waiting for decompress (default 2)
  • j2k-dec-encoder-queue - same as for encoder
  • cuda-device - CUDA device(s) to use

Cineform

Usage:

uv -c cineform[:opts]

use -c cineform:help to see available options.

Audio compression settings

Audio compression scheme is selected by –audio-codec option. Currently, libavcodec-supplied compressions are supported. Depending on you libavcodec build, you can use following codecs:

  • AAC
  • A-law
  • FLAC
  • G.722
  • MP3
  • OPUS
  • PCM
  • speex
  • u-law

The preferred codec is OPUS which provides decent quality at low bitrates. You can use SPEEX as well.

There are two options that can be passed with the codec:

  • sample_rate - specifies sampling rate to be resampled to before passing to audio codec. This has two results - lower sampling rate results in lower bitrate. Secondly, some codecs (eg. speex) support only limited set of sampling rates (here 32000/16000/8000), so you need to resample to this samplerate if you want to use such codec. Source sampling rate is usually 48 kHz.
  • bitrate - for codec that support this setting, you may set this option (currently only OPUS)

Some examples:

uv --audio-codec A-law:sample_rate=8000 # standard 8 kHz A-law compression used in European digital communication (similarly u-law for North America and Japan). Results in 64 kbps dataflow suitable to transmit speech

uv --audio-codec OPUS # high-quality audio codec

uv --audio-codec OPUS:bitrate=64000 # similar as previous, use 64 kbps

uv --audio-codec speex:sample_rate=32000

Clone this wiki locally