Glib error for nvv4l2h265enc ! While omxh265enc runs fine.

nvidia@jetson:~/jai$ gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 num-buffers=100 !
'image/jpeg,width=1280,height=720, framerate=60/1,format=I420' ! jpegdec ! video/x-raw ! nvvidconv !
'video/x-raw(memory:NVMM)' !  nvv4l2h265enc ! h265parse ! qtmux ! filesink location=filename_h265.mp4 -e

Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 

(gst-launch-1.0:12235): GLib-GObject-WARNING **: 11:46:59.944: cannot register existing type 'GstV4l2VideoDec'

(gst-launch-1.0:12235): GLib-CRITICAL **: 11:46:59.944: g_once_init_leave: assertion 'result != 0' failed
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

(gst-launch-1.0:12235): GLib-GObject-WARNING **: 11:47:00.285: cannot register existing type 'GstV4l2BufferPool'

(gst-launch-1.0:12235): GLib-CRITICAL **: 11:47:00.285: g_once_init_leave: assertion 'result != 0' failed

(gst-launch-1.0:12235): GLib-GObject-CRITICAL **: 11:47:00.285: g_object_new_valist: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

(gst-launch-1.0:12235): GLib-GObject-CRITICAL **: 11:47:00.285: g_object_ref_sink: assertion 'G_IS_OBJECT (object)' failed
Caught SIGSEGV
#0  0x0000007fa6b72048 in __GI___poll (fds=0x55b651dd40, nfds=548258968176, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:41
#1  0x0000007fa6c7ee40 in  () at /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#2  0x00000055b64622f0 in  ()
Spinning.  Please run 'gdb gst-launch-1.0 12235' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.
^Chandling interrupt.
Interrupt: Stopping pipeline ...
EOS on shutdown enabled -- Forcing EOS on the pipeline
^C

I am trying to encode video streaming coming from USBCAM. If I use ‘nvv4l2h265enc’ it throws error.
But ‘omxh265enc’ works completely fine for above pipeline.

How can I use ‘nvv4l2h265enc’?

GStreamer 1.14.5

Hi,
The following pipeline works with Logitech C930e USB cam. FYR.

$ gst-launch-1.0 v4l2src device=/dev/video1 io-mode=2 num-buffers=100 ! 'image/jpeg,width=1280,height=720, framerate=30/1' ! jpegdec ! video/x-raw ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' !  nvv4l2h265enc ! h265parse ! qtmux ! filesink location=filename_h265.mp4

It is throwing similar error on your commandline also.

nvidia@jetson:~$ gst-launch-1.0 v4l2src device=/dev/v4l/by-id/usb-3.0_USB_Camera_3.0_USB_Camera-video-index0 io-mode=2 num-buffers=100 ! 'image/jpeg,width=1280,height=720, framerate=60/1' ! jpegdec ! video/x-raw ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' !  nvv4l2h265enc ! fakesink
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 

(gst-launch-1.0:10607): GLib-GObject-WARNING **: 10:10:11.022: cannot register existing type 'GstV4l2VideoDec'

(gst-launch-1.0:10607): GLib-CRITICAL **: 10:10:11.022: g_once_init_leave: assertion 'result != 0' failed
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

(gst-launch-1.0:10607): GLib-GObject-WARNING **: 10:10:11.383: cannot register existing type 'GstV4l2BufferPool'

(gst-launch-1.0:10607): GLib-CRITICAL **: 10:10:11.383: g_once_init_leave: assertion 'result != 0' failed

(gst-launch-1.0:10607): GLib-GObject-CRITICAL **: 10:10:11.383: g_object_new_valist: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

(gst-launch-1.0:10607): GLib-GObject-CRITICAL **: 10:10:11.383: g_object_ref_sink: assertion 'G_IS_OBJECT (object)' failed
Caught SIGSEGV
#0  0x0000007f99cf9048 in __GI___poll (fds=0x5581fb0470, nfds=548042465904, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:41
#1  0x0000007f99e05e40 in  () at /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#2  0x0000005581f1faf0 in  ()
Spinning.  Please run 'gdb gst-launch-1.0 10607' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:04.936467132
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
^C
nvidia@jetson:~$

If I replace nvv4l2h265enc with omxh265enc, it works fine.
But I am wishing to use nvv4l2h265enc

Hi,
Do you have other USB cameras to give it a try? Probably it happens only when using the specific camera.

Yes, I have another camera with ON image sensor (previous one Sony).
But, it is also throwing same error.

gst-launch-1.0 v4l2src device=/dev/v4l/by-id/usb-HD_USB_Camera_HD_USB_Camera_HD_USB_Camera-video-index0 io-mode=2 num-buffers=100 ! 'image/jpeg,width=1280,height=720, framerate=120/1' ! videorate drop-only = true max-rate=30 ! jpegdec ! video/x-raw ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' !  nvv4l2h265enc ! h265parse ! fakesink
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 

(gst-launch-1.0:19800): GLib-GObject-WARNING **: 13:24:47.221: cannot register existing type 'GstV4l2VideoDec'

(gst-launch-1.0:19800): GLib-CRITICAL **: 13:24:47.222: g_once_init_leave: assertion 'result != 0' failed
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

(gst-launch-1.0:19800): GLib-GObject-WARNING **: 13:24:47.580: cannot register existing type 'GstV4l2BufferPool'

(gst-launch-1.0:19800): GLib-CRITICAL **: 13:24:47.580: g_once_init_leave: assertion 'result != 0' failed

(gst-launch-1.0:19800): GLib-GObject-CRITICAL **: 13:24:47.580: g_object_new_valist: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

(gst-launch-1.0:19800): GLib-GObject-CRITICAL **: 13:24:47.580: g_object_ref_sink: assertion 'G_IS_OBJECT (object)' failed
Caught SIGSEGV
#0  0x0000007f8a9ce048 in __GI___poll (fds=0x5574c42e00, nfds=547787485808, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:41
#1  0x0000007f8aadae40 in  () at /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#2  0x0000005574b98b00 in  ()
Spinning.  Please run 'gdb gst-launch-1.0 19800' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:03.864225259
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
^C
nvidia@jetson:~$

Hi,
If it is not specific to certain cameras, it is more like an issue in system. Please check if cleaning cache helps:

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

Or you may try clean re-flash via sdkmanager.