1 Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
3 @page l4t_mm_01_video_encode 01_video_encode
6 - [Overview](#overview)
7 - [Building and Running](#build_and_run)
9 - [Key Structure and Classes](#key)
12 - - - - - - - - - - - - - - -
16 The video_encode sample application demonstrates how to encode H.264/H.265
19 The application YUV reads input buffers from a file, performs H.264 or H.265
21 and saves the encoded bitstream to an elementary `.264` or `.265` file.
23 The application runs on file source simulated input buffers, and so does not
26 Supported video formats are:
31 <a name=
"build_and_run">
32 - - - - - - - - - - - - - - -
33 ## Building and Running ##
36 * You have followed steps 1-3 in @ref mmapi_build.
37 * If you are building from your host Linux PC (x86), you have followed
38 step 4 in @ref mmapi_build.
43 $ cd $HOME/multimedia_api/samples/01_video_encode
49 $ video_encode <in-file> <in-width> <in-height> <encoder-type> <out-file> [OPTIONS]
51 ### To view supported options
54 $ ./video_encode --help
58 $ ./video_encode ../../data/Video/sample_outdoor_car_1080p_10fps.yuv 1920 1080 H264 sample_outdoor_car_1080p_10fps.h264
62 - - - - - - - - - - - - - - -
64 The following diagram shows the flow through
this sample.
66 
68 * The @b Output @b Plane receives input in YUV frame format and delivers it
69 to the @b Encoder
for decoding.
70 * The application transfers encoded frames to the @b Capture @b Plane
72 * The encoded bitstream is written to a file.
73 * For the @b Output @b Plane the application supports MMAP, DMABUF, and USRPTR
74 memory types. For the Capture Plane it supports MMAP memory type.
77 - - - - - - - - - - - - - - -
78 ## Key Structure and Classes ##
80 The sample uses the following key structures and classes.
82 | Element | Description |
83 | ---------------- | ----------- |
84 | [
NvVideoEncoder](classNvVideoEncoder.html) | Contains all video encoding-related elements and functions. |
85 | Enc_pollthread | A pointer to the thread handler
for the encoding capture loop. |
88 video encoding-related elements and functions. Key members used in the sample
91 | Member | Description |
92 | ---------------- | ----------- |
93 | [output_plane](classNvV4l2Element.html#aaba251827cef1b23e7c42f776e95fee5) | Specifies the V4L2 output plane. |
94 | [capture_plane](classNvV4l2Element.html#a91806d7ed13b4b2c48758e8a02f46c6d) | Specifies the V4L2 capture plane. |
95 | [createVideoEncoder](classNvVideoEncoder.html#ad7cff71c0fe1f78cc332fed7c6b00eb3) | Static
function to create video encode
object. |
96 | [subscribeEvent](classNvV4l2Element.html#a7fd9f21268d5fdc979065b1b04b93220) | Subscribe event. |
98 | [setCapturePlaneFormat](classNvElement.html#a3ecd42c9dda2cec9506cf2ea8fa021fe) | Set capture plane format. |
99 | [dqEvent](classNvV4l2Element.html#a9a8b5337356f82d04f5fbd7cce6e51e3) | Dqueue the
event which reports by the V4L2 device. |
100 | [isInError](classNvElement.html#a3ecd42c9dda2cec9506cf2ea8fa021fe) | Checks
if under error state. |
103 and `capture_plane`. These objects are derived from
class type
105 The sample uses the following key members:
107 | Element | Description |
108 | ---------------- | ----------- |
109 | [setupPlane](classNvV4l2ElementPlane.html#a89959f455e5222f686187cc826b1b345) | Sets up the plane of V4L2 element. |
110 | [deinitPlane](classNvV4l2ElementPlane.html#af89cfe87d8f818beb0478bcf5b72574c) | Destroys the plane of the V4L2 element. |
111 | [setStreamStatus](classNvV4l2ElementPlane.html#a03164dde4d7ab41f3e92b41e13059316) | Starts/stops the stream. |
112 | [setDQThreadCallback](classNvV4l2ElementPlane.html#a37f213325e0e4857180f5b2319317d6a) | Sets the callback
function of the dqueue buffer thread. |
113 | [startDQThread](classNvV4l2ElementPlane.html#a31f77f5e5ed1f320caa44a868a7cbedd) | Starts the thread of the dqueue buffer. |
114 | [stopDQThread](classNvV4l2ElementPlane.html#aa798d14493de321fa90aeab6d944ca87) | Stops the thread of the dqueue buffer. |
115 | [qBuffer](classNvV4l2ElementPlane.html#af4d52964fcfd37082f47682e457f5e95) | Queues the V4L2 buffer. |
116 | [dqBuffer](classNvV4l2ElementPlane.html#a8dfcbc666ee6f36a02abfb1170ae05cd) | Dequeues the V4L2 buffer. |
117 | [getNumBuffers](classNvV4l2ElementPlane.html#ac5cd394a7e0a4afd69395759aeac8787) | Gets the number of V4L2 buffers. |
118 | [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.