GStreamer USB camera H264 pipeline - gstreamer

I'm running into issues creating a GStreamer pipeline that takes the frames from the USB video camera connected to my embedded Linux (slightly modified Toradex Multimedia image) development board. I'm able to display the camera's feed using the following pipeline
gst-launch-1.0 -v v4l2src device=/dev/video2 ! v4l2jpegdec ! autovideosink
However, if I try to do a simple h264 encoding, I get the following error (full log below). From what I can tell, the caps from the jpegdecoder are properly matched to the ones needed by h264 encoder. I've had to cut the log file, but the last line shows the error and I've removed the GST_STATES events as those didn't seem to show anything meaningful.
root#apalis-imx8-06959030:~# GST_DEBUG=4 gst-launch-1.0 -v v4l2src device=/dev/video2 ! v4l2jpegdec ! v4l2h264enc ! v4l2h264dec ! autovideosink
0:00:00.000155372 2492 0xaaaadc3bf600 INFO GST_INIT gst.c:586:init_pre: Initializing GStreamer Core Library version 1.16.2
0:00:00.000230120 2492 0xaaaadc3bf600 INFO GST_INIT gst.c:587:init_pre: Using library installed in /usr/lib
0:00:00.000263869 2492 0xaaaadc3bf600 INFO GST_INIT gst.c:605:init_pre: Linux apalis-imx8-06959030 5.4.154-5.5.0-devel+git.c65f1622951c #1 SMP PREEMPT Mon Jan 3 15:58:01 UTC 2022 aarch64
0:00:00.000773982 2492 0xaaaadc3bf600 INFO GST_INIT gstmessage.c:128:_priv_gst_message_initialize: init messages
0:00:00.001962580 2492 0xaaaadc3bf600 INFO GST_INIT gstcontext.c:84:_priv_gst_context_initialize: init contexts
0:00:00.002429820 2492 0xaaaadc3bf600 INFO GST_PLUGIN_LOADING gstplugin.c:318:_priv_gst_plugin_initialize: registering 0 static plugins
0:00:00.002664189 2492 0xaaaadc3bf600 INFO GST_PLUGIN_LOADING gstplugin.c:226:gst_plugin_register_static: registered static plugin "staticelements"
0:00:00.002700188 2492 0xaaaadc3bf600 INFO GST_PLUGIN_LOADING gstplugin.c:228:gst_plugin_register_static: added static plugin "staticelements", result: 1
0:00:00.002752687 2492 0xaaaadc3bf600 INFO GST_REGISTRY gstregistry.c:1720:ensure_current_registry: reading registry cache: /home/root/.cache/gstreamer-1.0/registry.aarch64.bin
0:00:00.061302350 2492 0xaaaadc3bf600 INFO GST_REGISTRY gstregistrybinary.c:621:priv_gst_registry_binary_read_cache: loaded /home/root/.cache/gstreamer-1.0/registry.aarch64.bin in 0.058444 seconds
0:00:00.061605218 2492 0xaaaadc3bf600 INFO GST_REGISTRY gstregistry.c:1579:scan_and_update_registry: Validating plugins from registry cache: /home/root/.cache/gstreamer-1.0/registry.aarch64.bin
0:00:00.072084354 2492 0xaaaadc3bf600 INFO GST_REGISTRY gstregistry.c:1678:scan_and_update_registry: Registry cache has not changed
0:00:00.072151228 2492 0xaaaadc3bf600 INFO GST_REGISTRY gstregistry.c:1755:ensure_current_registry: registry reading and updating done, result = 1
0:00:00.072186227 2492 0xaaaadc3bf600 INFO GST_INIT gst.c:806:init_post: GLib runtime version: 2.62.6
0:00:00.072219726 2492 0xaaaadc3bf600 INFO GST_INIT gst.c:808:init_post: GLib headers version: 2.62.6
0:00:00.072244726 2492 0xaaaadc3bf600 INFO GST_INIT gst.c:810:init_post: initialized GStreamer successfully
0:00:00.072309849 2492 0xaaaadc3bf600 INFO GST_PIPELINE gstparse.c:336:gst_parse_launch_full: parsing pipeline description 'v4l2src device=/dev/video2 ! v4l2jpegdec ! v4l2h264enc ! v4l2h264dec ! autovideosink '
0:00:00.467121835 2492 0xaaaadc3bf600 INFO GST_PLUGIN_LOADING gstplugin.c:902:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/gstreamer-1.0/libgstvideo4linux2.so" loaded
(...)
0:00:00.481494256 2492 0xaaaadc3bf600 INFO GST_EVENT gstevent.c:1579:gst_event_new_reconfigure: creating reconfigure event
0:00:00.481706377 2492 0xaaaadc3bf600 INFO GST_ELEMENT_FACTORY gstelementfactory.c:361:gst_element_factory_create: creating element "pipeline"
0:00:00.482190866 2492 0xaaaadc3bf600 INFO GST_PIPELINE grammar.y:648:gst_parse_perform_link: linking some pad of GstV4l2Src named v4l2src0 to some pad of v4l2jpegdec named v4l2jpegdec0 (0/0) with caps "(NULL)"
0:00:00.482276239 2492 0xaaaadc3bf600 INFO GST_ELEMENT_PADS gstutils.c:1771:gst_element_link_pads_full: trying to link element v4l2src0:(any) to element v4l2jpegdec0:(any)
0:00:00.482360987 2492 0xaaaadc3bf600 INFO GST_PADS gstutils.c:1034:gst_pad_check_link: trying to link v4l2src0:src and v4l2jpegdec0:sink
0:00:00.482480984 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:4237:gst_pad_peer_query:<v4l2jpegdec0:src> pad has no peer
0:00:00.482790977 2492 0xaaaadc3bf600 INFO GST_PADS gstutils.c:1587:prepare_link_maybe_ghosting: v4l2src0 and v4l2jpegdec0 in same bin, no need for ghost pads
0:00:00.482910974 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:2377:gst_pad_link_prepare: trying to link v4l2src0:src and v4l2jpegdec0:sink
0:00:00.483005222 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:4237:gst_pad_peer_query:<v4l2jpegdec0:src> pad has no peer
0:00:00.483142969 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:2585:gst_pad_link_full: linked v4l2src0:src and v4l2jpegdec0:sink, successful
0:00:00.483202092 2492 0xaaaadc3bf600 INFO GST_EVENT gstevent.c:1579:gst_event_new_reconfigure: creating reconfigure event
0:00:00.483260716 2492 0xaaaadc3bf600 INFO GST_EVENT gstpad.c:5812:gst_pad_send_event_unchecked:<v4l2src0:src> Received event on flushing pad. Discarding
0:00:00.483383338 2492 0xaaaadc3bf600 INFO GST_PIPELINE grammar.y:648:gst_parse_perform_link: linking some pad of v4l2jpegdec named v4l2jpegdec0 to some pad of v4l2h264enc named v4l2h264enc0 (0/0) with caps "(NULL)"
0:00:00.483459962 2492 0xaaaadc3bf600 INFO GST_ELEMENT_PADS gstutils.c:1771:gst_element_link_pads_full: trying to link element v4l2jpegdec0:(any) to element v4l2h264enc0:(any)
0:00:00.483539335 2492 0xaaaadc3bf600 INFO GST_PADS gstutils.c:1034:gst_pad_check_link: trying to link v4l2jpegdec0:src and v4l2h264enc0:sink
0:00:00.483655457 2492 0xaaaadc3bf600 INFO GST_PADS gstutils.c:1587:prepare_link_maybe_ghosting: v4l2jpegdec0 and v4l2h264enc0 in same bin, no need for ghost pads
0:00:00.483887827 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:2377:gst_pad_link_prepare: trying to link v4l2jpegdec0:src and v4l2h264enc0:sink
0:00:00.484000449 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:2585:gst_pad_link_full: linked v4l2jpegdec0:src and v4l2h264enc0:sink, successful
0:00:00.484058573 2492 0xaaaadc3bf600 INFO GST_EVENT gstevent.c:1579:gst_event_new_reconfigure: creating reconfigure event
0:00:00.484117697 2492 0xaaaadc3bf600 INFO GST_EVENT gstpad.c:5812:gst_pad_send_event_unchecked:<v4l2jpegdec0:src> Received event on flushing pad. Discarding
0:00:00.484235569 2492 0xaaaadc3bf600 INFO GST_PIPELINE grammar.y:648:gst_parse_perform_link: linking some pad of v4l2h264enc named v4l2h264enc0 to some pad of v4l2h264dec named v4l2h264dec0 (0/0) with caps "(NULL)"
0:00:00.484312192 2492 0xaaaadc3bf600 INFO GST_ELEMENT_PADS gstutils.c:1771:gst_element_link_pads_full: trying to link element v4l2h264enc0:(any) to element v4l2h264dec0:(any)
0:00:00.484390940 2492 0xaaaadc3bf600 INFO GST_PADS gstutils.c:1034:gst_pad_check_link: trying to link v4l2h264enc0:src and v4l2h264dec0:sink
0:00:00.484480938 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:4237:gst_pad_peer_query:<v4l2h264dec0:src> pad has no peer
0:00:00.484623560 2492 0xaaaadc3bf600 INFO GST_PADS gstutils.c:1587:prepare_link_maybe_ghosting: v4l2h264enc0 and v4l2h264dec0 in same bin, no need for ghost pads
0:00:00.484713933 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:2377:gst_pad_link_prepare: trying to link v4l2h264enc0:src and v4l2h264dec0:sink
0:00:00.484800306 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:4237:gst_pad_peer_query:<v4l2h264dec0:src> pad has no peer
0:00:00.485071675 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:2585:gst_pad_link_full: linked v4l2h264enc0:src and v4l2h264dec0:sink, successful
0:00:00.485132173 2492 0xaaaadc3bf600 INFO GST_EVENT gstevent.c:1579:gst_event_new_reconfigure: creating reconfigure event
0:00:00.485191047 2492 0xaaaadc3bf600 INFO GST_EVENT gstpad.c:5812:gst_pad_send_event_unchecked:<v4l2h264enc0:src> Received event on flushing pad. Discarding
0:00:00.485305419 2492 0xaaaadc3bf600 INFO GST_PIPELINE grammar.y:648:gst_parse_perform_link: linking some pad of v4l2h264dec named v4l2h264dec0 to some pad of GstAutoVideoSink named autovideosink0 (0/0) with caps "(NULL)"
0:00:00.485444541 2492 0xaaaadc3bf600 INFO GST_ELEMENT_PADS gstutils.c:1771:gst_element_link_pads_full: trying to link element v4l2h264dec0:(any) to element autovideosink0:(any)
0:00:00.485525289 2492 0xaaaadc3bf600 INFO GST_PADS gstutils.c:1034:gst_pad_check_link: trying to link v4l2h264dec0:src and autovideosink0:sink
0:00:00.485644037 2492 0xaaaadc3bf600 INFO GST_PADS gstutils.c:1587:prepare_link_maybe_ghosting: v4l2h264dec0 and autovideosink0 in same bin, no need for ghost pads
0:00:00.485734785 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:2377:gst_pad_link_prepare: trying to link v4l2h264dec0:src and autovideosink0:sink
0:00:00.485854907 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:2585:gst_pad_link_full: linked v4l2h264dec0:src and autovideosink0:sink, successful
0:00:00.486087902 2492 0xaaaadc3bf600 INFO GST_EVENT gstevent.c:1579:gst_event_new_reconfigure: creating reconfigure event
0:00:00.486152900 2492 0xaaaadc3bf600 INFO GST_EVENT gstpad.c:5812:gst_pad_send_event_unchecked:<v4l2h264dec0:src> Received event on flushing pad. Discarding
Setting pipeline to PAUSED ...
(...)
0:00:00.489583697 2492 0xaaaadc3bf600 INFO GST_ELEMENT_PADS gstpad.c:2132:gst_pad_unlink: unlinking sink:proxypad0(0xaaaadc6260f0) and fake-video-sink:sink(0xaaaadc619220)
0:00:00.489664070 2492 0xaaaadc3bf600 INFO GST_ELEMENT_PADS gstpad.c:2187:gst_pad_unlink: unlinked sink:proxypad0 and fake-video-sink:sink
0:00:00.489733818 2492 0xaaaadc3bf600 INFO GST_PARENTAGE gstbin.c:1801:gst_bin_remove_func:<autovideosink0> removed child "fake-video-sink"
0:00:00.489839816 2492 0xaaaadc3bf600 INFO GST_REFCOUNTING gstelement.c:3251:gst_element_dispose:<fake-video-sink> 0xaaaadc62e5f0 dispose
0:00:00.489907189 2492 0xaaaadc3bf600 INFO GST_ELEMENT_PADS gstelement.c:784:gst_element_remove_pad:<fake-video-sink> removing pad 'sink'
0:00:00.489997937 2492 0xaaaadc3bf600 INFO GST_REFCOUNTING gstelement.c:3296:gst_element_dispose:<fake-video-sink> 0xaaaadc62e5f0 parent class dispose
0:00:00.490067936 2492 0xaaaadc3bf600 INFO GST_REFCOUNTING gstelement.c:3328:gst_element_finalize:<fake-video-sink> 0xaaaadc62e5f0 finalize
0:00:00.490137059 2492 0xaaaadc3bf600 INFO GST_REFCOUNTING gstelement.c:3333:gst_element_finalize:<fake-video-sink> 0xaaaadc62e5f0 finalize parent
0:00:00.497457767 2492 0xaaaadc3bf600 INFO GST_PLUGIN_LOADING gstplugin.c:902:_priv_gst_plugin_load_file_for_registry: plugin "/usr/lib/gstreamer-1.0/libgstwaylandsink.so" loaded
0:00:00.497574014 2492 0xaaaadc3bf600 INFO GST_ELEMENT_FACTORY gstelementfactory.c:358:gst_element_factory_create: creating element "waylandsink" named "autovideosink0-actual-sink-wayland"
0:00:00.498246374 2492 0xaaaadc3bf600 INFO GST_ELEMENT_PADS gstelement.c:668:gst_element_add_pad:<GstBaseSink#0xaaaadc6343e0> adding pad 'sink'
0:00:00.498384371 2492 0xaaaadc3bf600 INFO GST_ELEMENT_PADS gstelement.c:915:gst_element_get_static_pad: found pad autovideosink0-actual-sink-wayland:sink
0:00:00.498631115 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:4237:gst_pad_peer_query:<autovideosink0-actual-sink-wayland:sink> pad has no peer
(...)
0:00:00.502424154 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:2377:gst_pad_link_prepare: trying to link sink:proxypad0 and autovideosink0-actual-sink-wayland:sink
0:00:00.502562400 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:2585:gst_pad_link_full: linked sink:proxypad0 and autovideosink0-actual-sink-wayland:sink, successful
0:00:00.502604774 2492 0xaaaadc3bf600 INFO GST_EVENT gstevent.c:1579:gst_event_new_reconfigure: creating reconfigure event
(...)
0:00:00.505876325 2492 0xaaaadc3bf600 INFO v4l2 v4l2_calls.c:629:gst_v4l2_open:<v4l2h264dec0:sink> Opened device 'vpu B0' (/dev/video12) successfully
0:00:00.505952323 2492 0xaaaadc3bf600 INFO v4l2 v4l2_calls.c:735:gst_v4l2_dup:<v4l2h264dec0:src> Cloned device 'vpu B0' (/dev/video12) successfully
0:00:00.506098070 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1228:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> got 15 format(s):
0:00:00.506149818 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> JPEG
0:00:00.506196067 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> M264
0:00:00.506241816 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> LOGO
0:00:00.506286440 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> XVID
0:00:00.506331439 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> HEVC
0:00:00.506375813 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> VP80
0:00:00.506420312 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> H263
0:00:00.506464436 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> SPK0
0:00:00.506509060 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> VP60
0:00:00.506552434 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> MPG4
0:00:00.506596183 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> AVS0
0:00:00.506639932 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> MPG2
0:00:00.506683931 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> VC1L
0:00:00.506727930 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> VC1G
0:00:00.506771929 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264dec0:sink> H264
0:00:00.506953050 2492 0xaaaadc3bf600 WARN v4l2 gstv4l2object.c:2031:gst_v4l2_object_get_interlace_mode: Driver bug detected - check driver with v4l2-compliance from http://git.linuxtv.org/v4l-utils.git
0:00:00.506999299 2492 0xaaaadc3bf600 WARN v4l2 gstv4l2object.c:2031:gst_v4l2_object_get_interlace_mode: Driver bug detected - check driver with v4l2-compliance from http://git.linuxtv.org/v4l-utils.git
0:00:00.507306667 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:4458:gst_v4l2_object_probe_caps:<v4l2h264dec0:sink> probed caps: video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], colorimetry=(string){ bt709 }, parsed=(boolean)true
(...)
0:00:00.508503890 2492 0xaaaadc3bf600 INFO v4l2 v4l2_calls.c:629:gst_v4l2_open:<v4l2h264enc0:sink> Opened device 'vpu encoder' (/dev/video13) successfully
0:00:00.508571513 2492 0xaaaadc3bf600 INFO v4l2 v4l2_calls.c:735:gst_v4l2_dup:<v4l2h264enc0:src> Cloned device 'vpu encoder' (/dev/video13) successfully
(...)
0:00:00.509007878 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:4458:gst_v4l2_object_probe_caps:<v4l2h264enc0:sink> probed caps: video/x-raw, format=(string)NV12, width=(int)[ 64, 1920, 16 ], height=(int)[ 48, 1920, 2 ], framerate=(fraction)[ 1/65535, 65535/1 ], interlace-mode=(string)progressive, colorimetry=(string){ bt709 }
0:00:00.509067877 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1228:gst_v4l2_object_fill_format_list:<v4l2h264enc0:src> got 1 format(s):
0:00:00.509114876 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2h264enc0:src> H264
0:00:00.509377245 2492 0xaaaadc3bf600 WARN v4l2 gstv4l2object.c:4400:gst_v4l2_object_probe_caps:<v4l2h264enc0:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Invalid argument
0:00:00.509608489 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:4458:gst_v4l2_object_probe_caps:<v4l2h264enc0:src> probed caps: video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, width=(int)[ 64, 1920, 16 ], height=(int)[ 48, 1920, 2 ], colorimetry=(string){ bt709 }, framerate=(fraction)[ 1/65535, 65535/1 ]
(...)
0:00:00.510477970 2492 0xaaaadc3bf600 INFO v4l2 v4l2_calls.c:629:gst_v4l2_open:<v4l2jpegdec0:sink> Opened device 'vpu B0' (/dev/video12) successfully
0:00:00.510546718 2492 0xaaaadc3bf600 INFO v4l2 v4l2_calls.c:735:gst_v4l2_dup:<v4l2jpegdec0:src> Cloned device 'vpu B0' (/dev/video12) successfully
0:00:00.510673340 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1228:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> got 15 format(s):
0:00:00.510722464 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> JPEG
0:00:00.510768588 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> M264
0:00:00.510813712 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> LOGO
0:00:00.510858211 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> XVID
0:00:00.510902960 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> HEVC
0:00:00.510947459 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> VP80
0:00:00.510991958 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> H263
0:00:00.511036582 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> SPK0
0:00:00.511081206 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> VP60
0:00:00.511125705 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> MPG4
0:00:00.511171204 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> AVS0
0:00:00.511215578 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> MPG2
0:00:00.511259577 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> VC1L
0:00:00.511304201 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> VC1G
0:00:00.511348325 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:sink> H264
0:00:00.511400699 2492 0xaaaadc3bf600 WARN v4l2 gstv4l2object.c:2031:gst_v4l2_object_get_interlace_mode: Driver bug detected - check driver with v4l2-compliance from http://git.linuxtv.org/v4l-utils.git
0:00:00.511442573 2492 0xaaaadc3bf600 WARN v4l2 gstv4l2object.c:2031:gst_v4l2_object_get_interlace_mode: Driver bug detected - check driver with v4l2-compliance from http://git.linuxtv.org/v4l-utils.git
0:00:00.511664318 2492 0xaaaadc3bf600 INFO v4l2 gstv4l2object.c:4458:gst_v4l2_object_probe_caps:<v4l2jpegdec0:sink> probed caps: image/jpeg, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], colorimetry=(string){ bt709 }, parsed=(boolean)true
(...)
0:00:00.512338052 2492 0xaaaadc3bf600 INFO v4l2 v4l2_calls.c:629:gst_v4l2_open:<v4l2src0:src> Opened device 'HD USB Camera: HD USB Camera' (/dev/video2) successfully
0:00:00.512379801 2492 0xaaaadc3bf600 WARN v4l2 v4l2_calls.c:547:gst_v4l2_subscribe_event:<v4l2src0> Cannot subscribe V4L2_EVENT_SOURCE_CHANGE or V4L2_EVENT_EOS event for device '/dev/video2'.
(....)
0:00:00.513800894 2492 0xaaaadc3bf600 INFO basesrc gstbasesrc.c:1373:gst_base_src_do_seek:<v4l2src0> seeking: time segment start=0:00:00.000000000, offset=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000, duration 99:99:99.999999999
0:00:00.513879142 2492 0xaaaadc3bf600 INFO task gsttask.c:453:gst_task_set_lock: setting stream lock 0xaaaadc618260 on task 0xaaaadc61a4d0
0:00:00.513916641 2492 0xaaaadc3bf600 INFO GST_PADS gstpad.c:6159:gst_pad_start_task:<v4l2src0:src> created task 0xaaaadc61a4d0
(...)
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
0:00:00.515688101 2492 0xaaaadc3bf600 INFO GST_EVENT gstevent.c:1449:gst_event_new_latency: creating latency event 0:00:00.000000000
0:00:00.515772099 2492 0xaaaadc3bf600 INFO bin gstbin.c:2783:gst_bin_do_latency_func:<pipeline0> configured latency of 0:00:00.000000000
0:00:00.515842472 2492 0xaaaadc3bf600 INFO GST_STATES gstbin.c:2503:gst_bin_element_set_state:<autovideosink0> current READY pending PAUSED, desired next PLAYING
(...)
New clock: GstSystemClock
0:00:00.517009446 2492 0xaaaadc620a80 INFO GST_ELEMENT_PADS gstelement.c:912:gst_element_get_static_pad: no such pad 'sink' in element "v4l2src0"
0:00:00.517236565 2492 0xaaaadc620a80 INFO v4l2 gstv4l2object.c:1228:gst_v4l2_object_fill_format_list:<v4l2src0:src> got 1 format(s):
0:00:00.517279814 2492 0xaaaadc620a80 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2src0:src> MJPG
0:00:00.517487060 2492 0xaaaadc620a80 INFO v4l2 gstv4l2object.c:4458:gst_v4l2_object_probe_caps:<v4l2src0:src> probed caps: image/jpeg, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)60/1; image/jpeg, width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)120/1; image/jpeg, width=(int)640, height=(int)360, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)1285718/4945
0:00:00.529659282 2492 0xaaaadc620a80 INFO GST_EVENT gstevent.c:820:gst_event_new_caps: creating caps event image/jpeg, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, colorimetry=(string)bt709, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = image/jpeg, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, colorimetry=(string)bt709, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
0:00:00.530005899 2492 0xaaaadc620a80 INFO v4l2 gstv4l2object.c:3040:gst_v4l2_object_setup_pool:<v4l2jpegdec0:sink> accessing buffers via mode 2
0:00:00.530382015 2492 0xaaaadc620a80 INFO v4l2bufferpool gstv4l2bufferpool.c:557:gst_v4l2_buffer_pool_set_config:<v4l2jpegdec0:pool:sink> increasing minimum buffers to 2
0:00:00.530417639 2492 0xaaaadc620a80 INFO v4l2bufferpool gstv4l2bufferpool.c:570:gst_v4l2_buffer_pool_set_config:<v4l2jpegdec0:pool:sink> reducing maximum buffers to 32
0:00:00.530448139 2492 0xaaaadc620a80 INFO v4l2bufferpool gstv4l2bufferpool.c:581:gst_v4l2_buffer_pool_set_config:<v4l2jpegdec0:pool:sink> can't allocate, setting maximum to minimum
0:00:00.530514387 2492 0xaaaadc620a80 INFO v4l2 gstv4l2object.c:1228:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:src> got 2 format(s):
0:00:00.530558386 2492 0xaaaadc620a80 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:src> NT12
0:00:00.530594135 2492 0xaaaadc620a80 INFO v4l2 gstv4l2object.c:1232:gst_v4l2_object_fill_format_list:<v4l2jpegdec0:src> NV12
0:00:00.530631384 2492 0xaaaadc620a80 WARN v4l2 gstv4l2object.c:4400:gst_v4l2_object_probe_caps:<v4l2jpegdec0:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Invalid argument
0:00:00.531065125 2492 0xaaaadc620a80 INFO v4l2 gstv4l2object.c:4458:gst_v4l2_object_probe_caps:<v4l2jpegdec0:src> probed caps: video/x-raw, format=(string)NV12_10LE, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], framerate=(fraction)[ 0/1, 2147483647/1 ], interlace-mode=(string){ progressive, interleaved }, colorimetry=(string){ bt709 }; video/x-raw, format=(string)NV12, width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], framerate=(fraction)[ 0/1, 2147483647/1 ], interlace-mode=(string){ progressive, interleaved }, colorimetry=(string){ bt709 }
/GstPipeline:pipeline0/v4l2jpegdec:v4l2jpegdec0.GstPad:sink: caps = image/jpeg, width=(int)1920, height=(int)1080, framerate=(fraction)60/1, colorimetry=(string)bt709, parsed=(boolean)true, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
0:00:00.554645211 2492 0xaaaadc620a80 INFO v4l2 gstv4l2object.c:3773:gst_v4l2_object_set_format_full:<v4l2src0:src> Set capture framerate to 60/1
0:00:00.554695960 2492 0xaaaadc620a80 INFO v4l2 gstv4l2object.c:3040:gst_v4l2_object_setup_pool:<v4l2src0:src> accessing buffers via mode 2
0:00:00.554897080 2492 0xaaaadc620a80 INFO v4l2bufferpool gstv4l2bufferpool.c:557:gst_v4l2_buffer_pool_set_config:<v4l2src0:pool:src> increasing minimum buffers to 2
0:00:00.554933955 2492 0xaaaadc620a80 INFO v4l2bufferpool gstv4l2bufferpool.c:570:gst_v4l2_buffer_pool_set_config:<v4l2src0:pool:src> reducing maximum buffers to 32
0:00:00.555070326 2492 0xaaaadc620a80 INFO v4l2bufferpool gstv4l2bufferpool.c:570:gst_v4l2_buffer_pool_set_config:<v4l2src0:pool:src> reducing maximum buffers to 32
0:00:00.562723652 2492 0xaaaadc620a80 WARN v4l2bufferpool gstv4l2bufferpool.c:813:gst_v4l2_buffer_pool_start:<v4l2src0:pool:src> Uncertain or not enough buffers, enabling copy threshold
0:00:00.893169357 2492 0xaaaadc620a80 INFO v4l2src gstv4l2src.c:960:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.016666666 out ts 0:00:00.057224030
0:00:00.893362602 2492 0xaaaadc620a80 INFO GST_EVENT gstevent.c:900:gst_event_new_segment: creating segment event time segment start=0:00:00.000000000, offset=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.000000000, base=0:00:00.000000000, position 0:00:00.000000000, duration 99:99:99.999999999
0:00:00.893496849 2492 0xaaaadc620a80 INFO basesrc gstbasesrc.c:2962:gst_base_src_loop:<v4l2src0> marking pending DISCONT
0:00:00.940186158 2492 0xaaaadc620a80 INFO task gsttask.c:453:gst_task_set_lock: setting stream lock 0xaaaadc618700 on task 0xaaaadc61acb0
0:00:00.940323530 2492 0xaaaadc620a80 INFO GST_PADS gstpad.c:6159:gst_pad_start_task:<v4l2jpegdec0:src> created task 0xaaaadc61acb0
0:00:00.941916119 2492 0xaaaadc620a80 INFO v4l2src gstv4l2src.c:960:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.033333332 out ts 0:00:00.377275280
0:00:00.943203339 2492 0xaaaadc620a80 INFO v4l2src gstv4l2src.c:960:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.049999998 out ts 0:00:00.393297280
0:00:00.944289190 2492 0xaaaadc620a80 INFO v4l2src gstv4l2src.c:960:gst_v4l2src_create:<v4l2src0> sync to 0:00:00.066666664 out ts 0:00:00.409296405
0:00:00.946186021 2492 0xaaaadc63fe80 INFO v4l2 gstv4l2object.c:4458:gst_v4l2_object_probe_caps:<v4l2jpegdec0:src> probed caps: video/x-raw, format=(string)NV12_10LE, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], interlace-mode=(string){ progressive, interleaved }; video/x-raw, format=(string)NV12, framerate=(fraction)[ 0/1, 2147483647/1 ], width=(int)[ 1, 32768 ], height=(int)[ 1, 32768 ], interlace-mode=(string){ progressive, interleaved }
0:00:00.946338893 2492 0xaaaadc63fe80 ERROR v4l2videodec gstv4l2videodec.c:656:gst_v4l2_video_dec_loop:<v4l2jpegdec0> not negotiated

Related

GStreamer warning: Error opening bin: syntax error in C++ but same syntax works on terminal

I am creating a video stream from my headless raspberry pi using usb camera and opencv.
Ubuntu 18.04 LTS
Raspi OS: Bullseye
USB Camera
gst syntax test on terminal:
gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert! videoscale ! video/x-raw, width=640, height=480 ! autovideosink -v
In OpenCV C++:
string pipeline;
pipeline = "v4l2src device=/dev/video0 ! videoconvert! videoscale ! video/x-raw, width=640, height=480 ! autovideosink -v";
cv::VideoCapture cap(pipeline, cv::CAP_GSTREAMER);
When I launch the pipeline from terminal it creates a window with by usb webcam feed. However when I try to use the same pipeline from c++ it throws this error:
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (734) open OpenCV | GStreamer warning: Error opening bin: syntax error
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (501) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
terminate called after throwing an instance of 'std::invalid_argument'
what(): cannot predict with an empty OpenCV image
Aborted
What am i missing in the syntax in the code?
Edit:
After some trials I could get the pipeline generated, with this:
pipeline = "v4l2src device=/dev/video0 ! videoconvert! video/x-raw, width=640, height=480 ! appsink";
and warning:
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (961) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
.
.
.
some stuff for that frame
.
.
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (509) isPipelinePlaying OpenCV | GStreamer warning: unable to query pipeline state
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (1824) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Could not read from resource.
When searched for it, I found this post. Which led to a bug report here and here.
I am using OpenCV 4.5, and I assume that bug would have been fixed by later version as it was reported for OpenCV 3.4.

How to fix gstreamer v4l2src error when streaming video over usb?

I am using this command: gst-launch-1.0 v4l2src ! xvimagesink
to stream video over usb on my nvidia jetson nano and I am getting this output:
Setting pipeline to PAUSED...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0: Could not initialise Xv output
Additional debug info:
xvimagesink.c(1773): gst_xv_image_sink_open (): /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
Could not display (null)
Setting pipeline to NULL..
Freeing pipeline...

How to send only video (mp4) to stream to kinesis-video-stream

when I am trying to send a video sample that I downloaded from the internet, which has both AAC and H-264 codecs the following command is working fine. but when I generated the mp4 file using OpenCV which has only the H-264 codec and no AAC as there was no audio it is giving me the following error.
command :
gst-launch-1.0 -v filesrc location="YourAudioVideo.mp4" ! qtdemux name=demux ! queue ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! kvssink name=sink stream-name="audio-video-file" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline demux. ! queue ! aacparse ! sink.
error log :
Additional debug info:
./grammar.y(506): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstQTDemux:demux:
failed delayed linking some pad of GstQTDemux named demux to some pad of GstQueue named queue0
WARNING: from element /GstPipeline:pipeline0/GstQTDemux:demux: Delayed linking failed.
Additional debug info:
./grammar.y(506): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstQTDemux:demux:
failed delayed linking some pad of GstQTDemux named demux to some pad of GstQueue named queue1
ERROR: from element /GstPipeline:pipeline0/GstQTDemux:demux: Internal data stream error.
Additional debug info:
qtdemux.c(5850): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstQTDemux:demux:
streaming stopped, reason not-linked (-1)
Execution ended after 0:00:00.005448416
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
You obviously remove the AAC part in your pipeline then:
gst-launch-1.0 -v filesrc location="YourAudioVideo.mp4" ! qtdemux name=demux ! queue ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! kvssink name=sink stream-name="audio-video-file" access-key="YourAccessKeyId" secret-key="YourSecretAccessKey" streaming-type=offline

MP4 file created using gstreamer doesn't be played on Window Media Player

I created mp4 file using gstreamer.
gst-launch-1.0 videotestsrc num-buffers=10 ! "video/x-raw, format=(string)NV12, width=(int)1280, height=(int)720, framerate=(fraction)30/1" ! videoconvert ! avenc_mpeg4 ! avmux_mp4 ! filesink location=/tmp/test.mp4
And i can play it using Mplayer , VLC etc.
But i can't play it on Windows Media Player.
I checked MP4 box. but it seems like it doesn't have problem.
How can i try other way?
[Mplayer]
$ mplayer test.mp4
MPlayer 1.3.0 (Debian), built with gcc-7 (C) 2000-2016 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing test.mp4.
libavformat version 57.83.100 (external)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 # 0x7fc21b56d2a0]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
[lavf] stream 0: video (mpeg4), -vid 0
VIDEO: [MP4V] 1280x720 24bpp 29.970 fps 11338.9 kbps (1384.1 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 57.107.100 (external)
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
Clip info:
major_brand: isom
minor_version: 512
compatible_brands: isomiso2mp41
creation_time: 2020-04-09T11:11:51.000000Z
encoder: Lavf57.71.100
Load subtitles in ./
Audio: no sound
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1280x720 => 1280x720 Planar YV12
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [vdpau] 1280x720 => 1280x720 Planar YV12
V: 0.3 0/ 0 ??% ??% ??,?% 0 0
Exiting... (End of file)
See https://support.microsoft.com/en-us/help/316992/file-types-supported-by-windows-media-player
MP4 Video file (.mp4, .m4v, .mp4v, .3g2, .3gp2, .3gp, .3gpp)
[..] Windows Media Player does not support the playback of the .mp4 file format. You can play back .mp4 media files in Windows Media Player when you install DirectShow-compatible MPEG-4 decoder packs [..]

Problems streaming webcam over UDP with gstreamer as MJPEG stream

First, I have read the following thread, but I want to harness the webcam hardware JPEG compression as opposed to software h264 compression.
Second, I tested the following pipeline and it works:
gst-launch-1.0 -v v4l2src device=/dev/video1 ! 'image/jpeg,width=640,height=480,videorate=8/1' ! jpegdec ! xvimagesink
Then I tried similar pipeline but with udpsink at the end:
gst-launch-1.0 -v v4l2src device=/dev/video1 ! 'image/jpeg,width=640,height=480,videorate=8/1' ! rtpjpegpay ! udpsink host=127.0.0.1 port=1234
Then I tried to play this stream:
gst-launch-1.0 -v udpsrc port=1234 ! "application/x-rtp, payload=96" ! rtpjpegdepay ! jpegdec ! xvimagesink
And it failed with the following errors:
/GstPipeline:pipeline0/GstJpegDec:jpegdec0.GstPad:sink: caps =
image/jpeg, framerate=(fraction)0/1, width=(int)640, height=(int)480
** (gst-launch-1.0:10761): CRITICAL **: gst_adapter_push: assertion 'GST_IS_BUFFER (buf)' failed
** (gst-launch-1.0:10761): CRITICAL **: gst_jpeg_dec_fill_input_buffer: assertion 'dec->current_frame_map.data
!= NULL' failed
Any suggestions?