Hi,
I am using H.264 codec to encode video on DM368. I want constant bit rate of 512K maximum.
The performance is okay with the still image but it degrades with the moving picture. There are blocks (pixalization) in the video stream.
At 2M bit rate the performance is good. But I want a better picture quality at 512K.
I have attached captured video in this post.
How can I improve image quality without increasing the bit rate??
I am using dvsdk_4_02_00_06.
here are the parameters i have set currently,
encodingPreset = XDM_HIGH_SPEED
rateControlPreset = IVIDEO_LOW_DELAY;// constant bit rate videncParams.maxWidth = 640;videncParams.maxHeight = 480;videncParams.maxFrameRate = 30000;videncParams.maxBitRate = 512K;videncParams.dataEndianness = XDM_BYTE;videncParams.maxInterFrameInterval = 1; //As per TI h264 enc documentvidencParams.inputChromaFormat = XDM_YUV_420SP;videncParams.inputContentType = IVIDEO_PROGRESSIVE;videncParams.reconChromaFormat = XDM_YUV_420SP;profileIdc = 66;levelIdc = IH264VENC_LEVEL_30;entropyMode = 0; //For base profile CAVLC should only be usedmeAlgo = 1;enableVUIparams = 0;transform8x8FlagIntraFrame = 0;transform8x8FlagInterFrame = 0;seqScalingFlag = 0;encQuality = XDM_HIGH_SPEEDenableARM926Tcm = 0;
Dynamic paraeters----
videncDynamicParams.inputWidth = 640videncDynamicParams.inputHeight = 480videncDynamicParams.targetBitRate = 512KvidencDynamicParams.intraFrameInterval = 30;videncDynamicParams.generateHeader = XDM_ENCODE_AU;videncDynamicParams.captureWidth = 0;videncDynamicParams.interFrameInterval = 0;
videncDynamicParams.targetFrameRate = 30000;videncDynamicParams.refFrameRate = 30000;
I am sending an "I frame" after every 30 'P frames'.
Hi Rohan,
If speed is not an issue for you, please use encodingPreset = USER_DEFINED and encQuality=1. You can also choose different rate control mode depending upon your sequence.
please have a look at different rate control algos avaialbe at http://processors.wiki.ti.com/index.php/DM36x_Rate_Control_Modes
Hope you are using latest encoder(02.30.00.04) if not please get it from http://software-dl.ti.com/dsps/dsps_public_sw/codecs/DM36x/index_FDS.html
Thanks,
Veeranna
Rohan,
Apart from what Veeranna has suggested, can you also use high profile encoder instead of baseline profile. With high profile, you can use tools like CABAC (entropyMode), transform8X8 and sequence scaling flag which improves the quality.
Hi
Thanks for the quick reply.
I changed the encoder version to "dm365_h264enc_02_30_00_03_production"
Here are some changes which I made in the parameters,
encodingPreset = XDM_USER_DEFINEDrateControlPreset = IVIDEO_USER_DEFINED
encQuality = 0 // To enable perpetualRC ----- please comment on this----- how encQuality makes difference ??
Also modified some extended dynamic parameters
rcAlgo = 1;maxDelay = 5000;initQ = -1;rcQMaxI = 36;
The picture quality is increased but still there is some pixalization and picture sharpness is not as good as I would like.
Are these parameter settings proper?
Here is the latest encoded video.
What else can be done to improve the picture clarity??
Rohan
Hi Adithya,
Thanks for the quick reply
I have to use baseline profile as this is a video phone application. So I cant use high profile and the other parameters which you mentioned.
I have made some changes in the parameters. Please check the above post.
Anything else I should look into??
Thanks for help,
Please set encQuality =1 and minQp = 8, maxQp = 42. You can also try different rcAlgos which suits your input sequence.
And encQuality is the parameter which controls Encoder mode. It will have control over Quality and speed performance numbers.
I have tried changing these parameters and few other parameters. But there is no apparent change in video quality. I am only concerned about the pixel blocks in the image and picture clarity when there is motion. Can you give me overall back ground of how to remove pixalization at lower bit rates.??
I have another video phone product based on DM 6446. In this, encoder is dropping frames in case of a complex image keeping the bit rate constant. And the pixalization is negligible. But this is not happening in case of DM 368. Can we obtain this kind of behavior in DM368 based?? How??
As you are using rcalgo = 1, frameskip will not happen. Can you please try by using rcalgo = 5 or rcalgo = 0 and try by changing LBRmaxpicsize to higher values.
Are you able to get desired Quality?
Hi veeranna,
I'm also facing issues in tuning in encoder for low bit rates like 512kbps (vga resolution). I tried to tune the parameters based on the above i/ps. I changed the encoder_frame_rate, dynamic target and reference frame rate to 15000 i,,e 15pfs frame variable frame rate hoping that the no of bits required per frame would be increased and thus can achieve better quality at constant bit rate rate. But to my observation, the encoding bit rate got doubled i,,e if bit rate is configured to 412 kbps then the o/p from encoder is between 800 - 830 kbps i,,e got doubled. the o/p bit rate is constant. if i reconfigure the frame rate to 30000 then the o./p bit rate from encoder is between 400 - 430 kbps.
I tried by configuring the rcAlgo to 0 and 5. The results are same for both these configurations. Why is it happening ? I was expecting that encoder would take care of skipping the frames and would generate more bits per frame in complex video (like movement of hand ). The quality of video is very bad when there is hand movement in front of camera. How to improve the quality in this scenario keeping the bit rate constant ? Does DM 368 encoder take care of frame skipping or the application should take care ?
regards
pradeep