Venus encoder I-frame periodicity


I cannot change IDR/I-frame periodicity through extra-controls parameters (gop and i_frame_period).


I’ve been checking the upstream venus driver and looks more up-to-date than the one available in landing-teams (linaro git). But I couldn’t find any fix for this.



The issue is about getting key_frames with V4L2 controls: _GOP_SIZE and _I_FRAME_PERIOD

  • encoder pipeline snippet:
v4l2h264enc \
extra-controls="controls,h264_profile=4,video_bitrate_mode=0,video_peak_bitrate=25000000,h264_i_frame_period=3,h264_i_frame_period=3,video_gop_size=3;" ! \

Is the pipeline correct? Why I’m only getting the first key_frame as I-frame while I’m setting i_frame_period to 3? Not sure if I’m missing an extra control or need a fix for it.

AFAIK, there is no v4l2 control to set IDR periodicity, gop and I are both used to configure I-frame interval, the venus driver use only gop interval to calculate B/P/I intervals. The venus encoder is statically configured to generate only one IDR frame (the first one):

/* IDR periodicity, n:
 * n = 0 - only the first I-frame is IDR frame
 * n = 1 - all I-frames will be IDR frames
 * n > 1 - every n-th I-frame will be IDR frame
idrp.idr_period = 0;
ret = hfi_session_set_property(inst, ptype, &idrp);
if (ret)
	return ret;

So you can change n to something else and even create the missing v4l2 control…

Thanks for your replay @Loic,

I’ve been testing the driver with idrp.idr_period = N (N>=1) which makes an IDR period of N and I-frame interval is then controlled by video_gop_size.

But according to the linuxtv documentation this value V4L2_CID_MPEG_VIDEO_H264_I_PERIOD stands for the ‘period between I-frames in the open GOP for H264’. Which in our case is controlled by video_gop_size. In addition, the description says: The period between IDR (Instantaneous Decoding Refresh) frames is taken from the GOP_SIZE control which in our case is controlled statically with idrp.idr_period.

My assumption then, is that the driver needs to be modified to be able to control IDR period through this V4L2 ID control: V4L2_CID_MPEG_VIDEO_GOP_SIZE (video_gop_size) and it also needs to control I-frame period through V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (h264_i_frame_period).

If that is correct, I’d glad to help with the code/testing or whatever is needed to do.

You’re correct, a patch is needed, I 'll let you know once I have something to test.

1 Like