GStreamer ABR Ladder Application

Introduction

The sample multi-scale program located at /opt/amd/ama/ma35/bin/gstreamer/ is a command line utility which implements the GStreamer video transcoding pipeline described in the diagram below. This application expects an input video file (mp4 with H.264/H.265 or H.264/H.265 elementary stream) and produces 5 different H.264/H.265 elementary streams. The resolution of each output stream is configured using a JSON file (by default: /opt/amd/ama/ma35/examples/gstreamer/ama_xabrladder/abrladder.json). The output streams produced by this application are saved in the /tmp/ladder_outputs/ folder.

This application is installed through the amd-ama-gstreamer package. If this package is not present on your system, install it by following the steps described in the package feed page. The source code for this application is also available under, /opt/amd/ama/ma35/examples/gstreamer/ama_xabrladder.

GStreamer pipeline of the ama_xabrladder application

Note

This example supports input files of elementary stream NAL type or mp4 containers, with H.264/H.265 elementary stream in it. No other formats are supported

Host System Requirement

  • AMD AMA Video SDK

  • amd-ama-gstreamer package

Usage

Below are the input parameters required to run the application.

Parameter

Short Form

Description

--devidx
-i
device index
Type: int
Range: 0 to 31
Default: NA
Option: Mandatory
--json
-j
JSON file used to describe the configuration of the ABR ladder
Type: string
Range: NA
Default: /opt/amd/ama/ma35/examples/gstreamer/ama_xabrladder
Option: Optional
--codectype
-c
Output codec type
Type: int
Range: 0 (H264), 1 (H265)
Default: NA
Option: Mandatory
--file
-f
Input file path name (mp4/elementary-stream)
Type: string
Range: NA
Default: NA
Option: Mandatory
--forcekeyframe
-k
Keyframe (IDR frame) insertion frequency in number of frames
Type: int
Range: NA
Default: 0
Option: Optional

Examples

Below are example commands for the ABR ladder use case. The output files are stored in /tmp/ladder_outputs/ folder. Ensure that enough space is available in this folder.

  1. Running one ABR ladder on one device:

    ama_xabrladder  --devidx 0 --codectype 0 --file <path to file>
    

The above command takes the input video file (mp4 with H.264/H.265 or H.264/H.265 elementary stream) and produces 5 different H.264/H.265 elementary streams based on the codec type provided (0 for H.264 and 1 for H.265) with the following resolutions: 720p60, 720p30, 480p30, 360p30 and 160p30.

  1. Running one ABR ladder on one device without lookahead:

    ama_xabrladder  --devidx 0 --lookahead_enable 0 --codectype 0 --file <path to file>
    

The above command takes the input video file (mp4 with H.264/H.265 or H.264/H.265 elementary stream) and produces 5 different H.264/H.265 elementary streams based on the codec type provided (0 for H.264 and 1 for H.265) with the following resolutions: 720p60, 720p30, 480p30, 360p30 and 160p30.

  1. Running one ABR ladder on one device with lookahead enabled, and using the short-form options:

    ama_xabrladder -i 0  -c 0 -f <path to file>
    
  2. Running two ABR ladders, mapping each ladder to a specific device using the devidx option:

    ama_xabrladder --devidx 0  --codectype 1 --file <path to file>
    ama_xabrladder --devidx 1  --codectype 1 --file <path to file>