Jetson Linux API Reference

32.7.5 Release
14_multivideo_decode (multi video decode)

Overview

The multivideo_decode sample demonstrates decoding of multiple video streams in parallel. It provides options to "file write" (optional) or "video render" decoded data. Currently the application can decode a maximum of 128 streams in parallel.

Video rendering is currently disabled. You must specify the --disable-rendering command line option to avoid using this feature.

The command line option -o is optional. Use it if the user wants to dump the output file.

Supported video formats are:

  • H.264
  • H.265
  • VP8
  • VP9
  • MPEG4
  • MPEG2


Building and Running

Prerequisites

To build

  • Enter:
     $ cd /usr/src/jetson_multimedia_api/samples/14_multivideo_decode
     $ make
    

To run

  • Enter:
     $ ./multivideo_decode num_files <number_of_files> <file_name1> <in-format1> -o <out_filename1> <file_name2> <in-format2> -o <out_filename2> --disable-rendering [options]
    

To view supported options

Enter:

   $ ./multivideo_decode --help

Example

   $ ./multivideo_decode num_files 2 ../../data/Video/sample_outdoor_car_1080p_10fps.h264 H264 ../../data/Video/sample_outdoor_car_1080p_10fps.h264 H264 --disable-rendering


Flow

The following diagram shows the flow through this sample.

  • The Output Plane receives input in bitstream format and delivers it to the Decoder for decoding.
  • Decoded frames are transferred to the Capture Plane in YUV format.
  • The application transfers the decoded YUV frames to EglRenderer for rendering.
  • For the Output Plane the application supports MMAP and USRPTR memory types. For the Capture Plane it supports MMAP and DMABUF memory types.
  • The application can also dump files from the Capture Plane.


Key Structure and Classes

The sample uses the following key structures and classes.

Element Description
NvVideoDecoder Contains all video decoding-related elements and functions.
dec_capture_loop A pointer to the thread handler for the decoding capture loop.

The NvVideoDecoder class packages all video decoding-related elements and functions. Key members used in the sample are:

Member Description
output_plane Specifies the V4L2 output plane.
capture_plane Specifies the V4L2 capture plane.
createVideoDecoder Static function to create video decode object.
subscribeEvent Subscribe event.
setOutputPlaneFormat Set output plane format.
setCapturePlaneFormat Set capture plane format.
dqEvent Dqueue the event which reports by the V4L2 device.
isInError Checks if under error state.

Class NvVideoDecoder contains two key elements: output_plane and capture_plane. These objects are derived from class type NvV4l2ElementPlane. The sample uses the following key members:

Element Description
setupPlane Sets up the plane of V4L2 element.
deinitPlane Destroys the plane of the V4L2 element.
setStreamStatus Starts/stops the stream.
setDQThreadCallback Sets the callback function of the dqueue buffer thread.
startDQThread Starts the thread of the dqueue buffer.
stopDQThread Stops the thread of the dqueue buffer.
qBuffer Queues the V4L2 buffer.
dqBuffer Dequeues the V4L2 buffer.
getNumBuffers Gets the number of V4L2 buffers.