Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6704 Discussions

Check h264 encoder if next frame will be key

gennadii_mog
Beginner
276 Views

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).

Thanks,

Gennadii

0 Kudos
1 Reply
Ying_H_Intel
Employee
276 Views

This problem may be have been discussed on other thread.http://software.intel.com/en-us/forums/showthread.php?t=74180.
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)
#define ANALYSE_FRAME_TYPE 0

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,
Ying

0 Kudos
Reply