How to replace vaapih265enc with omxh265enc?

I am working on a h265 encode-decode pipeline.

gst-launch-1.0 -v v4l2src device=/dev/video0 ! 'video/x-raw,format=(string)YV12,width=1280,height=720,
framerate=(fraction)30/1' ! vaapih265enc max-bframes=0 keyframe-period=30 ! appsink // 1st app, encoding

appsrc ! vaapidecode ! xvimagesink // 2nd app, decoding

Combination of above 2 pipelines works well. Needless to say that, above 2 pipelines are in separate applications connected through ROS.

Problem: I want to use Jetson for the 1st(encoder) pipeline. So I replace ‘vaapih265enc max-bframes=0 keyframe-period=30’ with ‘omxh265enc iframeinterval=30 quant-b-frames=0’. After this replacement I had to add ‘h265parse’ in 2nd decoder pipeline inorder to make application works. I don’t want to add ‘h265parse’ element because it results an extra latency of ~40ms in decoding.

How can I efficiently replace ‘vaapih265enc max-bframes=0 keyframe-period=30’ with ‘omxh265enc’?

Additional info: I am forcing ‘omxh265enc’ to output byte-stream instead of hvc1, because vaapih265enc outputs byte-stream by-default. So appsink of omxh265enc is having caps

caps = gst_caps_new_simple("video/x-h265",
                           "stream-format", G_TYPE_STRING, "byte-stream",
                           "alignment", G_TYPE_STRING, "au",

We would like to suggest you output in stream-format=byte-stream, in both omxh265enc and nvv4l2h265enc. In our SQA tests, we use h265parse plugin. It would be more stable in constructing the pipeline with h265parse.

Hi I asked the same question on gstreamer portal.

There @junyan.he presented his opinion. He suspects that frame alignment causes this problem. ‘vaapih265enc’ outputs just one complete frame in one gstbuffer. So, one gstbuffer is already frame aligned. He suspects that ‘omxh265enc’ may mix data from several frames together, with AU as delimiter. So one gstbuffer may not be frame aligned.

What I understood: omxh265enc may output gst-buffer which contains some data belong to one frame and some data belong to next frame.

If you think this is the issue, Can you suggest any property of ‘omxh265enc’ which can force it to produce frame align data?

In Gstreamer portal, Nicolas Dufresne (who is an active user of portal) suggests to modify omx source file. So that ‘omxh265enc’ would send only frame align data. (frame align data is recommended to avoid using h265parse, because h265parse results latency of one frame).

I downloaded gstomx1_src for my L4T version. It is getting build also. So building is not a problem.

Can you help me what I can modify in gstomx1 to make omxh265enc output frame aligned?

Continue in