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

ID 标签 775922
已更新 4/5/2023
版本 Ubuntu* 22.04
公共

Software for Intel® Data Center GPU Flex Series

author-image

作者

These steps provide instructions on how to create a media delivery container and run a simple transcoding operation for Ubuntu 22.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* 22.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 22.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 the media-delivery directory

git clone -b release/3.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/ubuntu22.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 \
  $(env | grep -E '(_proxy=|_PROXY)' | sed 's/^/-e /') \
  --cap-add SYS_ADMIN -p 8080:8080 \
  intel-media-delivery
  

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

ffmpeg -hwaccel qsv -qsv_device $DEVICE -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 Transcoding Examples

These examples require network access and correct proxy setting. To run these samples, simply replace the command in Step 4 with one of these commands.

AV1 output samples
ffmpeg-qsv-AV1-1080p.sh 1
ffmpeg-qsv-AV1-4K.sh 1
sample-multi-transcode-AV1-1080p.sh 1
sample-multi-transcode-AV1-4K.sh 1

AVC output samples
ffmpeg-qsv-AVC-1080p.sh 1
ffmpeg-qsv-AVC-4K.sh 1
sample-multi-transcode-AVC-1080p.sh 1
sample-multi-transcode-AVC-4K.sh 1

HEVC output samples
ffmpeg-qsv-HEVC-1080p.sh 1
ffmpeg-qsv-HEVC-4K.sh 1
sample-multi-transcode-HEVC-1080p.sh 1
sample-multi-transcode-HEVC-4K.sh 1

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 .