L4T Multimedia API Reference

27.1 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nvee_camcap_tensorrt_and_multi_enc.md
Go to the documentation of this file.
1 Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
2 
3 @page ee_camcap_tensorrt_multichannel_group Camera Capture with TensorRT and Multi-Channel Encoding
4 @{
5 
6  - [Overview](#overview)
7  - [Key Classes and Methods](#key)
8  - [Command Line Options](#commands_line_options)
9  - [Commands](#commands)
10 
11 #### Requirements ####
12 - Camera
13 - Display
14 
15 - - - - - - - - - - - - - - -
16 <a name="overview">
17 ## Overview ##
18 
19 This sample demonstrates four different resolutions of video capture coming out
20 of camera sensor directly. Among these streams, three of them go through the
21 encoding process and are saved as H.264 or H.265 file. The fourth stream
22 provides full resolution and uses NVIDIA<sup>&reg;</sup> TensorRT<sup>&tm;</sup>
23 to perform object detection. If target object is detected, it will draw a
24 bounding box around the object on the frame. Finally, the frame with the
25 bounding box is rendered on the display and simultaneously encoded as an H.264
26 or H.265 file.
27 
28 #### Detailed Buffer Management ####
29 ![Detailed Buffer Management](nvee_camcap_tensorrt.png)
30 
31 #### Buffer Flow of the Frontend Using GIE ####
32 ![Buffer Flow of the Frontend Using GIE](nvee_camcap_buff_flow_gie.png)
33 
34 
35 - - - - - - - - - - - - - - -
36 <a name="key">
37 ## Key Classes and Methods ##
38 
39 For information on libargus, see @ref mmapi_argus_group. For information on EGLStream, see documentation on the Khronos web site.
40 
41 ### StreamConsumer Class ###
42 
43 |Class|Description|
44 |-------|-----------|
45 |StreamConsumer|A base class of the libargus `OutputStream` consumer. It contains a dedicated thread to poll frames from Argus::OutputStream.|
46 
47 The following table describes key `StreamConsumer` members.
48 
49 |Members|Description|
50 |-------|-----------|
51 |setOutputStream|Sets OutputStream which be used to create the FrameConsumer.|
52 |getSize|Gets stream resolution.|
53 |threadInitialize|Virtual method that initializes the consumer thread.|
54 |threadExecute|Virtual method that manages the thread loop.|
55 |threadShutdown|Virtual method that destroys the consumer thread.|
56 |processFrame|Virtual method that handles one frame.|
57 
58 ### VideoEncoder Class ###
59 
60 |Class|Description|
61 |-------|-----------|
62 |VideoEncoder|This is a utility class to simplify the use of V4L2 video encoder.|
63 
64 The following table describes key `VideoEncoder` members.
65 
66 |Members|Description|
67 |-------|-----------|
68 |VideoEncoder|Constructor in which to specify resolution, output video filename, and select encoding format.|
69 |initialize|Initialize video encoder and stream consumer.|
70 |shutdown|Destroy resources.|
71 |setBufferDoneCallback|Set callback to return buffer to caller.|
72 |encodeFromFd|Feed the encoder with a new buffer.|
73 
74 ### VideoStreamConsumer Class ###
75 
76 |Class|Description|
77 |-------|-----------|
78 |VideoStreamConsumer|This class is a derived class of StreamConsumer to support video encoding. It reuses the VideoEncoder object for video encoding.|
79 
80 The following table describes key `VideoStreamConsumer` members.
81 
82 |Members|Description|
83 |-------|-----------|
84 |VideoEncodeStreamConsumer|Constructor in which to specify the name of the consumer, output video filename and select encoding format.|
85 |threadInitialize|Initializes the video encoder and stream consumer.|
86 |threadShutdown|Destroys resources.|
87 |processFrame|Receives frames and pushes them to the encoder.|
88 
89 ### GIEStreamConsumer Class ###
90 
91 |Class|Description|
92 |-------|-----------|
93 |GIEStreamConsumer|This class is a derived class of StreamConsumer to support TensorRT (GIE) inference. It also has a VideoEncoder object to support video encoding.|
94 
95 The following table describes key `GIEStreamConsumer` members.
96 
97 |Members|Description|
98 |-------|-----------|
99 |GIEStreamConsumer|Constructor in which to specify the name of the consumer, output video filename and select encoding format.|
100 |threadInitialize|Initializes TensorRT (GIE) context, video encoder and stream consumer.|
101 |threadShutdown|Destroys resources.|
102 |processFrame|Receives frames and prepares them for the TensorRT (GIE) inference.|
103 |setDeployFile|Sets the deploy file for building the TensorRT (GIE) context.|
104 |setModelFile|Sets the model file for building the TensorRT (GIE) context.|
105 |RenderThreadProc|Loops to draw the bounding box, render the frame, and encode the video.|
106 |GIEThreadProc|Loops to do the TensorRT (GIE) inference.|
107 
108 
109 - - - - - - - - - - - - - - -
110 <a name="commands_line_options">
111 ## Command Line Options ##
112 
113  ./frontend [OPTIONS]
114 
115 Enter the following command to view the supported options.
116 
117  ./frontend -h
118 
119 
120 - - - - - - - - - - - - - - -
121 <a name="commands">
122 ## Commands ##
123 
124 Press 'q' to exit.
125