Jetson Inference
DNN Vision Library
|
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 codecs. More... | |
enum | CodecType { CODEC_CPU = 0, CODEC_OMX, CODEC_V4L2, CODEC_NVENC, CODEC_NVDEC } |
Video codec engines. 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, const char *extraFlag=NULL) |
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... | |
static const char * | CodecTypeToStr (CodecType codecType) |
Convert a CodecType enum to a string. More... | |
static CodecType | CodecTypeFromStr (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... | |
URI | save |
Optional path to save the compressed stream to a video file on disk, which is to be used in addition to the primary resource URI above. 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... | |
uint64_t | frameCount |
The number of frames that have been captured or output on this interface. 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 | latency |
Number of milliseconds of video to buffer for network RTSP or WebRTC streams. 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... | |
CodecType | codecType |
Indicates the underlying hardware/software engine used by the codec. More... | |
std::string | stunServer |
URL of STUN server used for WebRTC. More... | |
std::string | sslCert |
Path to a file containing a PEM-encoded SSL/TLS certificate. More... | |
std::string | sslKey |
Path to a file containing a PEM-encoded private key. More... | |
The videoOptions struct contains common settings that are used to configure and query videoSource and videoOutput streams.
enum videoOptions::Codec |
Video codec engines.
Device interface types.
Settings of the flip method used by MIPI CSI cameras and compressed video inputs.
enum videoOptions::IoType |
videoOptions::videoOptions | ( | ) |
Constructor using default options.
|
static |
Parse a Codec enum from a string.
|
static |
Convert a Codec enum to a string.
|
static |
Parse a Codec enum from a string.
|
static |
Convert a CodecType enum to a string.
|
static |
Parse a DeviceType enum from a string.
|
static |
Convert a DeviceType enum to a string.
|
static |
Parse a FlipMethod enum from a string.
|
static |
Convert a FlipMethod enum to a string.
|
static |
Parse an IoType enum from a string.
|
static |
Convert an IoType enum to a string.
bool videoOptions::Parse | ( | const char * | URI, |
const commandLine & | cmdLine, | ||
IoType | ioType | ||
) |
bool videoOptions::Parse | ( | const char * | URI, |
const int | argc, | ||
char ** | argv, | ||
IoType | ioType, | ||
const char * | extraFlag = NULL |
||
) |
bool videoOptions::Parse | ( | const commandLine & | cmdLine, |
IoType | ioType, | ||
int | ioPositionArg = -1 |
||
) |
bool videoOptions::Parse | ( | const int | argc, |
char ** | argv, | ||
IoType | ioType, | ||
int | ioPositionArg = -1 |
||
) |
void videoOptions::Print | ( | const char * | prefix = NULL | ) | const |
Log the video settings, with an optional prefix label.
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
.
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).
CodecType videoOptions::codecType |
Indicates the underlying hardware/software engine used by the codec.
For input streams, this can be set with --decode=cpu
or --decode=v4l2
for example. For output streams, this can be set with --encode=cpu
or --encode=v4l2
for example. The default setting is to use hardware-acceleration on Jetson (aarch64) and CPU on x86.
DeviceType videoOptions::deviceType |
Indicates the type of device interface used by this stream.
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) uint64_t videoOptions::frameCount |
The number of frames that have been captured or output on this interface.
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.
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 videoOptions::ioType |
Indicates if this stream is an input or an output.
int videoOptions::latency |
Number of milliseconds of video to buffer for network RTSP or WebRTC streams.
The default setting is 10ms (which is lower than GStreamer's default settings). If you have connection/buffering problems, try increasing the latency setting. It can be set from the command line using --input-latency=N
or --output-latency=N
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
.
0
). 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
.
URI videoOptions::resource |
URI videoOptions::save |
Optional path to save the compressed stream to a video file on disk, which is to be used in addition to the primary resource URI above.
This option can be set from the command-line using --input-save
for videoSource streams, or --output-save
for videoOutput streams.
std::string videoOptions::sslCert |
Path to a file containing a PEM-encoded SSL/TLS certificate.
This is used for enabling HTTPS in the WebRTC server. It can be set from the command-line using the --ssl-cert
or --https-cert
options. You can make your own self-signed certificate by running a command like: openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
std::string videoOptions::sslKey |
Path to a file containing a PEM-encoded private key.
This is used for enabling HTTPS in the WebRTC server. It can be set from the command-line using the --ssl-key
or --https-key
options. You can make your own self-signed certificate by running a command like: openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
std::string videoOptions::stunServer |
URL of STUN server used for WebRTC.
This can be set using the --stun-server
command-line argument. STUN servers are used during ICE/NAT and allow a local device to determine its public IP address. If this is left blank and WebRTC is used, then a default STUN server will be assigned.
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.
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.