Files
rocm-systems/samples/videoDecode
jeffqjiangNew e62aa3e09b Added the bit stream reader feature. (#433)
* * rocDecode/ES parser: Added elementary stream file parser for HEVC and AVC.

* * rocDecode/ES parser: Added elementary stream file parser for AV1. Also cleaned up the bitstream ring buffer code.

* * rocDecode/ES parser: Added the IVF container file parser for AV1. Also fixed a bug in fill ring buffer function.

* * rocDecode/ES file parder: Added supported stream type detection.
 - The stream type detection checks the unique syntax patterns of the stream type and calculate the likeliheed score. Based on the score, the most likely type is determined.
 - The current supported stream types are: AVC/HEVC/AV1 elementary streams, IVF AV1 streams.

* * rocDecode/ES file parser: Fixed an AVC decode regression due to a copy and paste error.

* * rocDecode/ES file parser: Added bit depth parsing for codec support check; Added stronger AV1 detection for IVF AV1 stream type.

* * rocDecode/ES file parser: Removed debugging logs.

* * rocDecode/ES file parser: Added exmaple code to use the built-in file parser.

* * rocDecode/Bitstream reader: Renamed the elementary parser feature to bitstream reader and re-organized the code.
 - Moved the bitstream reader code to rocDecode core lib from utility.
 - Added bitstream reader interface in parallel with rocDecode parser and decoder interfaces.

* * rocDecode/Bitstream reader: Added sample to use bitstream reader, instead of FFMPEG demuxer, to get picture data. Also reverted the original sample app back to using FFMPEG demuxer only.

* * rocDecode/Bitstream reader: Renamed the new sample app.

* * rocDecode/Bitstream reader: FFMPEG dependency reduction.
 - Moved MD5 functions out of RocVideoDecoder utility class. This removed RocVideoDecoder's dependency on FFMPEG.
 - Added the new MD5 utility, which depends on FFMPEG lib. MD5 message digest generation is now performed in the MD5 utility.
 - Modified decode sampples that uses MD5 generation function.
 - Removed FFMPEG dependency from video decoder basic sample.

* * rocDecode/Bitstream reader: Added option to use bitstream reader to video decode sample and conformance test script. Added the missing destroy bitstream reader call in video decode basic sample.

* * rocDecode/Bitstream reader: Minor format change. No functional changes.

* * rocDecode/Bitstream reader: Added handling of unsupported stream file type by the bitstream reader to decode sample apps.

* * rocDecode/Bitstream reader: Fixed build errors of several samples.

* * rocDecode/Bitstream reader: Added changes based on review comments.

* * rocDecode/Bitstream reader: File name changes based on review comments.

* * rocDecode/Bitstream reader: Moved MD5 code into single header file. Added changes based on review comments.

* * rocDecode/Bitstream reader: Removed redundant path.

* * rocDecode/Bitstream reader: Changed rocDecode version to 0.10.0. Added minor changes based on review comments.

---------

Co-authored-by: Kiriti Gowda <kiritigowda@gmail.com>
2024-12-05 09:46:24 -05:00
..

Video decode sample

The video decode sample illustrates decoding a single packetized video stream using FFMPEG demuxer, video parser, and rocDecoder 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 uses the high-level RocVideoDecoder class which connects both the video parser and Rocdecoder. This process repeats in a loop until all frames have been decoded.

Prerequisites:

  • Install rocDecode

  • FFMPEG

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

Build

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

Run

./videodecode -i <input video file [required]> 
              -o <output path to save decoded YUV frames [optional]> 
              -d <GPU device ID - 0:device 0 / 1:device 1/ ... [optional - default:0]>
              -f <Number of decoded frames - specify the number of pictures to be decoded [optional]>
              -z <force_zero_latency - Decoded frames will be flushed out for display immediately [optional]>
              -disp_delay <display delay - specify the number of frames to be delayed for display [optional - default: 1]>
              -sei <extract SEI messages [optional]>
              -md5 <generate MD5 message digest on the decoded YUV image sequence [optional]>
              -md5_check MD5_File_Path <generate MD5 message digest on the decoded YUV image sequence and compare to the reference MD5 string in a file [optional]>
              -crop <crop rectangle for output (not used when using interopped decoded frame) [optional - default: 0,0,0,0]>
              -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]>
              -no_ffmpeg_demux <use the built-in bitstream reader instead of FFMPEG demuxer to obtain picture data [optional]>