h265 encoding only is Level4.1

I’ve been trying to optimize our image quality for both h264 and h265 encoding.

One thing I’ve noticed is that using h264 the profile is High@L5.2 when I use the omxh264enc gstreamer setting of profile 8.

On h265 I get an error returned if I use profile 8 ( and it doesn’t show up in the gst-inspect-1.0 omxh265enc like it does on the 264). And on h265 I see Main@L4.1 as the profile.

Is there another way to set to High Profile Level 5? Is it not supported for H265? I’ve noticed video quality is not as good in h265 and I suspect this is an issue.

Please check [Supported H.264/H.265 Encoder Features with Gstreamer-1.0] in gstreamer user guide.
https://developer.nvidia.com/embedded/dlc/l4t-accelerated-gstreamer-guide-28-2-ga

I see that entry in the guide where it talks about setting the level for h265
Set level
gst-launch-1.0 videotestsrc num-buffers=200 is-live=true !
‘video/x-raw, format=(string)I420, width=(int)256, height=(int)256,
framerate=(fraction)30/1’ ! omxh264enc bitrate=40000 !
‘video/x-h264, level=(string)2.2’ ! qtmux !
filesink location= test.mp4 -e
From omxh264enc, the following levels are supported: 1, 1b, 1.2, 1.3, 2, 2.1,
2.2, 3, 3.1, 3.2, 4, 4.1, 4.2, 5, 5.1, and 5.2

But when I do gst-inspect I don’t see the parameter for level, and if I try to use level parameter for a gstreamer pipeline it gives an error. This is JP3.3 on a TX1, I also looked at a TX2 using JP3.3. I also tried recompiling gstreamer 1.12.4 as per the gstreamer guide doc.

(gst-plugin-scanner:13200): GStreamer-WARNING **: Failed to load plugin ‘/home/nvidia/gst-1.12.4/lib/aarch64-linux-gnu/gstreamer-1.0/libgstkms.so’: /home/nvidia/gst-1.12.4/lib/aarch64-linux-gnu/gstreamer-1.0/libgstkms.so: undefined symbol: drmModeGetFB

(gst-plugin-scanner:13200): GStreamer-WARNING **: Failed to load plugin ‘/home/nvidia/gst-1.12.4/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvcompositor.so’: /home/nvidia/gst-1.12.4/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvcompositor.so: undefined symbol: gst_videoaggregator_pad_get_type
Factory Details:
Rank primary + 10 (266)
Long-name OpenMAX H.265 Video Encoder
Klass Codec/Encoder/Video
Description Encode H.265 video streams
Author Sanket Kothari skothari@nvidia.com

Plugin Details:
Name omx
Description GStreamer OpenMAX Plug-ins
Filename /home/nvidia/gst-1.12.4/lib/aarch64-linux-gnu/gstreamer-1.0/libgstomx.so
Version 1.0.0.1
License LGPL
Source module gst-omx
Source release date 2014-02-08
Binary package GStreamer source release
Origin URL Unknown package origin

GObject
±—GInitiallyUnowned
±—GstObject
±—GstElement
±—GstVideoEncoder
±—GstOMXVideoEnc
±—GstOMXH265Enc
±—GstOMXH265Enc-omxh265enc

Implemented Interfaces:
GstPreset

Pad Templates:
SRC template: ‘src’
Availability: Always
Capabilities:
video/x-h265
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
stream-format: { (string)byte-stream, (string)hvc1 }
alignment: au

SINK template: ‘sink’
Availability: Always
Capabilities:
video/x-raw(memory:NVMM)
format: { (string)I420, (string)I420_10LE, (string)NV12 }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
video/x-raw
format: { (string)I420, (string)NV12 }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]

Element Flags:
no flags set

Element Implementation:
Has change_state() function: gst_omx_video_enc_change_state

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: “omxh265enc-omxh265enc0”
parent : The parent of the object
flags: readable, writable
Object of type “GstObject”
control-rate : Bitrate control method
flags: readable, writable, changeable only in NULL or READY state
Enum “GstOMXVideoEncControlRate” Default: 1, “variable”
(0): disable - Disable
(1): variable - Variable
(2): constant - Constant
(3): variable-skip-frames - Variable Skip Frames
(4): constant-skip-frames - Constant Skip Frames
bitrate : Target bitrate
flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state
Unsigned Integer. Range: 0 - 4294967295 Default: 4000000
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)
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)
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)
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
iframeinterval : Encoding Intra Frame occurance frequency
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 0
SliceIntraRefreshEnable: Enable Slice Intra Refresh while encoding
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: false
SliceIntraRefreshInterval: Set SliceIntraRefreshInterval
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 4294967295 Default: 60
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
vbv-size : virtual buffer size = vbv-size * (bitrate/fps)
flags: readable, writable, changeable only in NULL or READY state
Unsigned Integer. Range: 0 - 30 Default: 10
temporal-tradeoff : Temporal Tradeoff value for encoder
flags: readable, writable, changeable only in NULL or READY state
Enum “GstOmxVideoEncTemporalTradeoffType” Default: 0, “Do not drop frames”
(0): Do not drop frames - GST_OMX_VIDENC_DROP_NO_FRAMES
(1): Drop 1 in 5 frames - GST_OMX_VIDENC_DROP_1_IN_5_FRAMES
(2): Drop 1 in 3 frames - GST_OMX_VIDENC_DROP_1_IN_3_FRAMES
(3): Drop 1 in 2 frames - GST_OMX_VIDENC_DROP_1_IN_2_FRAMES
(4): Drop 2 in 3 frames - GST_OMX_VIDENC_DROP_2_IN_3_FRAMES
EnableMVBufferMeta : Enable Motion Vector Meta data for encoding
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: false
qp-range : Qunatization range for P and I frame,
Use string with values of Qunatization Range
in MinQpP-MaxQpP:MinQpI-MaxQpP:MinQpB-MaxQpB order, to set the property.
flags: readable, writable
String. Default: “-1,-1:-1,-1:-1,-1”
MeasureEncoderLatency: Enable Measure Encoder latency Per Frame
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: false
EnableTwopassCBR : Enable two pass CBR while encoding
flags: readable, writable, changeable only in NULL or READY state
Boolean. Default: false
preset-level : HW preset level for encoder
flags: readable, writable, changeable only in NULL or READY state
Enum “GstOMXVideoEncHwPreset” Default: 0, “UltraFastPreset”
(0): UltraFastPreset - UltraFastPreset for high perf
(1): FastPreset - FastPreset
(2): MediumPreset - MediumPreset
(3): SlowPreset - SlowPreset
EnableStringentBitrate: Enable Stringent Bitrate Mode
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 Long. Range: 0 - 18446744073709551615 Default: 0
insert-aud : Insert H.265 Access Unit Delimiter(AUD)
flags: readable, writable
Boolean. Default: false
insert-vui : Insert H.265 VUI(Video Usability Information) in SPS
flags: readable, writable
Boolean. Default: false

Element Actions:
“force-IDR” : void user_function (GstElement* object);

Hi,
Do you mean you cannot launch the sample pipeline?

We have verified below two pipelines on r28.2/TX1:

gst-launch-1.0 videotestsrc num-buffers=200 is-live=true ! \
'video/x-raw, format=(string)I420, width=(int)256, height=(int)256, \
framerate=(fraction)30/1' ! omxh264enc bitrate=40000 !\
'video/x-h264, level=(string)2.2' ! qtmux ! \
filesink location= test.mp4 -e
$ gst-launch-1.0 videotestsrc num-buffers=200 is-live=true ! 'video/x-raw, format=(string)I420, width=(int)256, height=(int)256, \
framerate=(fraction)30/1' ! omxh265enc bitrate=40000 !'video/x-h265, level=(string)high2.1' ! matroskamux ! filesink location= test.mkv -e

OK That worked,

mediainfo “30-300-0-39,51 : 34,51 : 39,51.mp4” General
Complete name : 30-300-0-39,51 : 34,51 : 39,51.mp4
Format : HEVC
Format/Info : High Efficiency Video Coding
File size : 2.65 MiB

Video
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main@L5@High
Width : 3 864 pixels
Height : 2 174 pixels
Display aspect ratio : 16:9
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits

Note that that’s kinda of odd, in that the encoding profile for h264 is configurable as a property of omxh264enc and for 265 its another pipeline step. But regardless, can get level5 encoding now on h265 on tx1.