Appendix. Xilinx Video SDK Installation Guide
The vt1a
instance family offers real-time video transcoding capabilities and is suitable for live event broadcasting, video conferencing, and real-time transcoding applications. To use the hardware acceleration features provided by the Alveo U30 media accelerator card in the vt1a
instance family, it is necessary to install the Xilinx Video SDK provided by AMD.
This document guides you through the process and examples of installing the Xilinx Video SDK on the Alveo U30 media accelerator card for the vt1a
instance family.
Supported platform and OS
Supported platform
As of September 2023, the Xilinx Video SDK supports the following software tools.
Software | Description |
---|---|
FFmpeg 4.4 | Free software for recording, converting, and playing videos and audio - For more information, visit the FFmpeg official site |
GStreamer 1.16.2 | A framework for creating streaming media applications - For more information, visit the GStreamer official site |
OS and Kernel version
As of September 2023, Xilinx officially supports the use of the Xilinx Video SDK in both Ubuntu and RHEL. The current KakaoCloud service supports the Ubuntu operating system.
- Ubuntu 22.04 (Kernel 5.15)
- Ubuntu 20.04.4 (Kernel 5.13)
- Ubuntu 20.04.3 (Kernel 5.11)
- Ubuntu 20.04.1 (Kernel 5.4)
- Ubuntu 20.04.0 (Kernel 5.4)
Step 1. Create and connect instance
The vt1a
instance family offers sizes of vt1a.4xlarge, vt1a.8xlarge, and vt1a.32xlarge. Follow the steps below to create an instance and connect to it.
-
Go to KakaoCloud Console > Beyond Compute Service > Virtual Machine.
-
Refer to Create and connect instance using the ssh command.
- This document is based on Ubuntu22.04 and Kernel version 5.15, so please refer to Connect to Linux instance.
- RHEL operating system will be supported in the future.
Step 2. Download and install SDK
After creating and connecting to the instance, install the AMD Xilinx Video SDK.
The examples describing in this document are based on Ubuntu22.04 and Kernel version 5.15. For SDK download and installation methods for other versions, please refer to the AMD Xilinx Video SDK.
- The AMD Xilinx Video SDK official documentation is explained for on-premises servers. Therefore, in the KakaoCloud Beyond Compute Service (BCS), steps 7-11 described in the AMD official documentation are not required.
Prepare
To install the AMD Xilinx Video SDK, stop the automatic update of the Kernel and check the distro name of the Linux distribution.
-
Open the
/etc/apt/apt.conf.d/20auto-upgrades
file and add the following content:APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";
APT::Periodic::Unattended-Upgrade "0";- (Optional) If an older version of the SDK is installed, use the following command to remove it:
sudo apt-get remove xvbm xilinx-u30-xvbm xrmu30decoder xrmu30scaler xrmu30encoder xmpsoccodecs xmultiscaler xlookahead xmaapps xmapropstojson xffmpeg launcher jobslotreservation xcdr
sudo apt-get remove xrm xilinx-container-runtime xilinx-xvbm xilinx-u30-xrm-decoder xilinx-u30-xrm-encoder xilinx-u30-xrm-multiscaler xilinx-u30-xma-multiscaler xilinx-u30-xlookahead xilinx-u30-xmpsoccodecs xilinx-u30-xma-apps xilinx-u30-xmapropstojson xilinx-u30-xffmpeg xilinx-u30-launcher xilinx-u30-jobslotreservation xilinx-u30-xcdr xilinx-u30-gstreamer-1.16.2 xilinx-u30-vvas xilinx-sc-fw-u30 xilinx-u30-gen3x4-base xilinx-u30-gen3x4-validate -
Check the current Linux distribution's distro name. The outputted distro name will be one of
bionic
,focal
, orjammy
.lsb_release -c
-
Create a file named xilinx.list in the /etc/apt/sources.list.d/ directory, and then enter the distro name that appears in place of
<distro name>
below.deb [trusted=yes] https://packages.xilinx.com/artifactory/debian-packages <distro name> main
-
Download and set up the Xilinx public key.
wget -q https://www.xilinx.com/content/dam/xilinx/support/download/2024-1/xilinx-master-signing-key.asc
sudo gpg --no-default-keyring --keyring ./xilinx-old.gpg --import xilinx-master-signing-key.asc
sudo gpg --no-default-keyring --keyring ./xilinx-old.gpg --export --output xilinx.gpg
sudo mv xilinx.gpg /etc/apt/trusted.gpg.d/
sudo rm xilinx-master-signing-key.asc xilinx-old.gpg xilinx-old.gpg~
Install SDK
Use the following command to update packages and install SDK components.
When installing the AMD Xilinx Video SDK package, be sure to use the bash shell.
sudo apt-get update
sudo apt-get install xrt=2.11.722
sudo apt-mark hold xrt
sudo apt-get install xilinx-alveo-u30-core
sudo apt-get install xilinx-alveo-u30-ffmpeg
sudo apt-get install xilinx-alveo-u30-gstreamer
sudo apt-get install xilinx-alveo-u30-examples
Step 3. Set up runtime environment
The runtime environment setup should be executed every time you connect to the instance or open a new terminal.
-
Set up the runtime environment as follows.
source /opt/xilinx/xcdr/setup.sh
-
Use the following command to check if the card is correctly recognized.
xbutil examine
-
If the device is recognized correctly, a message like the following will be displayed. The list of devices shown will vary depending on the number of flavors being used.
...
Devices present
[0000:06:00.0] : xilinx_u30_gen3x4_base_2
[0000:05:00.0] : xilinx_u30_gen3x4_base_2
Step 4. Execute example tests
This section explains examples using FFmpeg and GStreamer supported by the Xilinx Video SDK. For more examples, please refer to the Tutorials and Examples in the official AMD Xilinx Video SDK documentation.
FFmpeg_Decode Only Example
Run the FFmpeg example to verify that the hardware acceleration features of the Alveo U30 media accelerator card are working properly. This example covers decoding a video file into RAW file format and then saving it in a separate directory.
An H.264
formatted file is required for the example run, and you are advised to download a sample file for use.
FFmpeg is free software for recording, converting, and streaming video and audio. For more information, visit the FFmpeg official site.
-
Before testing the example file, complete the setup.
source /opt/xilinx/xcdr/setup.sh
-
Verify that the U30 device is recognized correctly as follows.
...
Number of U30 devices found: 2
{
"response": {
"name": "load",
"requestId": "1",
"status": "ok"
}
}
-----Load xrm plugins-----
{
"response": {
"name": "loadXrmPlugins",
"requestId": "1",
"status": "ok"
}
} -
Execute the example file located in the
/opt/xilinx/examples/u30/ffmpeg/tutorials
directory../01_ffmpeg_decode_only.sh /dev/shm/[sample_file_name]
-
Check to see if the results are displayed as follows.
ffmpeg version n4.4.xlnx.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/opt/xilinx/ffmpeg --datadir=/opt/xilinx/ffmpeg/etc --enable-x86asm --enable-libxma2api --disable-doc --enable-libxvbm --enable-libxrm --enable-libfreetype --enable-libfontconfig --extra-cflags=-I/opt/xilinx/xrt/include/xma2 --extra-ldflags=-L/opt/xilinx/xrt/lib --extra-libs=-lxma2api --extra-libs=-lxrt_core --extra-libs=-lxrt_coreutil --extra-libs=-lpthread --extra-libs=-ldl --disable-static --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
<<<<<<== FFmpeg xrm ===>>>>>>
No device set hence falling to default device 0
------------------i=0------------------------------------------
xclbin_name : /opt/xilinx/xcdr/xclbins/transcode.xclbin
device_id : 0
------------------------------------------------------------
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/dev/shm/livealone_10s.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf60.3.100
Duration: 00:00:10.01, start: 0.000000, bitrate: 3816 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 3677 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
encoder : Lavc60.3.100 libx264
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
[MPSOC H.264 decoder @ 0x557bdd991000] timing information from stream is not available
Stream mapping:
Stream #0:0 -> #0:0 (h264 (mpsoc_vcu_h264) -> rawvideo (native))
Press [q] to stop, [?] for help
[Parsed_xvbm_convert_0 @ 0x557bdd951000] xvbm_conv:: wait for conversion to finish...
Output #0, rawvideo, to '/tmp/xil_dec_out.yuv':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.76.100
Stream #0:0(und): Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 745750 kb/s, 29.97 fps, 29.97 tbn (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
vendor_id : [0][0][0][0]
encoder : Lavc58.134.100 rawvideo
frame= 300 fps=187 q=-0.0 Lsize= 911250kB time=00:00:10.01 bitrate=745750.2kbits/s speed=6.23x
video:911250kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000% -
Finally, verify that the
xil_dec_out.yuv
file has been created in the/tmp/
directory.
FFmpeg_Encode Only Example
The Encode Only example involves passing a RAW 1080p60 clip in YUV420
format to the encoder to generate an H.264 encoded MP4 output at a bitrate of 8Mbps and save it to disk.
This example uses the xil_dec_out.yuv file obtained from the Decode Only example as a sample file, so please perform that example first.
-
Run the example script using the xil_dec_out.yuv file obtained from the Decode Only example.
./02_ffmpeg_encode_only_1080p.sh /tmp/xil_dec_out.yuv
-
After running the example script, check to see if the results are displayed as follows.
ffmpeg version n4.4.xlnx.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/opt/xilinx/ffmpeg --datadir=/opt/xilinx/ffmpeg/etc --enable-x86asm --enable-libxma2api --disable-doc --enable-libxvbm --enable-libxrm --enable-libfreetype --enable-libfontconfig --extra-cflags=-I/opt/xilinx/xrt/include/xma2 --extra-ldflags=-L/opt/xilinx/xrt/lib --extra-libs=-lxma2api --extra-libs=-lxrt_core --extra-libs=-lxrt_coreutil --extra-libs=-lpthread --extra-libs=-ldl --disable-static --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
<<<<<<== FFmpeg xrm ===>>>>>>
No device set hence falling to default device 0
------------------i=0------------------------------------------
xclbin_name : /opt/xilinx/xcdr/xclbins/transcode.xclbin
device_id : 0
------------------------------------------------------------
[rawvideo @ 0x556ccf1d9000] Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from '/tmp/xil_dec_out.yuv':
Duration: 00:00:05.00, start: 0.000000, bitrate: 1492992 kb/s
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 1492992 kb/s, 60 tbr, 60 tbn, 60 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (mpsoc_vcu_h264))
Press [q] to stop, [?] for help
[mpsoc_vcu_h264 @ 0x556ccf172000] Custom Rate Control Mode is Disabled
XRT build version: 2.11.722
Build hash: d1ecc641da7b8805e778926e3354e8dd3fdaa6a8
Build date: 2023-01-25 15:37:40
Git branch: 2021.1
PID: 19271
UID: 1000
[Thu Sep 21 01:17:11 2023 GMT]
HOST: host-10-10-2-47
EXE: /opt/xilinx/ffmpeg/bin/ffmpeg
[XMA] WARNING: ffmpeg xma-vcu-encoder device warning: !! The specified Level is too low and will be adjusted !!
Output #0, mp4, to '/tmp/xil_enc_out.mp4':
Metadata:
encoder : Lavf58.76.100
Stream #0:0: Video: h264 (avc1 / 0x31637661), nv12(tv, progressive), 1920x1080, q=2-31, 8000 kb/s, 60 fps, 15360 tbn
Metadata:
encoder : Lavc58.134.100 mpsoc_vcu_h264
frame= 300 fps= 89 q=-0.0 Lsize= 4877kB time=00:00:04.96 bitrate=8043.4kbits/s speed=1.48x
video:4873kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.075493% -
Verify that the
xil_enc_out.mp4
file has been created in the/tmp/
directory.
FFmpeg_Basic Transcode Example
The basic Transcode example involves taking an H.264 clip and re-encoding it to H.264 at a new bitrate of 8Mbps.
This example uses the xil_enc_out.mp4 file obtained from the Encode Only example, so please perform that example first.
-
Run the example script using the xil_enc_out.mp4 file obtained from the Encode Only example.
./03_ffmpeg_transcode_only.sh /tmp/xil_enc_out.mp4
-
Check to see if the results are displayed as follows.
ffmpeg version n4.4.xlnx.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/opt/xilinx/ffmpeg --datadir=/opt/xilinx/ffmpeg/etc --enable-x86asm --enable-libxma2api --disable-doc --enable-libxvbm --enable-libxrm --enable-libfreetype --enable-libfontconfig --extra-cflags=-I/opt/xilinx/xrt/include/xma2 --extra-ldflags=-L/opt/xilinx/xrt/lib --extra-libs=-lxma2api --extra-libs=-lxrt_core --extra-libs=-lxrt_coreutil --extra-libs=-lpthread --extra-libs=-ldl --disable-static --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
<<<<<<<== FFmpeg xrm ===>>>>>>>>
No device set hence falling to default device 0
------------------i=0------------------------------------------
xclbin_name : /opt/xilinx/xcdr/xclbins/transcode.xclbin
device_id : 0
------------------------------------------------------------
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/xil_enc_out.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.76.100
Duration: 00:00:05.00, start: 0.000000, bitrate: 7989 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 7983 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
[MPSOC H.264 decoder @ 0x556e068ef000] timing information from stream is not available
Stream mapping:
Stream #0:0 -> #0:0 (h264 (mpsoc_vcu_h264) -> h264 (mpsoc_vcu_h264))
Press [q] to stop, [?] for help
[mpsoc_vcu_h264 @ 0x556e06853000] Custom Rate Control Mode is Disabled
XRT build version: 2.11.722
Build hash: d1ecc641da7b8805e778926e3354e8dd3fdaa6a8
Build date: 2023-01-25 15:37:40
Git branch: 2021.1
PID: 19325
UID: 1000
[Thu Sep 21 01:25:49 2023 GMT]
HOST: host-10-10-2-47
EXE: /opt/xilinx/ffmpeg/bin/ffmpeg
[XMA] WARNING: ffmpeg xma-vcu-encoder device warning: !! The specified Level is too low and will be adjusted !!
Output #0, mp4, to '/tmp/xil_xcode.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.76.100
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), xlnx_xvbm_8(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 8000 kb/s, 60 fps, 15360 tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
encoder : Lavc58.134.100 mpsoc_vcu_h264
frame= 300 fps= 89 q=-0.0 Lsize= 4846kB time=00:00:04.96 bitrate=7992.6kbits/s speed=1.47x
video:4842kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.076295% -
Verify that the
xil_xcode.mp4
file has been created in the/tmp/
directory.
GStreamer_Decode Only Example
The Decode Only example verifies that the hardware acceleration features of the Alveo U30 media accelerator card are working properly. Similar to the FFmpeg example, this example involves decoding a video file into RAW file format and then saving it in a separate directory.
An H.264
formatted file is required for the example run, and you can download a sample file for use.
GStreamer is a framework for creating streaming media applications. For more information, visit the GStreamer official site.
-
Set the environment before testing the example file.
source /opt/xilinx/xcdr/setup.sh
-
Verify that the U30 device is recognized correctly as follows.
Number of U30 devices found : 2
{
"response": {
"name": "load",
"requestId": "1",
"status": "ok"
}
}
-----Load xrm plugins-----
{
"response": {
"name": "loadXrmPlugins",
"requestId": "1",
"status": "ok"
}
}
--------------------------------------- -
Execute the example file located in the
/opt/xilinx/examples/u30/gstreamer/tutorials
directory../01_gst_decode_only.sh <Device index> <Input file> <Number of decoder instances, 1 to 8> <Number of buffers> <Fakesink 0/1>
Argument Description <Device index>
The device index on which to run the pipeline <Input file>
Sample file in 8-bit or 10-bit <Number of decoder instances>
The number of instances to run in the same pipeline <Number of buffers>
The actual number of buffers to process, used to specify whether to process a part of a large input stream
- If the value is-1
, the entire video stream is processed<Fakesink 0/1>
Whether to output the resulting file to disk or a fakesink Check the execution result.
./01_gst_decode_only.sh 0 /dev/shm/[sample_file_name] 1 -1 0
-
Check to see if the results are displayed as follows.
H.264
Input file is of type H.264
24
1920
1080
8
fakesink argument is supplied
num-buffers defined
fakesink value is 0
Script is running for filesink ............
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0/GstFileSink:filesink0: sync = false
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, colorimetry=(string)bt709, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)high, level=(string)4.2
/GstPipeline:pipeline0/GstVvas_XVCUDec:vvas_xvcudec0.GstPad:sink: caps = video/x-h264, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, colorimetry=(string)bt709, parsed=(boolean)true, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)high, level=(string)4.2
/GstPipeline:pipeline0/GstVvas_XVCUDec:vvas_xvcudec0.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0/GstFileSink:filesink0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-fllopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0.GstGhostPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)60/1
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0/GstFileSink:filesink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 97, dropped: 0, current: 192.97, average: 192.97
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 193, dropped: 0, current: 191.34, average: 192.15
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 290, dropped: 0, current: 192.43, average: 192.25
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 386, dropped: 0, current: 190.78, average: 191.88
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 482, dropped: 0, current: 191.50, average: 191.80
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 578, dropped: 0, current: 191.86, average: 191.81
Got EOS from element "pipeline0".
Execution ended after 0:00:03.123939154
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ... -
Verify that the
xil_dec_out_*.nv12
file has been created in the/tmp/
directory.
GStreamer_Encode Only Example
The Encode Only example uses 1080p60 NV12
format. It involves passing the clip to the encoder and using the vvas_xvcuenc
plugin to generate an H.264 encoded MP4 output at a bitrate of 8Mbps and save it to disk. This example uses the xil_dec_out_*.nv12
file obtained from the Decode Only example as a sample file, so please perform that example first.
-
Run the example script using the
xil_dec_out_*.nv12
file obtained from the Decode Only example../02_gst_h264_encode_only_1080p.sh <Device index> <Input file> <Number of decoder instances, 1 to 8> <10bit-input 0/1> <Fakesink 0/1>
Argument Description <Device index>
The device index on which to run the pipeline <Input file>
Sample file in 8-bit or 10-bit <Number of encoder instances, 1 to 8>
The number of instances to run in the same pipeline <10bit-input 0/1>
Whether the sample file is 10-bit <Fakesink 0/1>
Whether to output the resulting file to disk or a fakesink Check the execution result.
./02_gst_h264_encode_only_1080p.sh 0 /tmp/xil_dec_out_*.nv12 1 0 0
-
After running the example script, check to see if the results are displayed as follows.
fakesink argument is supplied
8 bit input argument is supplied
nv12
instance number 0
fakesink value is 0
Script is running for filesink ............
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0/GstFileSink:filesink0: sync = false
/GstPipeline:pipeline0/GstRawVideoParse:rawvideoparse0.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstVvasXVCUEnc:vvasxvcuenc0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstVvasXVCUEnc:vvasxvcuenc0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, parsed=(boolean)true, profile=(string)high, level=(string)4.2, codec_data=(buffer)0164002affe100272764002aad00cec0780227e5c05a80810178000003000800000303c19b0003d090007a13fffe0501000428ea43cb
/GstPipeline:pipeline0/GstQTMux:qtmux0.GstQTMuxPad:video_0: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, parsed=(boolean)true, profile=(string)high, level=(string)4.2, codec_data=(buffer)0164002affe100272764002aad00cec0780227e5c05a80810178000003000800000303c19b0003d090007a13fffe0501000428ea43cb
/GstPipeline:pipeline0/GstQTMux:qtmux0.GstPad:src: caps = video/quicktime, variant=(string)apple
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/quicktime, variant=(string)apple
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0/GstFileSink:filesink0.GstPad:sink: caps = video/quicktime, variant=(string)apple
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0.GstGhostPad:sink: caps = video/quicktime, variant=(string)apple
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0/GstFileSink:filesink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 48, dropped: 0, current: 93.96, average: 93.96
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 94, dropped: 0, current: 90.71, average: 92.34
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 139, dropped: 0, current: 89.41, average: 91.37
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 185, dropped: 0, current: 90.19, average: 91.07
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 231, dropped: 0, current: 90.20, average: 90.90
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 277, dropped: 0, current: 90.46, average: 90.83
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 323, dropped: 0, current: 90.36, average: 90.76
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 369, dropped: 0, current: 90.95, average: 90.78
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 415, dropped: 0, current: 91.20, average: 90.83
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 461, dropped: 0, current: 91.20, average: 90.87
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 507, dropped: 0, current: 91.21, average: 90.90
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 553, dropped: 0, current: 91.17, average: 90.92
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 598, dropped: 0, current: 87.25, average: 90.63
...
Got EOS from element "pipeline0".
Execution ended after 0:00:06.602619147
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ... -
Verify that the
xil_enc_out_*.mp4
file has been created in the/tmp/
directory.
GStreamer_Basic Transcode Example
The basic Transcode example explains how to take an H.264 clip and re-encode it to H.264 using a new bitrate of 8Mbps. This example uses the xil_enc_out.mp4 file obtained from the Encode Only example, so please perform that example first.
-
Run the example script using the xil_enc_out.mp4 file obtained from the Encode Only example.
./03_gst_h264_transcode_only.sh <Device index> <Input file> <Number of decoder instances, 1 to 8> <Number of buffers> <Fakesink 0/1>
Argument Description <Device index>
The device index on which to run the pipeline <Input file>
Sample file in 8-bit or 10-bit <Number of transcode instances, 1 to 8>
The number of instances to run in the same pipeline <Number of buffers>
The actual number of buffers to process, used to specify whether to process a part of a large input stream
- If the value is-1
, the entire video stream is processed<Fakesink 0/1>
Whether to output the resulting file to disk or a fakesink Check the execution result.
./03_gst_h264_transcode_only.sh 0 /tmp/xil_enc_out_*.mp4 1 -1 0
-
After running the example script, check to see if the results are displayed as follows.
Quicktime
H.264
Input file is of type Quicktime H.264
fakesink argument is supplied
num-buffers defined
0
fakesink value is 0
Script is running for filesink ............
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0/GstFileSink:filesink0: sync = false
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4.2, profile=(string)high, codec_data=(buffer)0164002affe100272764002aad00cec0780227e5c05a80810178000003000800000303c19b0003d090007a13fffe0501000428ea43cb, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt709
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4.2, profile=(string)high, codec_data=(buffer)0164002affe100272764002aad00cec0780227e5c05a80810178000003000800000303c19b0003d090007a13fffe0501000428ea43cb, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt709
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4.2, profile=(string)high, codec_data=(buffer)0164002affe100272764002aad00cec0780227e5c05a80810178000003000800000303c19b0003d090007a13fffe0501000428ea43cb, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt709
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)4.2, profile=(string)high, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
/GstPipeline:pipeline0/GstVvas_XVCUDec:vvas_xvcudec0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, level=(string)4.2, profile=(string)high, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
/GstPipeline:pipeline0/GstVvas_XVCUDec:vvas_xvcudec0.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-fllopped/right-flipped/right-fllopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-fllopped/right-flipped/right-fllopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstVvasXVCUEnc:vvasxvcuenc0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-fllopped/right-flipped/right-fllopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)60/1
/GstPipeline:pipeline0/GstVvasXVCUEnc:vvasxvcuenc0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-fllopped/right-flipped/right-fllopped/half-aspect/mixed-mono
/GstPipeline:pipeline0/GstH264Parse:h264parse1.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-fllopped/right-flipped/right-fllopped/half-aspect/mixed-mono
/GstPipeline:pipeline0/GstH264Parse:h264parse1.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-fllopped/right-flipped/right-fllopped/half-aspect/mixed-mono, parsed=(boolean)true, profile=(string)high, level=(string)4.2, codec_data=(buffer)0164002affe100272764002aad00cec0780227e5c05a80810178000003000800000303c19b0003d090007a13fffe0501000428ea43cb
/GstPipeline:pipeline0/GstQTMux:qtmux0.GstQTMuxPad:video_0: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-fllopped/right-flipped/right-fllopped/half-aspect/mixed-mono, parsed=(boolean)true, profile=(string)high, level=(string)4.2, codec_data=(buffer)0164002affe100272764002aad00cec0780227e5c05a80810178000003000800000303c19b0003d090007a13fffe0501000428ea43cb
/GstPipeline:pipeline0/GstQTMux:qtmux0.GstPad:src: caps = video/quicktime, variant=(string)apple
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/quicktime, variant=(string)apple
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0/GstFileSink:filesink0.GstPad:sink: caps = video/quicktime, variant=(string)apple
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0.GstGhostPad:sink: caps = video/quicktime, variant=(string)apple
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0/GstFileSink:filesink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 47, dropped: 0, current: 93.74, average: 93.74
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 93, dropped: 0, current: 90.61, average: 92.16
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 138, dropped: 0, current: 88.21, average: 90.84
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 184, dropped: 0, current: 90.33, average: 90.71
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 230, dropped: 0, current: 90.17, average: 90.60
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 276, dropped: 0, current: 90.33, average: 90.55
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 322, dropped: 0, current: 90.32, average: 90.52
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 368, dropped: 0, current: 90.89, average: 90.57
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 414, dropped: 0, current: 91.17, average: 90.63
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 460, dropped: 0, current: 91.18, average: 90.69
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 506, dropped: 0, current: 91.10, average: 90.73
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 552, dropped: 0, current: 91.15, average: 90.76
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink_0: last-message = rendered: 598, dropped: 0, current: 87.38, average: 90.49
...
Got EOS from element "pipeline0".
Execution ended after 0:00:06.611305520
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ... -
Verify that the
xil_xcode_*.mp4
file has been created in the/tmp/
directory.
- Find more examples in the Tutorials and Examples section of the official AMD Xilinx Video SDK documentation.
- If you encounter any issues with the use of the AMD Xilinx Video SDK, please refer to the Limitations and Known Issues.