ファイル
Rajy Rawther 40e072f394 FFMpeg decoder rocdecode integration (#583)
* initial commit

* initial implementation for host based decoder

* minor change

* cmake changes and added new sample

* rocdecDecode sample implementation

* rocdecode sample changes working

* working version of avcodec decoder and sample

* Add end of stream handling for repeated decoding with reconfigure

* reorg files and added changelog

* update readme

* revert file

* remove unused class members

* addressed reviw comment for changelog

* fix sample to work on more video files

* resolved review comments

* bumped version to 0.14.0

* fixed build warnings

* addressed review comments

* addressed review comments

* addressed review comments

* fixed readme to match .cpp file options for parameters

* updated review comments, readme, and added test data for the sample

* fixed bug for saving frame for 10 bit videos

* addressed review comments

* addressed all the new review comments

[ROCm/rocdecode commit: 3ddb12f075]
2025-06-07 13:12:57 -04:00

2.3 KiB

rocdecDecode sample

The rocdec decode sample illustrates decoding of individual frames of video elementary stream data using the rocDecoder and rocDecodeHost low level api to get the individual decoded frames in YUV format. This sample can be configured with a device ID and optionally able to dump the output to a file. This sample directly uses low-level Rocdecoder/RocDecoderHost api. This sample only works with raw elementary video frame files, and not with packetized data. Typical input to this sample is a folder containing extracted individual video frames of one or more video files. The files containing individual frames has to be numbered in ascending order of frames, otherwise the output will be corrupted since the parser assumes random order for those files which can result in corrupted reference frames.

Note: If the input is a packetized file like ".mp4", the sample will treat it as a single video frame and output will not be correct.

Prerequisites:

  • Install rocDecode

  • FFMPEG for rocDecodeHost

    • On Ubuntu
    sudo apt install libavcodec-dev libavformat-dev libavutil-dev
    
    • On RHEL/SLES - install ffmpeg development packages manually or use rocDecode-setup.py script

Build

mkdir rocdec_decode_sample && cd rocdec_decode_sample
cmake ../
make -j

Run

./rocdecdecode -i <input video frame file or folder containing multiple frames [required]> -b <backend> -o <outfile>
              -o <output path to save decoded YUV frames [optional]> 
              -d <GPU device ID - 0:device 0 / 1:device 1/ ... [optional - default:0]>
              -b <backend for the decoder - 0:device 1:host [optional - default:0]>
              -c <codec - 0 : HEVC, 1 : H264, 2: AV1, 4: VP9, 5: VP8, 6: MJPEG [optional; default: 0]>
              -n <Number of iteration - specify the number of iterations for performance evaluation [optional; default: 1]>
              -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/3 : OUT_SURFACE_MEM_NOT_MAPPED]>
"./rocdecdecode -i ROCDECODE_DATA_FOLDER/frames -o <output.yuv> -b 0".