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

Questions regarding UMC H264 Encoder

yanqin
Beginner
289 Views
Hi,

I have2 question thatwould like to know about UMC H264encoder

1.Does H.264 encoder actually produces I frame everytime if i re-initialize my H.264 encoder everytime i want to encode a frame?

2. Is it due to my parameter setting for H264Encoder (initialize once) that i get video frame that isslightly jerky?

Apparently, if i re-initialize my H264Encoder everytime i want to encodes a frame give me a smoother video. And even ifi set every frame to I-frame (i.e. key_frame_control.inteval =1) forencoder that i initialize only once,it is not as smooth.any reason for that?

Thanks and regards,
YanQin
0 Kudos
5 Replies
Chao_Y_Intel
Moderator
289 Views


YanQin,

See some comment from the expert:


Reset shouldnt be used to force I frames. Reset means new stream so the encoder state counters, timing etc are reinitialized. If B frames are used then some frames are buffered and they can be lost in Reset. To prevent it GetFrame(NULL,out) has to called before.

For Jerkiness, you can check if this because you missed some B frame when you call Reset. Also, Jerkiness can also depend on player.

There is no direct way to enforce I frames. Users can try to modify the code oneself around FrameTypeDetect function.

Regards,
Chao

0 Kudos
shyaki
Beginner
289 Views
Quoting - Chao Y (Intel)


YanQin,

See some comment from the expert:


Reset shouldnt be used to force I frames. Reset means new stream so the encoder state counters, timing etc are reinitialized. If B frames are used then some frames are buffered and they can be lost in Reset. To prevent it GetFrame(NULL,out) has to called before.

For Jerkiness, you can check if this because you missed some B frame when you call Reset. Also, Jerkiness can also depend on player.

There is no direct way to enforce I frames. Users can try to modify the code oneself around FrameTypeDetect function.

Regards,
Chao

you can enforce IDR frames like this:

101 /* 1(reserved) , N (# of frames in between I frames), IDR interval. */
0 0 /* Number of B frames between I (or P) and next P, treat B as a reference (only 0 is
0 Kudos
yanqin
Beginner
289 Views
Quoting - Chao Y (Intel)


YanQin,

See some comment from the expert:


Reset shouldnt be used to force I frames. Reset means new stream so the encoder state counters, timing etc are reinitialized. If B frames are used then some frames are buffered and they can be lost in Reset. To prevent it GetFrame(NULL,out) has to called before.

For Jerkiness, you can check if this because you missed some B frame when you call Reset. Also, Jerkiness can also depend on player.

There is no direct way to enforce I frames. Users can try to modify the code oneself around FrameTypeDetect function.

Regards,
Chao


Hi Chao,

Sorry.. I do not really understand what you mean. I'm doing a real-time video streaming application where I grab individual frame for encoding and decoding.

My current system flow is like this:

1) I initialized my encoder and decoder once in my application withthe following parameter settings:

//====Encoding Parameters====

Params.profile_idc= UMC::H264_MAIN_PROFILE ;
Params.key_frame_controls.method=1;
Params.key_frame_controls.interval = 2;
Params.key_frame_controls.idr_interval = 2;

Params.B_frame_rate = 0;
Params.treat_B_as_reference = 0;
Params.num_ref_frames = 2;
Params.num_slices = 1;

Params.entropy_coding_mode = 0; //CAVLC
Params.bit_depth_luma = 8;
Params.bit_depth_chroma = 8;
Params.m_QualitySpeed = 1;

Params.info.clip_info.height=imgHeight;
Params.info.clip_info.width=imgWidth;
Params.info.bitrate = 1000000;
Params.info.framerate = 10;


//====Decoding Parameters====

Params.m_pData = &dataIn;
Params.lFlags=0;
Params.dPlaybackRate = 10;

2)The video application grab video frame at 10 fps and once i got hold of the frame, I encode it and stream it to my client application to decode.


I've check that the sending and receiving has no problem.Even though I'm encoding and decoding at 10fps, the motion of the video still look awkard and unnatural. Could it be my parameter setting for it? And if not, may I have some guidanceon what shouldI do to get a smoothvideo streaming.

Thanks and regards,
YanQin
0 Kudos
Chao_Y_Intel
Moderator
289 Views
YanQin,

It looks that you want to improve the encoded video quality.

In the encoding quality setting:
Params.m_QualitySpeed = 1;
You can change it to 3 (maximum quality).

Also, number of B frames, num_ref_frames, subblock split, Cabac setting also impact the video quality. Check this article,
http://software.intel.com/en-us/articles/setting-h264-encoding-parameters-in-intel-ipp-media-processing-samples/

see if the sample par file for quality can help.


Thanks,
Chao

0 Kudos
shyaki
Beginner
289 Views
Quoting - Chao Y (Intel)
YanQin,

It looks that you want to improve the encoded video quality.

In the encoding quality setting:
Params.m_QualitySpeed = 1;
You can change it to 3 (maximum quality).

Also, number of B frames, num_ref_frames, subblock split, Cabac setting also impact the video quality. Check this article,
http://software.intel.com/en-us/articles/setting-h264-encoding-parameters-in-intel-ipp-media-processing-samples/

see if the sample par file for quality can help.


Thanks,
Chao


I think the number of slices should be set to be equal to the number of processors in the system.

Another suggestion,

you need to make sure the playback of your grabbed frames without compression is good at first.

Then you can capture the source with timecode and decode them to see if you have missing frames.
0 Kudos
Reply