docs/html/classvideoOutput.html
| | Jetson Inference
DNN Vision Library |
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
videoOutput Class Reference Utilities Library (jetson-utils) » Video Streaming
The videoOutput API is for rendering and transmitting frames to video input devices such as display windows, broadcasting RTP network streams to remote hosts over UDP/IP, and saving videos/images/directories to disk. More...
#include <videoOutput.h>
Inheritance diagram for videoOutput:
|
|
| virtual | ~videoOutput () |
| | Destroy interface and release all resources. More...
|
| |
| template<typename T > |
| bool | Render (T *image, uint32_t width, uint32_t height) |
| | Render and output the next frame to the stream. More...
|
| |
| virtual bool | Render (void *image, uint32_t width, uint32_t height, imageFormat format) |
| | Render and output the next frame to the stream. More...
|
| |
| virtual bool | Open () |
| | Begin streaming the device. More...
|
| |
| virtual void | Close () |
| | Stop streaming the device. More...
|
| |
| bool | IsStreaming () const |
| | Check if the device is actively streaming or not. More...
|
| |
| uint32_t | GetWidth () const |
| | Return the width of the stream, in pixels. More...
|
| |
| uint32_t | GetHeight () const |
| | Return the height of the stream, in pixels. More...
|
| |
| float | GetFrameRate () const |
| | Return the framerate, in Hz or FPS. More...
|
| |
| uint64_t | GetFrameCount () const |
| | Return the number of frames output. More...
|
| |
| const URI & | GetResource () const |
| | Return the resource URI of the stream. More...
|
| |
| const videoOptions & | GetOptions () const |
| | Return the videoOptions of the stream. More...
|
| |
| void | AddOutput (videoOutput *output) |
| | Add an output sub-stream. More...
|
| |
| uint32_t | GetNumOutputs () const |
| | Return the number of sub-streams. More...
|
| |
| videoOutput * | GetOutput (uint32_t index) const |
| | Return a sub-stream. More...
|
| |
| virtual void | SetStatus (const char *str) |
| | Set a status string (i.e. More...
|
| |
| virtual uint32_t | GetType () const |
| | Return the interface type of the stream. More...
|
| |
| bool | IsType (uint32_t type) const |
| | Check if this stream is of a particular type. More...
|
| |
| template<typename T > |
| bool | IsType () const |
| | Check if a this stream is of a particular type. More...
|
| |
| const char * | TypeToStr () const |
| | Convert this stream's class type to string. More...
|
| |
|
|
| static videoOutput * | Create (const videoOptions &options) |
| | Create videoOutput interface from a videoOptions struct that's already been filled out. More...
|
| |
| static videoOutput * | Create (const char *URI, const videoOptions &options=videoOptions()) |
| | Create videoOutput interface from a resource URI string and optional videoOptions. More...
|
| |
| static videoOutput * | Create (const char *URI, const commandLine &cmdLine) |
| | Create videoOutput interface from a resource URI string and parsing command line arguments. More...
|
| |
| static videoOutput * | Create (const char *URI, const int argc, char **argv) |
| | Create videoOutput interface from a resource URI string and parsing command line arguments. More...
|
| |
| static videoOutput * | Create (const int argc, char **argv, int positionArg=-1) |
| | Create videoOutput interface by parsing command line arguments, including the resource URI. More...
|
| |
| static videoOutput * | Create (const commandLine &cmdLine, int positionArg=-1) |
| | Create videoOutput interface by parsing command line arguments, including the resource URI. More...
|
| |
| static videoOutput * | CreateNullOutput () |
| | Create videoOutput interface that acts as a NULL output and does nothing with incoming frames. More...
|
| |
| static const char * | Usage () |
| | Usage string for command line arguments to Create()More...
|
| |
| static const char * | TypeToStr (uint32_t type) |
| | Convert a class type to a string. More...
|
| |
|
| | | videoOutput (const videoOptions &options) | | |
|
| | bool | mStreaming | | | | videoOptions | mOptions | | | | std::vector< videoOutput * > | mOutputs | | |
The videoOutput API is for rendering and transmitting frames to video input devices such as display windows, broadcasting RTP network streams to remote hosts over UDP/IP, and saving videos/images/directories to disk.
videoOutput interfaces are implemented by glDisplay, gstEncoder, and imageWriter.
The specific implementation is selected at runtime based on the type of resource URI. An instance can have multiple sub-streams, for example simultaneously outputting to a display and encoded video on disk or RTP stream.
videoOutput supports the following protocols and resource URI's:
- `display://0` for rendering to display using OpenGL, where `0` corresponds to the display number.
By default, an OpenGL window will be created, unless the `--headless` command line option is used.
- `rtp://<remote-host>:1234` to broadcast a compressed RTP stream to a remote host, where you should
substitute `<remote-host>` with the remote host's IP address or hostname, and `1234` is the port.
- `rtsp://@:8554/my_stream` to serve a compressed RTSP stream at the specified port and stream path.
RTSP clients can connect to the stream at the specified path. Using this will create a RTSP server
that can handle multiple videoOutput streams on the same port but with different paths
(e.g. `rtsp://<hostname>:8554/my_stream_1`, `rtsp://<hostname>:8554/my_stream_2`, ect)
- `webrtc://@:1234/my_stream` to serve a compressed WebRTC stream at the specified port and path
that browsers can connect to and view. Users will be able to navigate their browser to
`http://<hostname>:1234/my_stream` and view a rudimentary video player that plays the stream.
More advanced web front-ends can be created by using standard client-side Javascript WebRTC APIs.
- `file:///home/user/my_video.mp4` for saving videos, images, and directories of images to disk.
You can leave off the `file://` protocol identifier and it will be deduced from the path.
It can be a relative or absolute path. You can output a sequence of images using a path of
the form `my_dir/image_%i.jpg` (where `%i` can include printf-style modifiers like `%03i`).
The `%i` will be replaced with the image number in the sequence. If just a directory is
specified, then by default it will create a sequence of the form `%i.jpg` in that directory.
Supported video formats for saving include MKV, MP4, AVI, and FLV. Supported codecs for
encoding include H.264, H.265, VP8, VP9, and MJPEG. Supported image formats for saving
include JPG, PNG, TGA, and BMP.
See alsoURI for info about resource URI formats. videoOptions for additional options and command-line arguments.
|
| virtual videoOutput::~videoOutput | ( | | ) | |
| virtual |
Destroy interface and release all resources.
|
| videoOutput::videoOutput | ( | const videoOptions & | options | ) | |
| protected |
|
| void videoOutput::AddOutput | ( | videoOutput * | output | ) | |
| inline |
Add an output sub-stream.
When a frame is rendered to this stream, it will be rendered to each sub-stream.
|
| virtual void videoOutput::Close | ( | | ) | |
| virtual |
Stop streaming the device.
NoteClose() is automatically called by the videoOutput destructor when it gets deleted, so you do not explicitly need to call Close() before exiting the program if you delete your videoSource object.
Reimplemented in gstEncoder.
|
| static videoOutput* videoOutput::Create | ( | const char * | URI, | | | | const commandLine & | cmdLine | | | ) | | |
| static |
Create videoOutput interface from a resource URI string and parsing command line arguments.
See alsovideoOptions for valid command-line arguments to be parsed. the documentation above and the URI struct for more info about resource URI's.
|
| static videoOutput* videoOutput::Create | ( | const char * | URI, | | | | const int | argc, | | | | char ** | argv | | | ) | | |
| static |
Create videoOutput interface from a resource URI string and parsing command line arguments.
See alsovideoOptions for valid command-line arguments to be parsed. the documentation above and the URI struct for more info about resource URI's.
|
| static videoOutput* videoOutput::Create | ( | const char * | URI, |
| | | const videoOptions & | options = videoOptions() |
| | ) | | |
| static |
Create videoOutput interface from a resource URI string and optional videoOptions.
See alsothe documentation above and the URI struct for more info about resource URI's.
|
| static videoOutput* videoOutput::Create | ( | const commandLine & | cmdLine, |
| | | int | positionArg = -1 |
| | ) | | |
| static |
Create videoOutput interface by parsing command line arguments, including the resource URI.
Parameters
| positionArg | indicates the positional argument number in the command line of the resource URI (or -1 if a positional argument isn't used, and should instead be parsed from the --input= option). |
See alsovideoOptions for valid command-line arguments to be parsed. the documentation above and the URI struct for more info about resource URI's.
|
| static videoOutput* videoOutput::Create | ( | const int | argc, |
| | | char ** | argv, |
| | | int | positionArg = -1 |
| | ) | | |
| static |
Create videoOutput interface by parsing command line arguments, including the resource URI.
Parameters
| positionArg | indicates the positional argument number in the command line of the resource URI (or -1 if a positional argument isn't used, and should instead be parsed from the --input= option). |
See alsovideoOptions for valid command-line arguments to be parsed. the documentation above and the URI struct for more info about resource URI's.
|
| static videoOutput* videoOutput::Create | ( | const videoOptions & | options | ) | |
| static |
Create videoOutput interface from a videoOptions struct that's already been filled out.
It's expected that the supplied videoOptions already contain a valid resource URI.
|
| static videoOutput* videoOutput::CreateNullOutput | ( | | ) | |
| static |
Create videoOutput interface that acts as a NULL output and does nothing with incoming frames.
CreateNullOutput() can be used when there are no other outputs created and programs expect one to run.
|
| uint64_t videoOutput::GetFrameCount | ( | | ) | const |
| inline |
Return the number of frames output.
|
| float videoOutput::GetFrameRate | ( | | ) | const |
| inline |
Return the framerate, in Hz or FPS.
|
| uint32_t videoOutput::GetHeight | ( | | ) | const |
| inline |
Return the height of the stream, in pixels.
|
| uint32_t videoOutput::GetNumOutputs | ( | | ) | const |
| inline |
Return the number of sub-streams.
|
| const videoOptions& videoOutput::GetOptions | ( | | ) | const |
| inline |
Return the videoOptions of the stream.
|
| videoOutput* videoOutput::GetOutput | ( | uint32_t | index | ) | const |
| inline |
Return a sub-stream.
|
| const URI& videoOutput::GetResource | ( | | ) | const |
| inline |
Return the resource URI of the stream.
|
| virtual uint32_t videoOutput::GetType | ( | | ) | const |
| inlinevirtual |
Return the interface type of the stream.
This could be one of the following values:
Reimplemented in glDisplay, gstEncoder, and imageWriter.
|
| uint32_t videoOutput::GetWidth | ( | | ) | const |
| inline |
Return the width of the stream, in pixels.
|
| bool videoOutput::IsStreaming | ( | | ) | const |
| inline |
Check if the device is actively streaming or not.
Returnstrue if the device is streaming (open), or false if it's closed or has reached EOS (End Of Stream).
template<typename T >
|
| bool videoOutput::IsType | ( | | ) | const |
| inline |
Check if a this stream is of a particular type.
Can be used with glDisplay, gstEncoder, and imageWriter. For example:
if( stream->IsType<glDisplay>() ) glDisplay* display = (glDisplay*)stream; // safe to cast
|
| bool videoOutput::IsType | ( | uint32_t | type | ) | const |
| inline |
Check if this stream is of a particular type.
See alsoGetType() for possible values.
|
| virtual bool videoOutput::Open | ( | | ) | |
| virtual |
Begin streaming the device.
After Open() is called, frames from the device can begin to be rendered.
Open() is not stricly necessary to call, if you call one of the Render() functions they will first check to make sure that the stream is opened, and if not they will open it automatically for you.
Returnstrue on success, false if an error occurred opening the stream.
Reimplemented in gstEncoder, and glDisplay.
template<typename T >
|
| bool videoOutput::Render | ( | T * | image, | | | | uint32_t | width, | | | | uint32_t | height | | | ) | | |
| inline |
Render and output the next frame to the stream.
The image formats supported by this templated version of Render() include the following:
IMAGE_RGB8)IMAGE_RGBA8)IMAGE_RGB32F)IMAGE_RGBA32F)The image format will automatically be deduced from these types. If other types are used with this overload, a static compile-time error will be asserted.
Parameters
| image | CUDA pointer containing the image to output. | | width | width of the image, in pixels. | | height | height of the image, in pixels. |
Returnstrue on success, false on error.
|
| virtual bool videoOutput::Render | ( | void * | image, | | | | uint32_t | width, | | | | uint32_t | height, | | | | imageFormat | format | | | ) | | |
| virtual |
Render and output the next frame to the stream.
The image formats supported by Render() are IMAGE_RGB8 (uchar3), IMAGE_RGBA8 (uchar4), IMAGE_RGB32F (float3), and IMAGE_RGBA32F (float4).
See alsoimageFormat for more info.Parameters
| image | CUDA pointer containing the image to output. | | width | width of the image, in pixels. | | height | height of the image, in pixels. | | format | format of the image ( |
See alsoimageFormat) Returnstrue on success, false on error.
Reimplemented in glDisplay, gstEncoder, and imageWriter.
|
| virtual void videoOutput::SetStatus | ( | const char * | str | ) | |
| virtual |
Set a status string (i.e.
status bar text on display window). Other types of interfaces may ignore the status text.
Reimplemented in glDisplay.
|
| const char* videoOutput::TypeToStr | ( | | ) | const |
| inline |
Convert this stream's class type to string.
|
| static const char* videoOutput::TypeToStr | ( | uint32_t | type | ) | |
| static |
Convert a class type to a string.
|
| static const char* videoOutput::Usage | ( | | ) | |
| inlinestatic |
Usage string for command line arguments to Create()
|
| videoOptions videoOutput::mOptions |
| protected |
|
| std::vector<videoOutput*> videoOutput::mOutputs |
| protected |
|
| bool videoOutput::mStreaming |
| protected |
The documentation for this class was generated from the following file:
jetson-utils/videoOutput.h
Generated on Fri Mar 17 2023 14:29:30 for Jetson Inference by 1.8.17