Getting Started with Transcoding on Intel® Data Center GPU Flex Series

ID 775920
Updated 4/5/2023
Version Ubuntu* 20.04
Public

Software for Intel® Data Center GPU Flex Series

author-image

By

These steps provide instructions on how to create a media delivery container and run a simple transcoding operation for Ubuntu 20.04 only.
This "Hello World' sample validates that the drivers have been loaded correctly and that the card functioning properly.

Optimized for Description
OS Ubuntu* 20.04
What You Will Learn How to transcode a AVC encoded video file to HEVC encoded video file
Time to Complete 45 minutes
Storage At least 20GB of free disk space available for Docker installation

Purpose

This sample is a command line application that takes a file containing a AVC video elementary stream as an argument, decodes it, and encodes the output file 'WAR_TRAILER_HiQ_10_withAudio.hevc.mp4' as HEVC.

Key Implementation Details

Configuration Default setting
Target device Intel Data Center GPU Flex Series
Input format AVC video elementary stream
Output format HEVC video elementary stream
Output resolution same as input

Perform the following steps on a Linux Ubuntu 20.04 System

Step 1: Setup Docker

Docker is required to build and to run media delivery containers. Registering and creating a Docker Hub login is recommended1.

Install Docker as follows:

sudo apt-get install docker.io

Additional configuration for Docker on your system:

• Allow Docker to run under your user account (remember to re-login for group modification to take effect):

sudo usermod -aG docker $(whoami) && exit

• Authenticate Docker engine is running by logging in:

docker login

• To run behind a proxy, configure the proxy for docker daemon using the following commands:

sudo mkdir -p /etc/systemd/system/docker.service.d
echo "[Service]" | sudo tee /etc/systemd/system/docker.service.d/https-proxy.conf
echo "Environment=\"HTTPS_PROXY=$http_proxy/\"" | \
sudo tee -a /etc/systemd/system/docker.service.d/https-proxy.conf
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl show --property=Environment --no-pager docker

The above example assumes that you have http_proxy environment variable set in advance. Refer to Configure the daemon with systemd for more information on daemon configuration.

Step 2: Set up media-delivery directory

git clone -b release/2.1 https://github.com/intel/media-delivery.git && cd media-delivery

Step 3: Build the media-delivery docker container

docker build \
  $(env | grep -E '(_proxy=|_PROXY)' | sed 's/^/--build-arg /') \
  --file docker/ubuntu20.04/intel-gfx/Dockerfile \
  --tag intel-media-delivery \.

Step 4: Enter the docker container using the following commands

DEVICE=${DEVICE:-/dev/dri/renderD128}
DEVICE_GRP=$(ls -g $DEVICE | awk '{print $3}' | \
  xargs getent group | awk -F: '{print $3}')
mkdir -p /tmp/ats-m && chmod -R 777 /tmp/ats-m
docker run --rm -it -v /tmp/ats-m:/opt/ats-m \
  -e DEVICE=$DEVICE --device $DEVICE --group-add $DEVICE_GRP \
  --cap-add SYS_ADMIN -p 8080:8080 \
  intel-media-delivery  

Step 5: Run AVC to HEVC FFmpeg transcoding inside docker container

ffmpeg -hwaccel qsv -c:v h264_qsv -extra_hw_frames 8 \
    -i /opt/data/embedded/WAR_TRAILER_HiQ_10_withAudio.mp4 \
    -c:v hevc_qsv -preset medium -profile:v main -async_depth 1 \
    -b:v 4500000 -maxrate 9000000 -bufsize 18000000 \
    -rc_init_occupancy 9000000 \
    -look_ahead_depth 8 -extbrc 1 -b_strategy 1 \
    -bf 7 -refs 4 -g 256 -idr_interval begin_only -strict -1 \
    -vsync passthrough -y /opt/ats-m/WAR_TRAILER_HiQ_10_withAudio.hevc.mp4

More information

You can find more information at the Intel Data Center GPU Flex Series Software Portal .

License

Content attribution for WAR_TRAILER_HiQ_10_withAudio.mp4: Film: WAR - Courtesy & Copyright: Yash Raj Films Pvt. Ltd.

[1] Docker Hub limits the number of docker image downloads ("pulls"). For anonymous users this limit is tied to IP address. For authenticated users it depends on subscription type. For details see Download rate limit .