Skip to content

Compression Settings

Vitek edited this page Nov 30, 2016 · 22 revisions

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 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

  • FastDXT - DXT1 compression on CPU
  • 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.

The resulting command

./uv -t decklink:0:6:2vuy -c RTDXT:DXT1 192.0.43.10

  • CPU DXT1 compression, QuickTime

./uv -t quicktime:1:12:13 -c FastDXT 192.0.43.10

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

./uv -t dvs:37:UYVY -c RTDXT:DXT5 192.0.43.20

  • receiver (any platform/GPU)

./uv -d gl

Decompression is done automatically, but the reciever is required to use the OpenGL display.

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

Note 2: With Intel graphics card on Linux you need to explicitly enable DXT support which is disabled in the open-source driver for patenting issues. This can be done eg. by installing libtxc-dxtn-s2tc0 package on Ubuntu.

JPEG compression

Sending

If you have compiled JPEG support, you can use JPEG compression, eg:

uv -t decklink -c JPEG  # if DeckLink supports format detection, it can be omitted

You can also set quality and reset-interval of compression:

uv -t decklink -c JPEG:80      # , 80 is default

Lastly, you can also set CUDA device, eg:

uv -t decklink -c JPEG:80 --cuda-device 

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

Receiving

You do not need any special settings on receiver. Of course, also receiver needs to be CUDA-capable and has to have compiled JPEG support.

Note on transmit errors

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

H.264 compression (and others)

H.264 compression is provided via libavcodec (both Libav or FFPEG supported). Some other lavc codecs are supported as well.

Usage:

uv -t deltacast -c`` ``libavcodec:codec=H.264                 

\# use H.264

uv -t deltacast -c libavcodec:codec=MJPEG                 

\# use MJPEG codec instead

uv -t deltacast -c libavcodec:codec=H.264:bitrate=20M     

\# specifies requested bitrate

uv -t deltacast -c libavcodec:codec=H.264:subsampling=420 

\# use subsampling 420 (default: 422 for interlaced, 420 for progressive)

uv -t deltacast -c`` ``libavcodec                             

\# use default libavcodec codec (currently MJPEG)

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

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