Image Decode (nvmimg_play)
This topic describes how to use the Image Decode sample application, nvmimg_play, for stream decoding. The application supports the following bitstream types:
• H.264
• H.265
• VP9
The application can decode a compressed bitstream and save decoded frames to an output YUV file.
Command Line Options
The application’s command syntax is:
$ ./nvmimg_play [options]
Required Options
This table describes the required command line options:
Option | Parameter | Description |
-c | [codec_type] | Specifies numeric or textual codec type. You can specify it with integers: • 1: H.264 • 2: H265 • 3: VP9 Or with strings: • h264 • h265 • vp9 |
-f | [input_file] | Specifies the input file to decode. |
Optional Options
This table describes the optional command line arguments:
Option | Description | Default |
-r <frame_rate> | Specifies the frame rate, in frames/second. | N/A |
-n <frame_number> | Specifies the minimum number of frames to decode. | Unlimited |
-s <output_file> | Specifies a file where output YUV is to be saved. | |
-v <level> | Specifies the logging level. Value may be: • 0: Errors (default) • 1: Warnings • 2: Info • 3: Debug | 0 |
-h | Prints usage and help information. | |
-id <instance_id> | Specifies the nvdec instance id to be used for decoding. Value may be 0 or 1. | 0 |
-crc <gen/chk> | Enable CRC checks (chk) or generate CRC file (gen) | False |
-crcpath <path> | Path for CRC of the picture | Null |
-cropcrc | CRC is calculated on actual resolution | False |
-t | Displays decode timing information (per frame avg time and total time) | Information is not displayed. |
Examples
This topic provides examples of how to run the application.
To save decoded frames to an output file
• Enter this command:
$ ./nvmimg_play -c 1 -f disney.264 -s disney_out.yuv
The command decodes the disney.264 stream and saves the decoded frames to the file disney_out.yuv.
To specify the number of frames to decode
• Enter this command:
$ ./nvmimg_play -c 1 -f disney.264 -n 100
The command decodes the first 100 frames from the disney.264 file without dumping the output to a file
To specify the number of loops
• Enter this command:
$ ./nvmimg_play -c 1 -f disney.264 -l 10
The command decodes disney.264 ten times in a loop without dumping the output to a file.
To generate CRC for decoded YUV
• Enter this command:
./nvmimg_play -c 4 -f disney.264 -crc gen -crcpath disney_PitchLinear_Ref_CRC.txt
This example decodes the stream disney.264 and generates CRC of the decoded YUV and saves it into the given file path disney_PitchLinear_Ref_CRC.txt.
To check CRC for decoded YUV against a reference CRC
• Enter this command:
./nvmimg_play -c 4 -f disney.264 -crc chk -crcpath disney_PitchLinear_Ref_CRC.txt
This example decodes the stream disney.264 and computes CRC of the decoded YUV and compares it with the reference CRC disney_PitchLinear_Ref_CRC.txt.
It prints whether the CRC matches the reference. If there is a mismatch, then the decoding result is incorrect.
To get the decode timing information
• Enter this command:
./nvmimg_play -c 4 -f disney.264 -t
This example decodes the stream disney.264 and prints the information of the average time taken per frame and the total time for the sequence.