Summary
-
Video decoding converts compressed data into a raw image with pixel-by-pixel color values.
-
Video encoding takes a raw image and converts it into a compressed format
-
Video transcoding converts from one compressed format to another, by first decoding then re-encoding
-
Transcoding is used primarily when watching away from home, to compress the video so it uses up less bandwidth
Video compression
Video is transmitted using different codecs, which define how the pixel data is compressed. Common codecs include MPEG2, H264, and HEVC.
Each codec also has an associated resolution (like 480p, 720p, 1080p, etc), and a bitrate (2mbps, 4mbps, 8mbps). The resolution defines how many pixels are in the picture, and the bitrate is how much bandwidth or disk storage is used per second of video.
To watch a video, you have to decode using the codec to uncompress the data and turn it into a picture.
Transcoding is when you decode and then re-encode. For example, you may take a MPEG2 1080p 16mbps video stream and transcode it to a H264 720p 4mbps stream.
Why transcode?
Channels and Channels DVR Server do not require transcoding, transcoding is disabled by default while you are at home.
However, when you’re away from home transcoding can be helpful because your data plan is usually limited and you don’t want to send large video files over the internet and use up all your data. In these cases, you can control the bitrate and resolution in the app and Channels DVR Server will transcode the videos in real-time to a smaller size and resolution to limit the bandwidth usage.
Hardware vs Software transcoding
Software transcoding uses the CPU to decode and re-encode video. This is an expensive task. This will typically max out your CPU usage and limit the number of frames that can be encoded per second.
With video decoding and encoding becoming so popular with consumers, many manufacturers have started including dedicated video chips on their CPUs and GPUs that can perform transcoding much more quickly. This is known as Hardware accelerated transcoding. Support for hardware transcoding depends on your cpu and graphics card model as well as your operating system drivers.
Supported hardware
Intel QuickSync
Modern Intel CPUs include support for QuickSync, which offers hardware-accelerated video decoding, encoding and deinterlacing.
Windows
Channels DVR will attempt to use QuickSync support via Windows MediaFoundation APIs, and fallback to Intel Media SDK APIs for older CPU models.
Linux
Channels DVR accesses QuickSync functionality via VAAPI, which requires the i915
kernel driver for Intel HD Graphics.
Docker
Docker containers can access QuickSync as long as you pass through /dev/dri
into your container.
This can be done via the docker
cli:
docker run --device /dev/dri:/dev/dri ... fancybits/channels-dvr:latest
or via your docker-compose.yml
:
channels-dvr:
...
devices:
/dev/dri:/dev/dri
image: fancybits/channels-dvr:latest
FreeBSD
QuickSync is supported via VAAPI on modern FreeBSD kernels. You will need to install the i915
driver:
-
Install the drm-kmod package
$ sudo pkg install drm-kmod
-
Add to your /etc/rc.conf.d/intel file:
kld_list="/boot/modules/i915kms.ko"
Nvidia
Many Nvidia GPUs support NVENC APIs for hardware encoding.
Windows
Hardware transcoding support should be detected automatically as long as the latest Nvidia drivers are installed.
Linux
The official nvidia drivers must be installed. If your distribution uses the open-source nouveau driver, you will need to switch to the nvidia driver instead.
Docker
See instructions
FreeBSD
Nvidia does not provide official support for CUDA on FreeBSD, so hardware acceleration via NVENC is currently not available.
AMD
Hardware transcoding is available via the new AMF API.
Windows
Transcoder will be detected automatically as long as latest AMD drivers are installed.
Find the latest AMD software package for your GPU/CPU here: https://www.amd.com/en/support/
Linux
AMF support on Linux is still experimental, but should work on latest Ubuntu. Contact support@getchannels.com for details.
Android
Channels DVR server can run on some Android devices, like the Nvidia SHIELD. Hardware transcoding is enabled automatically using the Android MediaCodec APIs.
Raspberry Pi
Hardware transcoding is available on the Raspberry Pi 4, via the V4L2 API.
Older models and 32-bit OS can also transcode via OMX, but it is generally slower and less reliable.
Nvidia Jetson
Troubleshooting hardware transcoding
When the DVR software starts, it will probe different hardware drivers to see if it can find one that works.
Select Settings > Transcoder > Rescan Hardware to check again manually, or select View Debug Info to see the details and errors from each hardware transcoder probed.