-
Notifications
You must be signed in to change notification settings - Fork 34
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
How to get more then one layer onEncode? Is it possible? #17
Comments
@secile |
Hello. I understand you are in very trouble. but I do not understand your question. Could you explain a little more clearly. |
@secile, thank you for your response. I'll try to explain
So that's the question. Can I get multiple layers? |
I tested my OpenH264Sample. I set brake point at OnEncode function and selected some jpeg images. You said that if info.iLayerNum is greater than 1, So, you want to use only high level layer data to encode? void Encoder::OnEncode(const SFrameBSInfo% info)
{
// only use high layer.
int i = info.iLayerNum - 1;
const SLayerBSInfo& layerInfo = info.sLayerInfo[i];
int layerSize = 0;
for (int j = 0; j < layerInfo.iNalCount; ++j) {
layerSize += layerInfo.pNalLengthInByte[j];
}
array<Byte>^ data = gcnew array<Byte>(layerSize);
System::Runtime::InteropServices::Marshal::Copy((IntPtr)layerInfo.pBsBuf, data, 0, layerSize);
OnEncodeFunc(data, layerSize, (FrameType)info.eFrameType);
} |
I use the Encode function very often - for a large number of images. And info.iLayerNum == 2 only when keyframes are generated (FrameType. IDR). This happens at intervals of, for example, 2 seconds (this depends on the float keyFrameInterval = 2 * 1.0f parameter that we specify in encoder. Setup(widthWebCam, heightWebCam, bpsVideo, 30, keyFrameInterval, onEncode)). And all the other frames (FrameType.P) between the keys (IDR) have info.iLayerNum == 1 (that is, within two seconds of all frames have info.iLayerNum == 1). I just thought it was possible to get multiple layers of each frame type (both IDR and P, not just in IDR, always). I started thinking about it when I tried to deal with OpenH264 on my own. They (developers) often talk about it. These layers may not be two, but even more. |
You want to get multiple layers both IDR and P, not just in IDR! I understand! But... |
Sorry of course, but thank you! |
All frames except the keyframes(IDR) have info.iLayerNum == 1 in the "OnEncode" function in Encoder class. Maybe somebody can make this value bigger? I need to get several layers of image for a project at the university
The text was updated successfully, but these errors were encountered: