2024-01-26 05:19:24 -08:00
# Video decode fork sample
2023-11-10 08:28:24 -08:00
2024-01-26 05:19:24 -08:00
The video decode fork sample creates multiple processes which demux and decode the same video in parallel. The demuxer uses FFMPEG to get the individual frames which are then sent to the decoder APIs. The sample uses shared memory to keep count of the number of frames decoded in the different processes. Each child process needs to exit successfully for the sample to complete successfully.
2023-11-10 08:28:24 -08:00
2024-01-26 05:19:24 -08:00
This sample shows scaling in performance for `N` VCN engines as per GPU architecture.
2023-11-10 08:28:24 -08:00
2024-01-26 05:19:24 -08:00
## Prerequisites:
2023-11-10 08:28:24 -08:00
2024-01-26 05:19:24 -08:00
* Install [rocDecode ](../../README.md#build-and-install-instructions )
2023-11-10 08:28:24 -08:00
2024-01-26 05:19:24 -08:00
* [FFMPEG ](https://ffmpeg.org/about.html )
2023-11-10 08:28:24 -08:00
2024-01-26 05:19:24 -08:00
* On `Ubuntu`
2023-11-10 08:28:24 -08:00
2024-01-26 05:19:24 -08:00
```shell
sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev
2023-11-10 08:28:24 -08:00
` ``
2024-01-26 05:19:24 -08:00
* On ` RHEL`/` SLES` - install ffmpeg development packages manually or use [rocDecode-setup.py](../../rocDecode-setup.py) script
2023-11-10 08:28:24 -08:00
## Build
2024-01-26 05:19:24 -08:00
` ``shell
mkdir video_decode_fork_sample && cd video_decode_fork_sample
2023-11-10 08:28:24 -08:00
cmake ../
make -j
` ``
2024-01-26 05:19:24 -08:00
## Run
` ``shell
2023-11-10 08:28:24 -08:00
./videodecodefork -i <input video file [required]>
2023-11-29 08:21:22 -08:00
-f <Number of forks ( >= 1) [optional; default:4]>
-d <Device ID (>= 0) [optional - default:0]>
-z <force_zero_latency - Decoded frames will be flushed out for display immediately [optional]>
2023-11-30 05:31:37 -08:00
-m <output_surface_memory_type - decoded surface memory [optional - default: 0][0 : OUT_SURFACE_MEM_DEV_INTERNAL/ 1 : OUT_SURFACE_MEM_DEV_COPIED/ 2 : OUT_SURFACE_MEM_HOST_COPIED]>
2023-11-10 08:28:24 -08:00
` ``