Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6628 Discussions

Check h264 encoder if next frame will be key


Hello everyone,

Can anybody tell me how I can determine in h264 encoder if next encoded frame will be key-frame?

I want to create 2 encoders for encoding one stream: to encode one sequence of frames before key frame on first encoder and other sequence - on second encoder (change encoder for each next sequence of frames).



0 Kudos
1 Reply

This problem may be have been discussed on other thread.
Add some information in case ofyou are looking formore option,

There isone encoder parameter which can control this. For example, every 20 frame there is 1 key frame.
/* CommentLine: H.264 Sequence.*/
C://stream352x288.yuv /* name of source files */
450 /* number of frames to encode */
1 20 1 /* 1(reserved) , N ( # of frames in between I frames), IDR interval. */
3 1 /* Number of B frames between I (or P) and next P, treat B as a reference (only 0 is supported!) */
4 1 0 /* num_ref_frames (2-16), minimum length of list1 for backward prediction (only 1 is supported!), number of slices. */

But it may be possible to produce irreguliar frame as there is frame type detectionfunction worksin the encoder.It can change P frame to I and B frame to P or I.

It can be switching off in source code by clearing ANALYSE_FRAME_TYPE bit in encoder's class's field m_Analyse.

To change the line 40 in umc_h264_core_enc.h
//#define ANALYSE_FRAME_TYPE (1 << 14)

and line 339 in umc_h264_video_encoder.cpp

key_frame_controls.interval = 20; // for safety

Then try umc_video_enc_con.exe
>h264 -w 352 -h 288 -i c://stream352x288.yuv -o a.h264.
The key framewill keep reguliar, 0, 20, 40, ..100, 440.

In addition, please try the latest ipp and ipp sample version as possible, for example IPP 7.0 beta and conterpart sample. See IPP Downloads, Registration and Licensing

Best Regards,