H265 gstreamer encoder don't work

Hi,
I try to use nv hardware h265 encoder by gstreamer.
My camera format is YUYV. Platform is Thor and JP7.1. I use “nvvidconv” convert YUY2 to NV12/I420
I use this command “gst-launch-1.0 v4l2src device=/dev/video32 ! ‘video/x-raw,format=YUY2,width=1920,height=1536,framerate=30/1’ ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=NV12’ ! nvv4l2h265enc ! h265parse ! filesink location=1.h265”
It report error as below:

Could you help looking what is wrong?

BR//

I believe these worked for me before.

gst-launch-1.0 -e v4l2src device=/dev/video32 ! \
'video/x-raw,format=YUY2,width=1920,height=1536,framerate=30/1' ! \
nvvidconv ! \
'video/x-raw(memory:NVMM),format=NV12' ! \
nvv4l2h265enc bitrate=8000000 ! \
h265parse ! \
filesink location=1.h265

Or with nv3dsink for a preview window

gst-launch-1.0 -e v4l2src device=/dev/video32 ! \
'video/x-raw,format=YUY2,width=1920,height=1536,framerate=30/1' ! \
clockoverlay halignment=right valignment=bottom time-format="%Y-%m-%d %H:%M:%S" ! \
nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! \
tee name=t \
t. ! queue ! nvv4l2h265enc bitrate=8000000 ! h265parse ! filesink location=1.h265 \
t. ! queue ! nv3dsink

Hi,
If you extract driver packge and sample rootfs manually, please make sure you don’t miss - -openrm in apply_binaries.sh:
Quick Start — NVIDIA Jetson Linux Developer Guide

And please try to clean the cache:

$ rm .cache/gstreamer-1.0/registry.aarch64.bin

Hi, DaneLLL:
We have apply “openrm in apply_binaries.sh” when we integrate our rootfs.
But it still report that error.
Is there any way to look into which package or library is missing?

BR//

Hi,
We try the command on AGX Thor developer kit(RT kernel and non-RT kernel) but do not observe the issue:

nvidia@nvidia-ppcc:~$ gst-launch-1.0 -ev videotestsrc num-buffers=150 is-live=1 ! video/x-raw,format=I420,width=1920,height=1080 ! nvvidconv ! nvv4l2h265enc ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL ...
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0: sync = false
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, multiview-mode=(string)mono, interlace-mode=(string)progressive
/GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0.GstPad:src: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, level=(string)NULL, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, level=(string)NULL, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, level=(string)NULL, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0.GstGhostPad:sink: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, level=(string)NULL, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
Redistribute latency...
/GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, multiview-mode=(string)mono, interlace-mode=(string)progressive
/GstPipeline:pipeline0/Gstnvvconv:nvvconv0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Redistribute latency...
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 18, dropped: 0, current: 34.19, average: 34.19
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 33, dropped: 0, current: 30.00, average: 32.15
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 48, dropped: 0, current: 30.00, average: 31.44
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 64, dropped: 0, current: 30.00, average: 31.07
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 79, dropped: 0, current: 29.95, average: 30.85
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 95, dropped: 0, current: 30.00, average: 30.70
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 110, dropped: 0, current: 30.00, average: 30.61
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 126, dropped: 0, current: 30.00, average: 30.53
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 142, dropped: 0, current: 30.00, average: 30.47
Got EOS from element "pipeline0".
EOS received - stopping pipeline...
Execution ended after 0:00:05.129106958
Setting pipeline to NULL ...
Freeing pipeline ...

Please give it a try. If the issue persists, please try to remove nvidia-l4t-gstreamer deb package, re-install it and clean the cache.

It’s OK if I strictly follow the NV guide, but we have to do some customization work.
I think it is caused by our customizing the rootfs, but I don’t know which action may lead to that error.
I’m sure the " *openrm in apply_binaries.sh" is applied.
I use strace to analyze the program flow.


the left is normal process, I can use nvv4l2h265enc.
the right is abnormal procees, it will report upper error.
Is there any env or something else setting may lead to that difference?

I also find a similar issue in forum:DeepStream 6.3 Installation Error: Addressing Issues with GStreamer and nvv4l2h264enc

What is the command line for the image on the right?

dpkg -S /usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvcuvidvideocodec.so 
nvidia-l4t-multimedia-openrm: /usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvcuvidvideocodec.so

dpkg -S /usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/
nvidia-l4t-camera, nvidia-l4t-multimedia-openrm: /usr/lib/aarch64-linux-gnu/libv4l/plugins/nv

So you could try following, but if you didn’t run ./apply_binaries.sh --openrm you may encounter other problems.

sudo apt install nvidia-l4t-camera nvidia-l4t-multimedia-openrm

Hi,
The path is different for initializing openrm driver. Please refer to 01 sample and NvVideoEncoder,cpp of r38.4:

/usr/src/jetson_multimedia_api/samples/01_video_encode/
/usr/src/jetson_multimedia_api/samples/common/classes/NvVideoEncoder.cpp

And may also refer to
How to initialize a video encoder on Jetson Thor? - #8 by DavidDDD

See if you can dig out the rootcause from the reference codes.