My application uses the gstreamer C API to perform h.264 and h.265 encoding. This means we don’t use gstreamer-1.0, our C++ code includes the gstreamer library and calls gst_parse_launch to create the pipeline.
This works fine on Jetpack 4, and it works fine on Jetpack 5.1 with the h.265 encoder. However, when I try the h.264 encoder it fails to generate key frames. It generates only the first IDR frame, followed by an endless series of P frames. (I checked the NALU headers to confirm that no more IDR frames are being generated).
Our code is exactly the same on Jetpack 4 and Jetpack 5.1. This is the gstreamer pipeline:
appsrc name=vidframe ! videoconvert ! video/x-raw, width=1280, height=720, format=UYVY, framerate=15/1 ! nvvidconv ! nvv4l2h264enc insert-aud=1 insert-sps-pps=1 control-rate=1 bitrate=1800000 peak-bitrate=3600000 vbv-size=5000000 profile=4 preset_level=4 name=videnc ! h264parse ! appsink name=appsink sync=false
I tried to use the “force IDR” API to work around the problem, but no luck. I am not sure I am using “force IDR” correctly, I’m trying to use the following code:
GstStructure* structure = gst_structure_new_empty(“force-idr”);
GstEvent* event = gst_event_new_custom(GST_EVENT_CUSTOM_DOWNSTREAM, structure);
gst_element_send_event(p_impl->gstreamer_encoder_, event);