Transcoding Sample Ubuntu 20.04

ID 777714
Updated 12/22/2022
Version Latest
Public

author-image

By

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

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 forDescription
OSUbuntu* 20.04
What You Will LearnHow to transcode a AVC encoded video file to HEVC encoded video file
Time to Complete5 minutes

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

ConfigurationDefault setting
Target deviceIntel Data Center GPU Flex Series
Input formatAVC video elementary stream
Output formatHEVC video elementary stream
Output resolutionsame as input

Transcoding Sample Steps

Step 1: Build the media-delivery docker image

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

Step 2: Build the media-delivery docker image

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

Step 3: Enter the docker container

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

Resources

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