我正在寻找一种在h264流中查找参考帧的算法。我在不同的解决方案中看到的最常见的方法是查找访问单元分隔符和IDR类型的NAL。不幸的是,我检查过的大多数流没有IDR类型的NAL。
非常感谢您的帮助。
敬礼
Jacek
void h264_find_IDR_frame(char *buf)
{
while(1)
{
if (buf[0]==0x00 && buf[1]==0x00 && buf[2]==0x01)
{
// Found a NAL unit with 3-byte startcode
if(buf[3] & 0x1F == 0x5)
{
// Found a reference frame, do something with it
}
break;
}
else if (buf[0]==0x00 && buf[1]==0x00 && buf[2]==0x00 && buf[3]==0x01)
{
// Found a NAL unit with 4-byte startcode
if(buf[4] & 0x1F == 0x5)
{
// Found a reference frame, do something with it
}
break;
}
buf++;
}
}
IDR
NAL单元。你是如何搜索的? - Roman R.