<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 12 juin 2020 11 h 27, Xishan Sun <<a href="mailto:sunxishan@gmail.com">sunxishan@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am trying to link libcamerasrc with v4l2h264enc to use hardware encoder on Raspberry Pi. <div><br></div><div>1) if I directly feed into v4l2h264enc with something like: </div><div><br></div><div>gst-launch-1.0 libcamerasrc ! video/x-raw,width=1600,height=1200 ! v4l2h264enc ! h264parse ! rtph264pay name=pay0 pt=96 ! fakesink</div><div><br></div><div>gstreamer will complain that format cannot be transformed. debug info: </div><div><br></div><div>...</div><div>0:00:00.671398274 22045  0x12d5400 WARN           basetransform gstbasetransform.c:1355:gst_base_transform_setcaps:<capsfilter0> transform could not transform video/x-raw, format=(string)NV21, width=(int)1600, height=(int)1200 in anything we support<br>0:00:00.671467254 22045  0x12d5400 WARN            libcamerasrc gstlibcamerasrc.cpp:321:gst_libcamera_src_task_run:<libcamerasrc0> error: Internal data stream error.<br>0:00:00.671491235 22045  0x12d5400 WARN            libcamerasrc gstlibcamerasrc.cpp:321:gst_libcamera_src_task_run:<libcamerasrc0> error: streaming stopped, reason not-negotiated (-4)<br><div>...</div><div><br></div><div>it is strange that </div><div>gst-inspect-1.0 v4l2h264enc </div><div>shows me that 

v4l2h264enc accepts NV21 or NV12 format:</div><div><br></div><div>...</div>Pad Templates:<br>  SINK template: 'sink'<br>    Availability: Always<br>    Capabilities:<br>      video/x-raw<br>                 format: { (string)I420, (string)YV12, (string)NV12, (string)NV21, (string)RGB16, (string)RGB, (string)BGR, (string)BGRx, (string)BGRA, (string)YUY2, (string)YVYU, (string)UYVY }<br>                  width: [ 1, 32768 ]<br>                 height: [ 1, 32768 ]<br>              framerate: [ 0/1, 2147483647/1 ]<br><div>...<br></div><div><br></div><div> 2) if I add videoconvert into pipeline as: </div><div>  gst-launch-1.0 libcamerasrc ! video/x-raw,width=1600,height=1200 ! videoconvert ! v4l2h264enc ! h264parse ! rtph264pay name=pay0 pt=96 ! fakesink<br></div><div>then everything works just fine at the beginning. However after I insert the pipeline into a RTSP server with long term run (about 4-5 hours)  I see Segmentation fault like: </div><div>...</div><div>Thread 13 "pool" received signal SIGSEGV, Segmentation fault.<br>[Switching to Thread 0xb4ce23a0 (LWP 6879)]<br>std::_Rb_tree<libcamera::Stream*, std::pair<libcamera::Stream* const, libcamera::FrameBuffer*>, std::_Select1st<std::pair<libcamera::Stream* const, libcamera::FrameBuffer*> >, std::less<libcamera::Stream*>, std::allocator<std::pair<libcamera::Stream* const, libcamera::FrameBuffer*> > >::_M_lower_bound (this=0xb4316690, __x=0x517060b, __y=0xb4316694, __k=@0xb4ce1728: 0xb4319060) at /usr/include/c++/8/bits/stl_tree.h:1904<br>1904          if (!_M_impl._M_key_compare(_S_key(__x), __k))<br></div><div>...</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">This shouldn't happen, does the ... means the backtrace is truncated? If so can you port the complete backtrace?</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><br></div><div>Question: </div><div>1) Can we have libcamerasrc output direct to 

v4l2h264enc without videoconvert? If we can define "output-io-mode" of libcamerasrc into "dmabuf", it would be even better. </div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">output-io-mode=dmabuf-import enables the experimental buffer importation. This support was very weak in 1.14, and 1.16, and should be safe starting from upcoming 1.18. Though V4L API lacks important features to make this work reliably in all situations.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>2) is that with videoconvert the best solution right now? I tried v4l2convert and it didn't work. I think libcamerasrc is already using the device. </div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">v4l2convert works fine for me on Exynos and i.MX6. Which SoC are you running on ? How does it not work for you ? How are you using it ?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><br></div><div>Thanks,</div><div><br></div>-- <br><div dir="ltr" data-smartmail="gmail_signature">Xishan Sun</div></div></div>
_______________________________________________<br>
libcamera-devel mailing list<br>
<a href="mailto:libcamera-devel@lists.libcamera.org" target="_blank" rel="noreferrer">libcamera-devel@lists.libcamera.org</a><br>
<a href="https://lists.libcamera.org/listinfo/libcamera-devel" rel="noreferrer noreferrer" target="_blank">https://lists.libcamera.org/listinfo/libcamera-devel</a><br>
</blockquote></div></div></div>