New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Received green layer overlaps the video frame when running Android device. #1163
Comments
I also get into this problem. Please help us to confirm the issue soon.
|
For decoder, do you use DecodeFrame or DecodeFrame2? I suggest use the second one. The console file has an example of that. |
Thank you for your answer.
I will let you know the additional investigation result and hope to get your active support for this issue. |
Hi Hulii2,
Could you mind to confirm the issue and give us hint how to correct it. Your suggestion is highly appreciated. Regards, |
From what I can consider, the green or grey issue is caused by packet loss, especially for IDR picture, and decoder will insert green or grey (old/new version) for future reference. So I would suggest you check if IDR picture has some data lost. |
Your comment is actually very exactly. My bad. After your comment, I look again the IDR frame, and saw my mistake. The encoded picture data is sent together PPS and SPS in IDR frame, so just send it as whole frame is correct. |
@luuanhtu Hi, I'm seeing a similar issue on my end. Can you clarify what you did to get the green flash to resolve. Can you please include a code sample on how you saved off the PPS and SPS together with the IDR frame? |
When i running encode and decode in Android device, I received green layer overlaps the video frame. Such as image bellow.
When I shake the device, the image clarity is shown.
In my encode function:
I get NV21 data from android camera after that i convert it to yuv420 and encode it by openh264 EncodeFrame function.
In my decode function:
I use openh264 DecodeFrame function after that i convert yuv420 output data to RGBA format.
I tried it in IOS else encountered a problem so on but color is gray color instead green color. And I tried it in Windows OS else works well.
I don't know where my wrong. Please help me, thank so much.
This is my parametes settings for encode function:
ISVCEncoder* pSVCEncoder; // OpenH264 encoder instance
tUint32 uWidth = 640;
tUint32 uHeight = 480;
UINT uBitrate = 1000000;
UINT uFramerate = 15.0f;
SSourcePicture SrcPic;
UCHAR pcEncInputFrameBuffer[(uWidth * uHeight * 3)/2]; // For Android NV21 to YUV420 conversion
WelsCreateSVCEncoder(&pSVCEncoder);
SEncParamExt encodingParam;
memset(&encodingParam, 0, sizeof(SEncParamExt));
pSVCEncoder->GetDefaultParams(&encodingParam);
encodingParam.iUsageType = CAMERA_VIDEO_REAL_TIME;
encodingParam.iInputCsp = videoFormatI420;
encodingParam.iPicWidth = uWidth;
encodingParam.iPicHeight = uHeight;
encodingParam.iTargetBitrate = uBitrate;
encodingParam.fMaxFrameRate = uFramerate;
encodingParam.iRCMode = RC_OFF_MODE;
encodingParam.iTemporalLayerNum = 1;
encodingParam.iSpatialLayerNum = 1;
int i;
for (i = 0; i < encodingParam.iSpatialLayerNum; i++) {
encodingParam.sSpatialLayers[i].iVideoWidth = uWidth;
encodingParam.sSpatialLayers[i].iVideoHeight = uHeight;
encodingParam.sSpatialLayers[i].fFrameRate = uFramerate;
encodingParam.sSpatialLayers[i].iSpatialBitrate = uBitrate ;
encodingParam.sSpatialLayers[i].uiProfileIdc = PRO_BASELINE; // PRO_SCALABLE_HIGH;
encodingParam.sSpatialLayers[i].uiLevelIdc = LEVEL_3_1;
encodingParam.sSpatialLayers[i].sSliceCfg.uiSliceMode = SM_DYN_SLICE;
encodingParam.sSpatialLayers[i].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 1300;
}
encodingParam.uiIntraPeriod = uFramerate; /* I-Frame interval in frames */
encodingParam.bEnableSpsPpsIdAddition = 1;
encodingParam.bPrefixNalAddingCtrl = 0;
encodingParam.iPaddingFlag = 0;
encodingParam.uiMaxNalSize = 1300;
encodingParam.bEnableLongTermReference = 1;
encodingParam.iLtrMarkPeriod = uFramerate;
iRet = pSVCEncoder->InitializeExt(&encodingParam);
lLumaSize = (uWidth) * (uHeight);
lChroSize = (lLumaSize >> 2);
memset(&SrcPic, 0, sizeof(SSourcePicture));
SrcPic.iColorFormat = videoFormatI420;
SrcPic.iPicWidth = uWidth;
SrcPic.iPicHeight = uHeight;
SrcPic.iStride[0] = uWidth;
SrcPic.iStride[1] = uWidth >> 1;
SrcPic.iStride[2] = uWidth >> 1;
SrcPic.iStride[3] = 0;
SrcPic.uiTimeStamp = uwTimestamp;
SrcPic.pData[0] = inputBuffer;
SrcPic.pData[1] = SrcPic.pData[0] + lLumaSize;
SrcPic.pData[2] = SrcPic.pData[1] + lChroSize;
SrcPic.pData[3] = NULL;
memset(&info, 0, sizeof(SFrameBSInfo));
The text was updated successfully, but these errors were encountered: