Video Demo (nvmvid_play)
This topic describes how to use the Video Demo sample application, nvmvid_play, for stream decoding and playback. The application supports these stream types:
• MPEG
• MPEG-4
• VC1
• H.264
• H.265
• VP8
• VP9
Command Line Switches
The application’s command syntax is:
./nvmvid_play [switches]
Required Commands
Required Switches
This table describes the required command line switches:
Switch | Description |
-c <codec_type> | Specifies the codec type. You can specify the type with an integer or a string: • 1 or mpeg: MPEG • 2 or mpeg4: MPEG-4 • 3 or vc1: VC1 • 4 or h264: H.264 • 5 or vp8: VP8 • 6 or h265: H265 • 7 or vp9: VP9 |
-f <input_file> | Specifies the input file to decode. |
Other Switches
This table describes the optional command line switches:
Switch | Description | Default |
-t | Displays decode timing information. Default: Not displayed. | Information is not displayed. |
-r <frame_rate> | Specifies the frame rate in frames/second. | N/A |
-n <frames> | Specifies the minimum number of frames to decode. | Decodes the whole stream. |
-l <loops> | Specifies the number of playback loops. | 1 |
-s <output_file> | Specifies the output YUV file name. | No file is written. |
-I <mode> | Specifies deinterlacing mode. The value may be: • 0: Off • 1: BOB • 2: Advanced—frame rate • 3: Advanced—field rate | 0 |
-ia <algorithm> | Specifies the deinterlacing algorithm. This parameter is used only for advanced de-interlacing modes. The value may be: • 1: Advanced1 • 2: Advanced2 | 1 |
-id <instance_id> | Specifies the nvdec instance ID to use for decoding. The value may be 0 or 1. | 0 |
-it | The application uses Inverse-Telecine. | Off |
-fq <filter_quality> | Specifies the filter quality. The value may be: • 1: Low • 2: Medium • 3: High | 2 |
-a <aspect_ratio> | Specifies the video stream’s aspect ratio. | N/A |
-v <level> | Specifies the logging level. The value may be: • 0: Errors • 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 window depth. The value may be in the range [0,255]. | 1 |
-h | Prints help text for the application. | |
-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 |
Examples
The nvmvid_play application can be used for stream decoding. Decoded frames can be displayed on screen (playback) or saved to output YUV file. This section provides several usage scenarios.
To perform basic playback
• Enter this command:
./nvmvid_play -c 4 -f disney.264 -d 0
This command starts a playback of the disney.264 H.264 stream on display ID 0. By default it uses, full-screen resolution on window ID 0.
To perform display window manipulation
• Enter this command:
./nvmvid_play -c 4 -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 2 and position:
• x0=100
• y0=200
• width=500
• height=600
Window depth is set to 20.
To perform BOB deinterlacing
• Enter this command:
./nvmvid_play -c 1 -f HQV_Jaggies1.m2v -d 0 -i 1
This example performs BOB
deinterlacing on the displayed content.
Deinterlacing
• To select field-rate mode with advanced 2 deinterlacing, enter this command:
./nvmvid_play -c 1 -f HQV_Jaggies1.m2v -d 0 -i 3 -ia 2
• To select field-rate mode with advanced 1 deinterlacing + inverse-telecine, enter this command:
./nvmvid_play -c 1 -f HQV_Jaggies1.m2v -d 0 -i 3 -ia 1 -it
• To select frame-rate mode with advanced 2 deinterlacing, enter this command:
./nvmvid_play -c 1 -f HQV_Jaggies1.m2v -d 0 -i 2 -ia 1
To save decoded frames to an output file
• Enter this command:
./nvmvid_play -c 4 -f disney.264 -s disney_out.yuv
This example decodes the disney.264 stream and saves the decoded frames to the disney_out.yuv file.
To specify playback duration
• To specify the number of frames to decode, enter this command:
./nvmvid_play -c 4 -f disney.264 -d 0 -n 100
This example streams to display ID 0 the first 100 frames from the disney.264 file.
• To specify the number of times to decode the frames, enter this command:
./nvmvid_play -c 4 -f disney.264 -d 0 -l 10
This example plays disney.264 ten times and streams the video to display ID 0.
To generate CRC for decoded YUV
• Enter this command:
./nvmvid_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 disney_PitchLinear_Ref_CRC.txt.
To check CRC for decoded YUV against a reference CRC
• Enter this command:
./nvmvid_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 is incorrect.
To get the decode timing information
• Enter this command:
./nvmvid_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.