omxh264enc does not work with gstreamer sometimes - stuck at "waiting in preroll for flush or PLAYING"

I am working on L4T R21.5 and have the following pipeline:

appsrc name=videoSrc format=3 stream-type=0 ! video/x-raw, format=(string)UYVY, width=1920, height=1080 ! timeoverlay halignment=0 valignment=2 shaded-background=true draw-shadow=false font-desc="Sans,10" outline-color=0 color=0x80ffffff line-alignment=0  ! tee name=t ! queue ! videorate name=videorate0 ! video/x-raw, framerate=30/1 !nvvidconv name=videoConvert0 ! video/x-raw(memory:NVMM), format=I420 ! omxh264enc name=h264enc0  ! video/x-h264, stream-format=byte-stream ! appsink name=appsink0 t. ! queue ! videorate name=videorate1 ! video/x-raw, framerate=30/1 ! nvvidconv name=videoConvert1 ! video/x-raw(memory:NVMM), width=1920, height=1080 ! omxh264enc name=h264enc1  ! video/x-h264, stream-format=byte-stream ! appsink name=appsink1

It works fine most of the times, but sometimes it stuck at this point, when starting the pipeline:

basesink gstbasesink.c:2265:gst_base_sink_wait_preroll:<appsink1>^[[00m waiting in preroll for flush or PLAYING

As I already discussed with gstreamer forum (for a similar pipeline) it seems that the “stream-start” does not pass the omxh264enc element for encoder1, while it goes through for encoder0. Here are the logs:

<b>ag "h264enc1\:sink" mylog129.txt | ag "stream-start"</b>
566:0:04:26.583584475 27320 0xa2105260 LOG                 GST_PADS gstpad.c:5262:gst_pad_push_event_unchecked:<capsfilter89:src> sending event 0x9aed1030 (stream-start) to peerpad <h264enc1:sink>
567:0:04:26.583632475 27320 0xa2105260 DEBUG              GST_EVENT gstpad.c:5549:gst_pad_send_event_unchecked:<h264enc1:sink> have event type stream-start event: 0x9aed1030, time 99:99:99.999999999, seq-num 3535, GstEventStreamStart, stream-id=(string)e7467e07c553ad630bd597173f204664, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)12;
585:0:04:26.583864138 27320 0xa2105260 LOG                 GST_PADS gstpad.c:5098:store_sticky_event:<h264enc1:sink> stored sticky event stream-start
589:0:04:26.583900471 27320 0xa2105260 LOG                 GST_PADS gstpad.c:5270:gst_pad_push_event_unchecked:<capsfilter89:src> sent event 0x9aed1030 (stream-start) to peerpad <h264enc1:sink>, ret ok

<b>ag "h264enc1\:src" mylog129.txt | ag "stream-start</b>
Nothing!

<b>ag "h264enc1\:src" mylog129.txt | ag "stream-start"</b>
11597:0:04:29.747660066 27320 0x9aed06f0 LOG                 GST_PADS gstpad.c:5098:store_sticky_event:<h264enc1:src> stored sticky event stream-start
11602:0:04:29.747738482 27320 0x9aed06f0 LOG                 GST_PADS gstpad.c:5262:gst_pad_push_event_unchecked:<h264enc1:src> sending event 0x9aed1030 (stream-start) to peerpad <capsfilter90:sink>
11678:0:04:29.749068632 27320 0x9aed06f0 LOG                 GST_PADS gstpad.c:5270:gst_pad_push_event_unchecked:<h264enc1:src> sent event 0x9aed1030 (stream-start) to peerpad <capsfilter90:sink>, ret ok
11680:0:04:29.749114798 27320 0x9aed06f0 DEBUG               GST_PADS gstpad.c:3815:push_sticky:<h264enc1:src> event stream-start marked received
11699:0:04:29.749438960 27320 0x9aed06f0 DEBUG               GST_PADS gstpad.c:3795:push_sticky:<h264enc1:src> event stream-start was already received
11944:0:04:29.754138735 27320 0x9aed06f0 DEBUG               GST_PADS gstpad.c:3795:push_sticky:<h264enc1:src> event stream-start was already received

<b>ag "h264enc0\:sink" mylog129.txt | ag "stream-start"</b>
331:0:04:26.579018949 27320 0x9b806120 LOG                 GST_PADS gstpad.c:5262:gst_pad_push_event_unchecked:<capsfilter86:src> sending event 0x9aed1030 (stream-start) to peerpad <h264enc0:sink>
333:0:04:26.579043699 27320 0x9b806120 DEBUG              GST_EVENT gstpad.c:5549:gst_pad_send_event_unchecked:<h264enc0:sink> have event type stream-start event: 0x9aed1030, time 99:99:99.999999999, seq-num 3535, GstEventStreamStart, stream-id=(string)e7467e07c553ad630bd597173f204664, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)12;
348:0:04:26.579300696 27320 0x9b806120 LOG                 GST_PADS gstpad.c:5098:store_sticky_event:<h264enc0:sink> stored sticky event stream-start
352:0:04:26.579338778 27320 0x9b806120 LOG                 GST_PADS gstpad.c:5270:gst_pad_push_event_unchecked:<capsfilter86:src> sent event 0x9aed1030 (stream-start) to peerpad <h264enc0:sink>, ret ok

Would you please let me know if there is any possible fix for this?
Thanks in advance

Since we don’t have your appsrc, is it possible to reproduce the issue with videotestsrc?

Hi MS_Istuary,

Have you clarified the cause and resolved? Or this is still an issue to support?

Thanks

it is still an issue, I could create a pipeline that does not need the appsrc but I can not reproduce the error.
In other words, reproducing the error at your side is not possible, I think. Please let me know if providing more logs or making some changes on the pipeline structure helps to marginalize the problem.
Thanks,

Here is the pipeline:

gst-launch-1.0 videotestsrc ! video/x-raw, format="(string)UYVY", width=1920, height=1080 ! tee name=t ! queue ! videorate name=videorate0 ! video/x-raw, framerate=30/1 ! nvvidconv name=videoConvert0 ! “video/x-raw(memory:NVMM)”, format=I420 ! omxh264enc name=h264enc0 ! video/x-h264, stream-format=byte-stream ! filesink location=“test0.h264” t. ! queue ! videorate name=videorate1 ! video/x-raw, framerate=30/1 ! nvvidconv name=videoConvert1 ! “video/x-raw(memory:NVMM)”, width=1920, height=1080 ! omxh264enc name=h264enc1 ! video/x-h264, stream-format=byte-stream ! filesink location=“test.h264”

Please set

export GST_DEBUG=*:4

And check if anything suspicious in the log.