NX gstreamer h265 encoding fails after 100 odd encoding

Hi,

We have requirement to encode 3 video streams of size 1472x540 via gstreamer.

System details:
** R32.4.3**
** Kernel version 4.9.140-tegra**

We use c program to perform the operation
Pipeline looks as follows

gst_parse_launch_full: parsing pipeline description 'appsrc name=appsrc_cam0_full ! rawvideoparse use-sink-caps=false width=1472 height=540 format=gray16-le ! videoconvert ! video/x-raw,format=I420 ! timeoverlay ! omxh265enc ! h265parse ! queue ! matroskamux ! filesink location=trt_xtend_00.mkv sync=false async=false appsrc name=appsrc_cam1_full ! rawvideoparse use-sink-caps=false width=1472 height=540 format=gray16-le ! videoconvert ! video/x-raw,format=I420 ! timeoverlay ! omxh265enc ! h265parse ! queue ! matroskamux ! filesink location=trt_xtend_01.mkv sync=false async=false appsrc name=appsrc_cam2_full ! rawvideoparse use-sink-caps=false width=1472 height=540 format=gray16-le ! videoconvert ! video/x-raw,format=I420 ! timeoverlay ! omxh265enc ! h265parse ! queue ! matroskamux ! filesink location=trt_xtend_02.mkv sync=false async=false

After continuosly running 140 odd shots, C application crashes with the following errors. Please find the extented log here encode-crash-gstreamer.txt (1.5 MB)

NvMMLiteVideoEncDoWork:NvMSEncConvertSurfaceFormat failed
VENC: NvMMLiteVideoEncDoWork: 4283: BlockSide error 0x4
Event_BlockError from 459BlockHevcEnc : Error code - 4
Sending error event from 459BlockHevcEnc0:29:07.104717364 20114 0x7f00eacc40 ERROR omx gstomx.c:496:EventHandler: encoder got error: Bad parameter (0x80001005)
0:29:07.104820790 20114 0x7ee0401630 ERROR omx gstomx.c:268:gst_omx_component_handle_messages: encoder got error: Bad parameter (0x80001005)
0:29:07.104858998 20114 0x7ee0401630 ERROR omx gstomx.c:1285:gst_omx_port_acquire_buffer: Component encoder is in error state: Bad parameter
0:29:07.104883351 20114 0x7ee0401630 WARN omxvideoenc gstomxvideoenc.c:1331:gst_omx_video_enc_loop: error: OpenMAX component in error state Bad parameter (0x80001005)
0:29:07.104932887 20114 0x7ee0401630 INFO GST_ERROR_SYSTEM gstelement.c:2145:gst_element_message_full_with_details: posting message: GStreamer encountered a general supporting library error.
0:29:07.105194267 20114 0x7ee0401630 INFO GST_ERROR_SYSTEM gstelement.c:2172:gst_element_message_full_with_details: posted error message: GStreamer encountered a general supporting library error.
0:29:07.105496543 20114 0x7ee0401630 INFO task gsttask.c:316:gst_task_func:omxh265enc-omxh265enc460:src Task going to paused
0:29:07.105625601 20114 0x7f102108f0 INFO ebmlwrite ebml-write.c:523:gst_ebml_write_seek: scheduling seek to 527
0:29:07.105650625 20114 0x7f102108f0 INFO ebmlwrite ebml-write.c:216:gst_ebml_writer_send_segment_event: seeking to 527
0:29:07.105705826 20114 0x7f102108f0 INFO GST_EVENT gstevent.c:895:gst_event_new_segment: creating segment event bytes segment start=527, offset=0, stop=-1, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0, base=0, position 0, duration -1
0:29:07.105987750 20114 0x7f102108f0 INFO ebmlwrite ebml-write.c:523:gst_ebml_write_seek: scheduling seek to 3865
0:29:07.106070535 20114 0x7f102108f0 INFO ebmlwrite ebml-write.c:216:gst_ebml_writer_send_segment_event: seeking to 3865
0:29:07.106111528 20114 0x7f102108f0 INFO GST_EVENT gstevent.c:895:gst_event_new_segment: creating segment event bytes segment start=3865, offset=0, stop=-1, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0, base=0, position 0, duration -1

** (turtle_sa:20114): ERROR **: 17:12:08.886: received error
0:29:07.106213961 20114 0x7f102108f0 INFO ebmlwrite ebml-write.c:523:gst_ebml_write_seek: scheduling seek to 76
0:29:07.106304107 20114 0x7f102108f0 INFO ebmlwrite ebml-write.c:216:gst_ebml_writer_send_segment_event: seeking to 76
0:29:07.106351403 20114 0x7f102108f0 INFO GST_EVENT gstevent.c:895:gst_event_new_segment: creating segment event bytes segment start=76, offset=0, stop=-1, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0, base=0, position 0, duration -1
Trace/breakpoint trap (core dumped)

I had tried using nvv4l2h265enc and still leading to crash.

Kindly provide support to fix the issue.

Thanks

Hi,
Are you able to try latest r32.5.1(Jetpack 4.5.1)? See if it happens on latest release.

Hi,
Is it possible to update the encode dependencies in the R32.4.3 to the latest? Listing the step to do so would be helpful?

Thanks

Hi,
The source code of nvv4l2h265enc plugin is public. It is gst-v4l2 in
https://developer.nvidia.com/embedded/l4t/r32_release_v5.1/r32_release_v5.1/sources/t186/public_sources.tbz2

You may try to build gst-v4l2 of r32.5.1 and replace libgstnvvideo4linux2.so to r32.4.3. Check if it helps this case.
Since the version mismatches, please store the original lib as backup.