My pipeline with 'nvv4l2vp9enc ! appsink ' could not recognize key frame

My pipeline ends with 'nvv4l2vp9enc ! appsink ’ .
In my code, I retrieve encoded data like following snippet:

g_signal_emit_by_name(sink, "pull-sample", &app_sample);
if (app_sample) {
    app_buffer = gst_sample_get_buffer(app_sample);
    if (gst_buffer_map(app_buffer, app_map, GST_MAP_READ)) {

But when I check the flag ‘GST_BUFFER_FLAG_IS_SET(app_buffer, GST_BUFFER_FLAG_DELTA_UNIT)’, it is always set.
Well, I printed the first 2 bytes of 1st frame:
app_map->data[0] = 0x83, app_map->data[1] = 0x49

Apparently it is key frame per VP9 spec.
So is this a bug in nvv4l2vp9enc code?
I also tried other encoders like nvv4l2h264enc, nvv4l2h265enc, omxvp9enc.
All of them worked fine.

Do you use r32.5 or latest r32.6? Please share your release version:

$ cat /etc/nv_tegra_release

Hi Dane,

Result as follow:

R32 (release), REVISION: 5.1, GCID: 26202423, BOARD: t186ref, EABI: aarch64, DATE: Fri Feb 19 16:50:29 UTC 2021

Could you please share more information about the flag? It is not clear why GST_BUFFER_FLAG_DELTA_UNIT has to be set for keyframes. Please shed some light.

Hi Dane,

Unfortunately I am not expert on GStreamer.
In my APP, it will push video stream through network and I need to mark if one encoded frame is keyframe.
I can retrieve the keyframe info from the GST_BUFFER_FLAG_DELTA_UNIT flag as shown in my 1st post. ( It will be a keyframe if this bit flag is NOT set).
But this method seems working for all encoder plugins except nvv4l2vp9enc.
So I want to know if this is some issue from implementation of nvv4l2vp9enc.

Please refer to source code of vp9parse:
gst/videoparsers/gstvp9parse.c · master · GStreamer / gst-plugins-bad · GitLab

It calls GST_BUFFER_FLAG_UNSET for key frames. So the logic might be different from other codecs.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.