I am using the Jetson Xavier board for encoding the local content (nvv4l2h265enc) using Gstreamer.
Encoding at a) 1280x720 b) 854x480 c) 640x360 resolutions and with different options i.e. RC modes, different parameters.
Observed many issues
Issue 1: Corruption observed in 854x480 encoding, from first frame, No corruption 1280x720, 640x360 encoding. Guessing padding related issue
Issue 2: Unable to set many parameters .
I got the following output for gst-inspect-1.0 nvv4l2h265enc
$ gst-inspect-1.0 nvv4l2h265enc
Factory Details:
Rank primary + 1 (257)
Long-name V4L2 H.265 Encoder
Klass Codec/Encoder/Video
Description Encode H.265 video streams via V4L2 API
Author Viranjan Pagar vpagar@nvidia.com, Amit Pandya apandya@nvidia.com
Plugin Details:
Name nvvideo4linux2
Description Nvidia elements for Video 4 Linux
Filename /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideo4linux2.so
Version 1.14.0
License LGPL
Source module nvvideo4linux2
Binary package nvvideo4linux2
Origin URL http://nvidia.com/
GObject
±—GInitiallyUnowned
±—GstObject
±—GstElement
±—GstVideoEncoder
±—GstV4l2VideoEnc
±—GstV4l2H265Enc
±—nvv4l2h265enc
Implemented Interfaces:
GstPreset
Pad Templates:
SINK template: ‘sink’
Availability: Always
Capabilities:
video/x-raw(memory:NVMM)
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
format: { (string)I420, (string)NV12, (string)P010_10LE }
framerate: [ 0/1, 2147483647/1 ]
SRC template: ‘src’
Availability: Always
Capabilities:
video/x-h265
stream-format: byte-stream
alignment: au
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
SINK: ‘sink’
Pad Template: ‘sink’
SRC: ‘src’
Pad Template: ‘src’
Element Properties:
name : The name of the object
flags: readable, writable
String. Default: “nvv4l2h265enc0”
parent : The parent of the object
flags: readable, writable
Object of type “GstObject”
qos : Handle Quality-of-Service events from downstream
flags: readable, writable
Boolean. Default: false
device : Device location
flags: readable
String. Default: “/dev/nvhost-msenc”
device-name : Name of the device
flags: Opening in BLOCKING MODE
readable
String. Default: “”
device-fd : File descriptor of the device
flags: readable
Integer. Range: -1 - 2147483647 Default: -1
output-io-mode : Output side I/O mode (matches sink pad)
flags: readable, writable
Enum “GstNvV4l2EncOutputIOMode” Default: 0, “auto”
(0): auto - GST_V4L2_IO_AUTO
(2): mmap - GST_V4L2_IO_MMAP
(5): dmabuf-import - GST_V4L2_IO_DMABUF_IMPORT
capture-io-mode : Capture I/O mode (matches src pad)
flags: readable, writable
Enum “GstNvV4l2EncCaptureIOMode” Default: 0, “auto”
(0): auto - GST_V4L2_IO_AUTO
(2): mmap - GST_V4L2_IO_MMAP
extra-controls : Extra v4l2 controls (CIDs) for the device
flags: readable, writable
Boxed pointer of type “GstStructure”
bitrate : Set bitrate for v4l2 encode
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4000000
control-rate : Set control rate for v4l2 encode
flags: readable, writable, changeable only in NULL or READY state
Enum “GstV4l2VideoEncRateControlType” Default: 1, “constant_bitrate”
(0): variable_bitrate - GST_V4L2_VIDENC_VARIABLE_BITRATE
(1): constant_bitrate - GST_V4L2_VIDENC_CONSTANT_BITRATE
iframeinterval : Encoding Intra Frame occurance frequency
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 30
bufapi-version : Set to use new buf API
flags: readable, writable
Boolean. Default: false
peak-bitrate : Peak bitrate in variable control-rate
The value must be >= bitrate
(1.2*bitrate) is set by default(Default: 0)
flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state
Unsigned Integer. Range: 0 - 4294967295 Default: 0
quant-i-frames : Quantization parameter for I-frames (0xffffffff=component default),
use with ratecontrol-enable = 0
and preset-level = 0
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
quant-p-frames : Quantization parameter for P-frames (0xffffffff=component default),
use with ratecontrol-enable = 0
and preset-level = 0
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
quant-b-frames : Quantization parameter for B-frames (0xffffffff=component default),
use with ratecontrol-enable = 0
and preset-level = 0
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
preset-level : HW preset level for encoder
flags: readable, writable, changeable only in NULL or READY state
Enum “GstV4L2VideoEncHwPreset” Default: 1, “UltraFastPreset”
(0): DisablePreset - Disable HW-Preset
(1): UltraFastPreset - UltraFastPreset for high perf
(2): FastPreset - FastPreset
(3): MediumPreset - MediumPreset
(4): SlowPreset - SlowPreset
qp-range : Qunatization range for P, I and B frame,
Use string with values of Qunatization Range
in MinQpP-MaxQpP:MinQpI-MaxQpI:MinQpB-MaxQpB order, to set the property.
flags: readable, writable
String. Default: null
vbv-size : virtual buffer size
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4000000
MeasureEncoderLatency: Enable Measure Encoder latency Per Frame
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: false
ratecontrol-enable : Enable or Disable rate control mode
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: true
maxperf-enable : Enable or Disable Max Performance mode
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: false
insert-sps-pps : Insert H.265 SPS, PPS at every IDR frame
flags: readable, writable
Boolean. Default: false
profile : Set profile for v4l2 encode
flags: readable, writable, changeable only in NULL or READY state
Enum “GstV4L2VideoEncProfileType” Default: 0, “Main”
(0): Main - GST_V4L2_H265_VIDENC_MAIN_PROFILE
(1): Main10 - GST_V4L2_H265_VIDENC_MAIN10_PROFILE
insert-vui : Insert H.265 VUI(Video Usability Information) in SPS
flags: readable, writable
Boolean. Default: false
insert-aud : Insert H.265 Access Unit Delimiter(AUD)
flags: readable, writable
Boolean. Default: false
bit-packetization : Whether or not Packet size is based upon Number Of bits
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: false
slice-header-spacing: Slice Header Spacing number of macroblocks/bits in one packet
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer64. Range: 0 - 18446744073709551615 Default: 0
SliceIntraRefreshInterval: Set SliceIntraRefreshInterval
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 0
EnableTwopassCBR : Enable two pass CBR while encoding
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: false
EnableMVBufferMeta : Enable Motion Vector Meta data for encoding
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: false
num-B-Frames : Number of B Frames between two reference frames (not recommended)(Supported only on Xavier)
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 2 Default: 0
num-Ref-Frames : Number of Reference Frames for encoder
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 8 Default: 1
Element Actions:
“force-IDR” : void user_function (GstElement* object);
but many parameters are not working for Ex:
WARNING: erroneous pipeline: could not set property “SliceIntraRefreshInterval” in element “nvv4l2h265enc0” to “15!”
WARNING: erroneous pipeline: could not set property “preset-level” in element “nvv4l2h265enc0” to “0!”
WARNING: erroneous pipeline: could not set property “maxperf-enable” in element “nvv4l2h265enc0” to “0!”
WARNING: erroneous pipeline: could not set property “insert-sps-pps” in element “nvv4l2h265enc0” to “true!”
WARNING: erroneous pipeline: could not set property “insert-vui” in element “nvv4l2h265enc0” to “true!”
Issue 3: Enable Rate control and set the mode to 1 i.e. CBR mode.
used EnableTwopassCBR parameter, no difference observed. Getting the same output for EnableTwopassCBR = true and EnableTwopassCBR = false settings.
Issue 4: Supported parameter list (based on the info provided by gst-inspect-1.0 nvv4l2h265enc) is not same as in ACCLEREATED GSTREAMER USER GUIDE.
Issue 5: as per the element properties, bitrate can be changeable only in NULL or READY state.
but i am able to change the bit rate when the component is in execution stage
bitrate : Set bitrate for v4l2 encode
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4000000