Image Play (nvmimg_play)

This topic describes how to use the Image Play sample application, nvmimg_play, for stream decoding. The application supports the following bitstream types:
H.264
H.265
VP9
The application can display decoded frames on the screen (playback) and/or 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
-d <display_id>
Specifies the display ID.
No display
-w <window_id>
Specifies the window ID.
1
-p <x0>:<y0>:<w>:<h>
Specifies the display window position and size, in pixels.
Full screen display
-z <window_depth>
Specifies the display window depth. Permissible values are [0,255].
1
-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 will be 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 perform basic playback
To start a playback of the disney.264 file on window ID 0, enter this command:
$ ./nvmimg_play -c 1 -f disney.264 -d 0
To manipulate the display window
This command illustrates display window manipulation:
$ ./nvmimg_play -c 1 -f disney.264 -d 0 -w 2 -z 20 -p 100:200:500:600
In this example:
Playback starts on display ID 0.
Window number is 2.
The display window position is: x0=100, y0=200, width=500, height=600.
Window depth is 20.
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 -d 0 -n 100
The command streams the first 100 frames from the disney.264 file to display ID 0.
To specify the number of loops
Enter this command:
$ ./nvmimg_play -c 1 -f disney.264 -d 0 -l 10
The command plays disney.264 ten times and streams the video to display ID 0.
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 plays 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 plays the stream disney.264 and computes CRC of the decoded YUV and compares it with the reference CRC disney_PitchLinear_Ref_CRC.txt.
It will print whether the CRC matches to 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 plays the stream disney.264 and prints the information of the average time taken per frame and the total time taken for the sequence.