1 Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
3 @page l4t_mm_15_multivideo_encode_group 15_multivideo_encode
6 - [Overview](#overview)
7 - [Building and Running](#build_and_run)
9 - [Key Structure and Classes](#key)
12 - - - - - - - - - - - - - - -
16 The multivideo_encode sample application demonstrates how to encode multiple
17 video streams in parallel.
19 The application reads input buffers from a YUV file, performs H.264, H.265, VP8
20 or VP9 video encoding, and saves the encoded bitstream to an elementary file.
21 It can
do this in parallel
for multiple inputs and corresponding outputs.
23 The application runs on file source simulated input buffers, and so does not
26 Supported video formats are:
33 <a name=
"build_and_run">
34 - - - - - - - - - - - - - - -
35 ## Building and Running ##
38 * You have followed steps 1-3 in @ref mmapi_build.
39 * If you are building from your host Linux PC (x86), you have followed
40 step 4 in @ref mmapi_build.
45 $ cd $HOME/multimedia_api/samples/15_multivideo_encode
51 $ multivideo_encode num_files <number_of_files> <in-file1> <in-width1> <in-height1> <encoder-type1> <out-file1> <in-file2> <in-width2> <in-height2> <encoder-type2> <out-file2> [OPTIONS]
53 ### To view supported options
56 $ ./multivideo_encode --help
60 $ ./multivideo_encode num_files 2 ../../data/Video/sample_outdoor_car_1080p_10fps.yuv 1920 1080 H264 sample_outdoor_car_1080p_10fps.h264 ../../data/Video/sample_outdoor_car_1080p_10fps.yuv 1920 1080 H264 sample_outdoor_car_1080p_10fps_second.h264
64 - - - - - - - - - - - - - - -
66 The following diagram shows the flow through
this sample.
68 
70 * The @b Output @b Plane receives input in YUV frame format and delivers it
71 to the @b Encoder
for encoding.
72 * The @b Capture @b Plane transfers encoded frames to the application
74 * The encoded bitstream is written to a file.
75 * For the @b Output @b Plane the application supports MMAP, DMABUF, and USRPTR
76 memory types. For the @b Capture @b Plane, it supports MMAP memory type.
79 - - - - - - - - - - - - - - -
80 ## Key Structure and Classes ##
82 The sample uses the following key structures and classes.
84 | Element | Description |
85 | ---------------- | ----------- |
86 | [
NvVideoEncoder](classNvVideoEncoder.html) | Contains all video encoding-related elements and functions. |
87 | Enc_pollthread | A pointer to the thread handler
for the encoding capture loop. |
90 video encoding-related elements and functions. Key members used in the sample
93 | Member | Description |
94 | ---------------- | ----------- |
95 | [output_plane](classNvV4l2Element.html#aaba251827cef1b23e7c42f776e95fee5) | Specifies the V4L2 output plane. |
96 | [capture_plane](classNvV4l2Element.html#a91806d7ed13b4b2c48758e8a02f46c6d) | Specifies the V4L2 capture plane. |
97 | [createVideoEncoder](classNvVideoEncoder.html#ad7cff71c0fe1f78cc332fed7c6b00eb3) | Static
function to create video encode
object. |
98 | [subscribeEvent](classNvV4l2Element.html#a7fd9f21268d5fdc979065b1b04b93220) | Subscribes to event. |
100 | [setCapturePlaneFormat](classNvElement.html#a3ecd42c9dda2cec9506cf2ea8fa021fe) | Set capture plane format. |
101 | [dqEvent](classNvV4l2Element.html#a9a8b5337356f82d04f5fbd7cce6e51e3) | Dequeues the
event reported by the V4L2 device. |
102 | [isInError](classNvElement.html#a3ecd42c9dda2cec9506cf2ea8fa021fe) | Checks
if under error state. |
105 and `capture_plane`. These objects are derived from
class type
107 The sample uses the following key members:
109 | Element | Description |
110 | ---------------- | ----------- |
111 | [setupPlane](classNvV4l2ElementPlane.html#a89959f455e5222f686187cc826b1b345) | Sets up the plane of V4L2 element. |
112 | [deinitPlane](classNvV4l2ElementPlane.html#af89cfe87d8f818beb0478bcf5b72574c) | Destroys the plane of the V4L2 element. |
113 | [setStreamStatus](classNvV4l2ElementPlane.html#a03164dde4d7ab41f3e92b41e13059316) | Starts/stops the stream. |
114 | [setDQThreadCallback](classNvV4l2ElementPlane.html#a37f213325e0e4857180f5b2319317d6a) | Sets the callback
function of the dqueue buffer thread. |
115 | [startDQThread](classNvV4l2ElementPlane.html#a31f77f5e5ed1f320caa44a868a7cbedd) | Starts the thread of the dqueue buffer. |
116 | [stopDQThread](classNvV4l2ElementPlane.html#aa798d14493de321fa90aeab6d944ca87) | Stops the thread of the dqueue buffer. |
117 | [qBuffer](classNvV4l2ElementPlane.html#af4d52964fcfd37082f47682e457f5e95) | Queues the V4L2 buffer. |
118 | [dqBuffer](classNvV4l2ElementPlane.html#a8dfcbc666ee6f36a02abfb1170ae05cd) | Dequeues the V4L2 buffer. |
119 | [getNumBuffers](classNvV4l2ElementPlane.html#ac5cd394a7e0a4afd69395759aeac8787) | Gets the number of V4L2 buffers. |
120 | [getNumQueuedBuffers](classNvV4l2ElementPlane.html#abe813f1ac780689ea75207866fe12478) | Gets the number of buffers currently queued on the plane. |
Defines a helper class for operations performed on a V4L2 Element plane.
Defines a helper class for V4L2 Video Encoder.
int setOutputPlaneFormat(uint32_t pixfmt, uint32_t width, uint32_t height, enum v4l2_nv_buffer_layout type)
Sets the format on the converter output plane.