GStreamer Examples using Software Filters¶
The /opt/amd/ama/ma35/examples/gstreamer/ama_pipeline_scripts/filters/
folder contains different examples showing how to use GStreamer combining both AMD accelerated functions and software filters. In all these examples, an AMA compatible device, e.g., MA35D, is used to decode the input stream, the decoded frames are transfered back to the host using the ama_download
filter, one of more software filters are applied to the decoded frames and the filtered frames are transfered back to the device using ama_upload
for encoding. It should be noted that, when possible, zero-copy filters such as tee
should be used, to minimize the traffic between the host CPU and target device.
In the following sections, description of command line options is done in an accumulative manner, i.e., previously described options are not explained further.
Environment Setup¶
The AMD AMA Video SDK version of FFmpeg, Gstreamer and XMA applications can be found in the /opt/amd/ama/ma35/bin folder of your system. If this folder is not present, install the required packages:
See On Premises
Configure the environment to use the AMD AMA Video SDK. This a mandatory step for all applications:
source /opt/amd/ama/ma35/scripts/setup.sh
The setup script exports important environment variables and ensures proper execution environment for AMD AMA Video SDK.
Sourcing the setup script should be performed each time you open a new terminal on your system. This is required for the environment to be correctly configured.
Video Rotation¶
Example script:
01_rotate_video.sh
This example accepts an 8-bit, YUV420, pre-encoded h264 file and will send the rotated, encoded h.264 output to /tmp/xil_rotate_<N>.mp4.
Logo Overlay¶
Example script:
02_logo_overlay.sh
This example accepts an 8-bit, YUV420, pre-encoded h264 file and an image file ("logo"). It will scale the logo to 500x100, place it 16 pixels right and 16 pixels down from the top-left corner of the output video file, which will be an encoded h.264 output saved to /tmp/xil_logo_overlay.mp4.
Crop and Zoom¶
Example script:
03_crop_zoom.sh
This example accepts an 8-bit, YUV420, pre-encoded h264 file and will crop a 300x200 sized section of the original video. The section's top left corner begins at 20 pixels to the right, and 10 pixels down from the top-left corner of the original video. The output video is h.264 encoded and is saved to /tmp/xil_crop_zoom.mp4
Video Composition¶
Example script:
04_multi_comp.sh
This example accepts 4x 8-bit, YUV420, pre-encoded h264 files of equal dimensions, and will create an output 2x2 composite video which will be an encoded h.264 output saved to /tmp/xil_multi_comp.mp4. The output resolution will be equal to the original input.