Jetson Inference
DNN Vision Library
videoOptions Struct Reference

The videoOptions struct contains common settings that are used to configure and query videoSource and videoOutput streams. More...

#include <videoOptions.h>

Public Types

enum  DeviceType {
  DEVICE_DEFAULT = 0, DEVICE_V4L2, DEVICE_CSI, DEVICE_IP,
  DEVICE_FILE, DEVICE_DISPLAY
}
 Device interface types. More...
 
enum  IoType { INPUT = 0, OUTPUT }
 Input/Output stream type. More...
 
enum  FlipMethod {
  FLIP_NONE = 0, FLIP_COUNTERCLOCKWISE, FLIP_ROTATE_180, FLIP_CLOCKWISE,
  FLIP_HORIZONTAL, FLIP_UPPER_RIGHT_DIAGONAL, FLIP_VERTICAL, FLIP_UPPER_LEFT_DIAGONAL,
  FLIP_DEFAULT = FLIP_NONE
}
 Settings of the flip method used by MIPI CSI cameras and compressed video inputs. More...
 
enum  Codec {
  CODEC_UNKNOWN = 0, CODEC_RAW, CODEC_H264, CODEC_H265,
  CODEC_VP8, CODEC_VP9, CODEC_MPEG2, CODEC_MPEG4,
  CODEC_MJPEG
}
 Video codec types. More...
 

Public Member Functions

 videoOptions ()
 Constructor using default options. More...
 
void Print (const char *prefix=NULL) const
 Log the video settings, with an optional prefix label. More...
 
bool Parse (const char *URI, const int argc, char **argv, IoType ioType)
 
bool Parse (const char *URI, const commandLine &cmdLine, IoType ioType)
 
bool Parse (const int argc, char **argv, IoType ioType, int ioPositionArg=-1)
 
bool Parse (const commandLine &cmdLine, IoType ioType, int ioPositionArg=-1)
 

Static Public Member Functions

static const char * IoTypeToStr (IoType type)
 Convert an IoType enum to a string. More...
 
static IoType IoTypeFromStr (const char *str)
 Parse an IoType enum from a string. More...
 
static const char * DeviceTypeToStr (DeviceType type)
 Convert a DeviceType enum to a string. More...
 
static DeviceType DeviceTypeFromStr (const char *str)
 Parse a DeviceType enum from a string. More...
 
static const char * FlipMethodToStr (FlipMethod flip)
 Convert a FlipMethod enum to a string. More...
 
static FlipMethod FlipMethodFromStr (const char *str)
 Parse a FlipMethod enum from a string. More...
 
static const char * CodecToStr (Codec codec)
 Convert a Codec enum to a string. More...
 
static Codec CodecFromStr (const char *str)
 Parse a Codec enum from a string. More...
 

Public Attributes

URI resource
 The resource URI of the device, IP stream, or file/directory. More...
 
uint32_t width
 The width of the stream (in pixels). More...
 
uint32_t height
 The height of the stream (in pixels). More...
 
float frameRate
 The framerate of the stream (the default is 30Hz). More...
 
uint32_t bitRate
 The encoding bitrate for compressed streams (only applies to video codecs like H264/H265). More...
 
uint32_t numBuffers
 The number of ring buffers used for threading. More...
 
bool zeroCopy
 If true, indicates the buffers are allocated in zeroCopy memory that is mapped to both the CPU and GPU. More...
 
int loop
 Control the number of loops for videoSource disk-based inputs (for example, the number of times that a video should loop). More...
 
int rtspLatency
 Number of milliseconds of video to buffer for incoming RTSP streams (the default is 2000 ms). More...
 
DeviceType deviceType
 Indicates the type of device interface used by this stream. More...
 
IoType ioType
 Indicates if this stream is an input or an output. More...
 
FlipMethod flipMethod
 The flip method controls if and how an input frame is flipped/rotated in pre-processing from a MIPI CSI camera or compressed video input. More...
 
Codec codec
 Indicates the codec used by the stream. More...
 

Detailed Description

The videoOptions struct contains common settings that are used to configure and query videoSource and videoOutput streams.

Member Enumeration Documentation

◆ Codec

Video codec types.

Enumerator
CODEC_UNKNOWN 

Unknown/unsupported codec.

CODEC_RAW 

Uncompressed (e.g.

RGB)

CODEC_H264 

H.264.

CODEC_H265 

H.265.

CODEC_VP8 

VP8.

CODEC_VP9 

VP9.

CODEC_MPEG2 

MPEG2 (decode only)

CODEC_MPEG4 

MPEG4 (decode only)

CODEC_MJPEG 

MJPEG.

◆ DeviceType

Device interface types.

Enumerator
DEVICE_DEFAULT 

Unknown interface type.

DEVICE_V4L2 

V4L2 webcam (e.g.

/dev/video0)

DEVICE_CSI 

MIPI CSI camera.

DEVICE_IP 

IP-based network stream (e.g.

RTP/RTSP)

DEVICE_FILE 

Disk-based stream from a file or directory of files.

DEVICE_DISPLAY 

OpenGL output stream rendered to an attached display.

◆ FlipMethod

Settings of the flip method used by MIPI CSI cameras and compressed video inputs.

Enumerator
FLIP_NONE 

Identity (no rotation)

FLIP_COUNTERCLOCKWISE 

Rotate counter-clockwise 90 degrees.

FLIP_ROTATE_180 

Rotate 180 degrees.

FLIP_CLOCKWISE 

Rotate clockwise 90 degrees.

FLIP_HORIZONTAL 

Flip horizontally.

FLIP_UPPER_RIGHT_DIAGONAL 

Flip across upper right/lower left diagonal.

FLIP_VERTICAL 

Flip vertically.

FLIP_UPPER_LEFT_DIAGONAL 

Flip across upper left/lower right diagonal.

FLIP_DEFAULT 

Default setting (none)

◆ IoType

Input/Output stream type.

Enumerator
INPUT 

Input stream (e.g.

camera, video/image file, ect.)

OUTPUT 

Output stream (e.g.

display, video/image file, ect.)

Constructor & Destructor Documentation

◆ videoOptions()

videoOptions::videoOptions ( )

Constructor using default options.

Member Function Documentation

◆ CodecFromStr()

static Codec videoOptions::CodecFromStr ( const char *  str)
static

Parse a Codec enum from a string.

◆ CodecToStr()

static const char* videoOptions::CodecToStr ( Codec  codec)
static

Convert a Codec enum to a string.

◆ DeviceTypeFromStr()

static DeviceType videoOptions::DeviceTypeFromStr ( const char *  str)
static

Parse a DeviceType enum from a string.

◆ DeviceTypeToStr()

static const char* videoOptions::DeviceTypeToStr ( DeviceType  type)
static

Convert a DeviceType enum to a string.

◆ FlipMethodFromStr()

static FlipMethod videoOptions::FlipMethodFromStr ( const char *  str)
static

Parse a FlipMethod enum from a string.

◆ FlipMethodToStr()

static const char* videoOptions::FlipMethodToStr ( FlipMethod  flip)
static

Convert a FlipMethod enum to a string.

◆ IoTypeFromStr()

static IoType videoOptions::IoTypeFromStr ( const char *  str)
static

Parse an IoType enum from a string.

◆ IoTypeToStr()

static const char* videoOptions::IoTypeToStr ( IoType  type)
static

Convert an IoType enum to a string.

◆ Parse() [1/4]

bool videoOptions::Parse ( const char *  URI,
const int  argc,
char **  argv,
IoType  ioType 
)

◆ Parse() [2/4]

bool videoOptions::Parse ( const char *  URI,
const commandLine cmdLine,
IoType  ioType 
)

◆ Parse() [3/4]

bool videoOptions::Parse ( const int  argc,
char **  argv,
IoType  ioType,
int  ioPositionArg = -1 
)

◆ Parse() [4/4]

bool videoOptions::Parse ( const commandLine cmdLine,
IoType  ioType,
int  ioPositionArg = -1 
)

◆ Print()

void videoOptions::Print ( const char *  prefix = NULL) const

Log the video settings, with an optional prefix label.

Member Data Documentation

◆ bitRate

uint32_t videoOptions::bitRate

The encoding bitrate for compressed streams (only applies to video codecs like H264/H265).

For videoOutput streams, this option can be set from the command line using --bitrate=N.

Note
the default bitrate for encoding output streams is 4Mbps (target VBR).

◆ codec

Codec videoOptions::codec

Indicates the codec used by the stream.

This is only really applicable to compressed streams, otherwise it will be CODEC_RAW.

videoSource input streams will attempt to discover the codec type (i.e. from video file), however RTP streams need this to be explitly set using the --input-codec=xyz option (where xyz is a string like h264, h265, vp8, vp9, mpeg2, mpeg4, or mjpeg).

A compressed videoOutput stream will default to H.264 encoding, but can be set using the --output-codec=xyz command line option (same values for xyz as above).

◆ deviceType

DeviceType videoOptions::deviceType

Indicates the type of device interface used by this stream.

◆ flipMethod

FlipMethod videoOptions::flipMethod

The flip method controls if and how an input frame is flipped/rotated in pre-processing from a MIPI CSI camera or compressed video input.

Other types of streams will ignore this.

This option can be set from the command line using --flip-method=xyz, where xyz is one of the strings below:

  • none (Identity, no rotation)
  • counterclockwise (Rotate counter-clockwise 90 degrees)
  • rotate-180 (Rotate 180 degrees)
  • clockwise (Rotate clockwise 90 degrees)
  • horizontal-flip (Flip horizontally)
  • vertical-flip (Flip vertically)
  • upper-right-diagonal (Flip across upper right/lower left diagonal)
  • upper-left-diagonal (Flip across upper left/lower right diagonal)

◆ frameRate

float videoOptions::frameRate

The framerate of the stream (the default is 30Hz).

This option can be set from the command line using --input-rate=N or --output-rate=N for input and output streams, respectively. The --framerate=N option sets it for both.

◆ height

uint32_t videoOptions::height

The height of the stream (in pixels).

This option can be set from the command line using --input-height=N for videoSource streams, or --output-height=N for videoOutput streams.

◆ ioType

IoType videoOptions::ioType

Indicates if this stream is an input or an output.

◆ loop

int videoOptions::loop

Control the number of loops for videoSource disk-based inputs (for example, the number of times that a video should loop).

Other types of streams will ignore it.

The following values are are valid:

-1 = loop forever 0 = don't loop >0 = set number of loops

This option can be set from the command line using --loop=N.

Note
by default, looping is disabled (set to 0).

◆ numBuffers

uint32_t videoOptions::numBuffers

The number of ring buffers used for threading.

This option can be set from the command line using --num-buffers=N.

Note
the default number of ring buffers is 4.

◆ resource

URI videoOptions::resource

The resource URI of the device, IP stream, or file/directory.

See also
URI for details about accepted protocols and URI formats.

◆ rtspLatency

int videoOptions::rtspLatency

Number of milliseconds of video to buffer for incoming RTSP streams (the default is 2000 ms).

This option can be set from the command line using --input-rtsp-latency=N

◆ width

uint32_t videoOptions::width

The width of the stream (in pixels).

This option can be set from the command line using --input-width=N for videoSource streams, or --output-width=N for videoOutput streams.

◆ zeroCopy

bool videoOptions::zeroCopy

If true, indicates the buffers are allocated in zeroCopy memory that is mapped to both the CPU and GPU.

Otherwise, the buffers are only accessible from the GPU.

Note
the default is true (zeroCopy CPU/GPU access enabled).

The documentation for this struct was generated from the following file: