2024-01-12 12:35:53 -08:00
[](https://opensource.org/licenses/MIT)
2024-01-31 17:51:10 -08:00
<p align="center"><img width="70%" src="docs/data/AMD_rocDecode_Logo.png" /></p>
2023-11-21 11:08:36 -07:00
2024-02-27 14:42:03 -07:00
rocDecode is a high-performance video decode SDK for AMD GPUs. Using the rocDecode API, you can
access the video decoding features available on your GPU.
2024-01-12 12:35:53 -08:00
## Supported codecs
2023-11-21 11:08:36 -07:00
2023-11-06 12:10:12 -05:00
* H.265 (HEVC) - 8 bit, and 10 bit
2024-04-11 13:36:27 -04:00
* H.264 (AVC) - 8 bit
2024-07-22 12:32:12 -04:00
* AV1 - 8 bit, and 10 bit
2023-10-12 14:08:12 -07:00
2023-11-21 11:08:36 -07:00
## Prerequisites
2023-07-26 17:47:47 -04:00
* Linux distribution
2024-02-27 14:42:03 -07:00
* Ubuntu - `20.04` / `22.04`
* RHEL - `8` / `9`
2024-08-14 14:28:52 -07:00
* SLES - `15 SP5`
2023-11-21 11:08:36 -07:00
2024-02-27 15:16:01 -08:00
* [ROCm-supported hardware ](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html )
> [!IMPORTANT]
> `gfx908` or higher GPU required
2023-07-26 17:47:47 -04:00
2024-03-07 14:17:09 -08:00
* Install ROCm `6.1.0` or later with [amdgpu-install ](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/amdgpu-install.html ): Required usecase - rocm
2024-02-27 15:16:01 -08:00
> [!IMPORTANT]
2024-03-07 14:17:09 -08:00
> `sudo amdgpu-install --usecase=rocm`
2024-08-14 14:28:52 -07:00
* [Video Acceleration API ](https://en.wikipedia.org/wiki/Video_Acceleration_API ) Version `1.5.0` or later - `Libva` is an implementation for VA-API
2024-03-07 14:17:09 -08:00
```shell
2024-04-16 12:53:15 -07:00
sudo apt install libva-dev
2024-03-07 14:17:09 -08:00
` ``
2024-03-12 13:10:57 -07:00
> [!NOTE]
2024-04-16 12:53:15 -07:00
> RPM Packages for ` RHEL`/` SLES` - ` libva-devel`
* AMD VA Drivers
` ``shell
sudo apt install mesa-amdgpu-va-drivers
` ``
2023-11-29 20:59:06 -05:00
2024-08-14 14:28:52 -07:00
* CMake Version ` 3.5` or later
2024-01-24 11:11:14 -07:00
2024-02-27 14:42:03 -07:00
` ``shell
sudo apt install cmake
` ``
2023-11-29 20:59:06 -05:00
2024-08-14 14:28:52 -07:00
* Clang Version ` 5.0.1` or later
` ``shell
sudo apt install clang
` ``
2024-01-12 12:35:53 -08:00
* [pkg-config](https://en.wikipedia.org/wiki/Pkg-config)
2024-01-24 11:11:14 -07:00
2024-02-27 14:42:03 -07:00
` ``shell
sudo apt install pkg-config
` ``
2024-01-12 12:35:53 -08:00
2024-02-27 14:42:03 -07:00
* [FFmpeg](https://ffmpeg.org/about.html) runtime and headers - for tests and samples
2024-01-24 11:11:14 -07:00
2024-02-27 14:42:03 -07:00
` ``shell
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev
` ``
2024-01-12 12:35:53 -08:00
2024-02-27 15:16:01 -08:00
> [!IMPORTANT]
2024-05-03 13:27:58 -07:00
> * On ` Ubuntu 22.04` - Additional package required: ` libstdc++-12-dev`
2024-02-28 09:33:56 -08:00
>
> ` ``shell
> sudo apt install libstdc++-12-dev
> ` ``
2024-05-01 11:35:49 -07:00
>
2024-05-03 13:27:58 -07:00
> * On ` RHEL`/` SLES` - Additional packages required: ` libdrm-amdgpu` and ` mesa-amdgpu-dri-drivers`
>
> ` ``shell
> sudo yum install libdrm-amdgpu mesa-amdgpu-dri-drivers
> ` ``
2024-01-24 11:11:14 -07:00
2024-02-27 14:42:03 -07:00
>[!NOTE]
2024-02-27 15:16:01 -08:00
> * All package installs are shown with the ` apt` package manager. Use the appropriate package manager for your operating system.
> * To install rocDecode with minimum requirements, follow the [quick-start](./docs/install/quick-start.rst) instructions
2024-01-24 11:11:14 -07:00
2024-02-27 14:42:03 -07:00
### Prerequisites setup script
2023-12-13 06:49:52 -08:00
2024-04-16 15:05:17 -07:00
For your convenience, we provide the setup script, [rocDecode-setup.py](https://github.com/ROCm/rocDecode/blob/develop/rocDecode-setup.py), which installs all required dependencies. Run this script only once.
2024-01-24 11:11:14 -07:00
2023-12-13 06:49:52 -08:00
` ``shell
2024-03-27 21:23:53 -07:00
python3 rocDecode-setup.py --rocm_path [ ROCm Installation Path - optional (default:/opt/rocm)]
2024-06-13 14:10:56 -07:00
--runtime [ Setup runtime requirements - optional (default:ON) [options:ON/OFF]]
2024-03-27 21:23:53 -07:00
--developer [ Setup Developer Options - optional (default:OFF) [options:ON/OFF]]
2023-12-13 06:49:52 -08:00
` ``
2024-01-24 11:11:14 -07:00
2024-02-27 14:42:03 -07:00
## Installation instructions
2023-07-26 17:47:47 -04:00
2024-02-27 15:16:01 -08:00
The installation process uses the following steps:
* [ROCm-supported hardware](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html) install verification
2024-03-07 14:17:09 -08:00
* Install ROCm ` 6.1.0` or later with [amdgpu-install](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/amdgpu-install.html) with ` --usecase=rocm`
2024-02-27 15:16:01 -08:00
2024-04-16 15:05:17 -07:00
* Use **either** [package install](#package-install) **or** [source install](#source-install) as described below.
2023-11-21 11:08:36 -07:00
2024-01-09 10:43:34 -08:00
### Package install
2024-01-12 12:35:53 -08:00
2024-02-27 14:42:03 -07:00
To install rocDecode runtime, development, and test packages, run the line of code for your operating
system.
2024-01-24 11:11:14 -07:00
2024-02-27 15:16:01 -08:00
* Runtime package - ` rocdecode` only provides the rocdecode library ` librocdecode.so`
* Development package - ` rocdecode-dev`/` rocdecode-devel` provides the library, header files, and samples
* Test package - ` rocdecode-test` provides CTest to verify installation
#### Ubuntu
2024-01-12 13:18:28 -08:00
2024-02-27 14:42:03 -07:00
` ``shell
sudo apt install rocdecode rocdecode-dev rocdecode-test
` ``
2023-10-12 14:08:12 -07:00
2024-02-27 15:16:01 -08:00
#### RHEL
2024-01-24 11:11:14 -07:00
2024-02-27 14:42:03 -07:00
` ``shell
sudo yum install rocdecode rocdecode-devel rocdecode-test
` ``
2024-01-24 11:11:14 -07:00
2024-02-27 15:16:01 -08:00
#### SLES
2024-01-24 11:11:14 -07:00
2024-02-27 14:42:03 -07:00
` ``shell
sudo zypper install rocdecode rocdecode-devel rocdecode-test
` ``
2024-01-24 11:11:14 -07:00
2024-02-27 14:42:03 -07:00
>[!NOTE]
> Package install auto installs all dependencies.
2024-01-24 11:11:14 -07:00
2024-02-27 15:16:01 -08:00
> [!IMPORTANT]
> ` RHEL`/` SLES` package install requires manual ` FFMPEG` dev install
2023-07-26 17:47:47 -04:00
2024-02-27 14:42:03 -07:00
### Source install
2024-02-27 11:52:50 -08:00
2024-02-28 09:33:56 -08:00
To build rocDecode from source and install, run:
2024-01-09 10:43:34 -08:00
` ``shell
git clone https://github.com/ROCm/rocDecode.git
cd rocDecode
2024-02-28 09:33:56 -08:00
python3 rocDecode-setup.py
2024-01-09 10:43:34 -08:00
mkdir build && cd build
cmake ../
make -j8
sudo make install
` ``
2024-02-28 09:33:56 -08:00
#### Run tests
2023-11-21 11:08:36 -07:00
` ``shell
2023-10-12 14:08:12 -07:00
make test
` ``
2024-02-27 15:16:01 -08:00
> [!IMPORTANT]
> make test requires ` FFMPEG` dev install
2024-01-24 11:11:14 -07:00
2024-02-27 15:16:01 -08:00
>[!NOTE]
> To run tests with verbose option, use ` make test ARGS="-VV"`.
2024-02-27 14:42:03 -07:00
2024-02-28 09:33:56 -08:00
#### Make package
2023-10-12 14:08:12 -07:00
2023-11-21 11:08:36 -07:00
` ``shell
2024-01-09 10:43:34 -08:00
sudo make package
2023-10-12 14:08:12 -07:00
` ``
2024-01-12 12:35:53 -08:00
## Verify installation
2023-11-06 08:51:47 -08:00
2024-02-27 14:42:03 -07:00
The installer copies:
2023-11-06 08:51:47 -08:00
2023-11-23 05:57:45 -08:00
* Libraries into ` /opt/rocm/lib`
* Header files into ` /opt/rocm/include/rocdecode`
* Samples folder into ` /opt/rocm/share/rocdecode`
* Documents folder into ` /opt/rocm/share/doc/rocdecode`
2023-11-06 08:51:47 -08:00
2024-02-27 15:16:01 -08:00
### Using sample application
2024-02-28 09:33:56 -08:00
2024-02-27 15:16:01 -08:00
To verify your installation using a sample application, run:
2023-11-06 08:51:47 -08:00
2024-02-27 14:42:03 -07:00
` ``shell
mkdir rocdecode-sample && cd rocdecode-sample
cmake /opt/rocm/share/rocdecode/samples/videoDecode/
make -j8
./videodecode -i /opt/rocm/share/rocdecode/video/AMD_driving_virtual_20-H265.mp4
` ``
2024-01-12 12:35:53 -08:00
2024-02-27 15:16:01 -08:00
### Using test package
2024-02-28 09:33:56 -08:00
2024-02-27 15:16:01 -08:00
To verify your installation using the ` rocdecode-test` package, run:
2024-01-12 12:35:53 -08:00
2024-02-27 14:42:03 -07:00
` ``shell
mkdir rocdecode-test && cd rocdecode-test
cmake /opt/rocm/share/rocdecode/test/
ctest -VV
` ``
2024-01-12 12:35:53 -08:00
2023-11-21 11:08:36 -07:00
## Samples
2024-02-27 14:42:03 -07:00
You can access samples to decode your videos in our
[GitHub repository](https://github.com/ROCm/rocDecode/tree/develop/samples). Refer to the
individual folders to build and run the samples.
2023-11-06 08:51:47 -08:00
2024-02-27 14:42:03 -07:00
[FFmpeg](https://ffmpeg.org/about.html) is required for sample applications and ` make test`. To install
FFmpeg, refer to the instructions listed for your operating system:
2023-11-21 11:08:36 -07:00
2024-02-27 14:42:03 -07:00
* Ubuntu:
2024-01-24 11:11:14 -07:00
2023-11-21 11:08:36 -07:00
` ``shell
2023-11-29 02:38:24 +05:30
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev
2023-11-06 08:51:47 -08:00
` ``
2024-02-27 14:42:03 -07:00
* RHEL/SLES:
Install ffmpeg development packages manually or use ` rocDecode-setup.py` script
2023-11-06 08:51:47 -08:00
2023-11-21 11:08:36 -07:00
## Docker
2024-02-27 14:42:03 -07:00
You can find rocDecode Docker containers in our
[GitHub repository](https://github.com/ROCm/rocDecode/tree/develop/docker).
2023-10-12 14:08:12 -07:00
## Documentation
2024-02-27 14:42:03 -07:00
Run the following code to build our documentation locally.
2024-01-24 11:11:14 -07:00
2023-11-21 11:08:36 -07:00
` ``shell
cd docs
pip3 install -r sphinx/requirements.txt
python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
2023-10-12 14:08:12 -07:00
` ``
2023-11-21 11:08:36 -07:00
2024-02-27 14:42:03 -07:00
For more information on documentation builds, refer to the
[Building documentation](https://rocm.docs.amd.com/en/latest/contribute/building.html)
page.
2024-02-27 15:16:01 -08:00
## Tested configurations
* Linux
* Ubuntu - ` 20.04` / ` 22.04`
* RHEL - ` 8` / ` 9`
2024-08-14 14:28:52 -07:00
* SLES - ` 15 SP5`
2024-02-27 15:16:01 -08:00
* ROCm:
2024-08-14 14:28:52 -07:00
* rocm-core - ` 6.2.0.60200-66`
* amdgpu-core - ` 1:6.2.60200-2009582`
2024-04-16 15:05:17 -07:00
* libva-dev - ` 2.7.0-2` / ` 2.14.0-1`
2024-08-14 14:28:52 -07:00
* mesa-amdgpu-va-drivers - ` 1:24.2.0.60200-2009582`
2024-05-02 12:47:26 -07:00
* mesa-amdgpu-dri-drivers - ` 24.1.0.60200`
2024-02-27 15:16:01 -08:00
* FFmpeg - ` 4.2.7` / ` 4.4.2-0`
2024-08-14 14:28:52 -07:00
* rocDecode Setup Script - ` V2.2.0`