问题描述
我想使用Rtmp推送H265,因此需要flv支持H265和HEVCDecoderConfigurationRecord,但是我不知道如何将值设置为:Where can I find HEVC \ H.265 specs
aligned(8) class HEVCDecoderConfigurationRecord
{
unsigned int(8) configurationVersion = 1;
unsigned int(2) general_profile_space;
unsigned int(1) general_tier_flag;
unsigned int(5) general_profile_idc;
unsigned int(32) general_profile_compatibility_flags;
unsigned int(48) general_constraint_indicator_flags;
unsigned int(8) general_level_idc;
bit(4) reserved = ‘1111’b;
unsigned int(12) min_spatial_segmentation_idc;
bit(6) reserved = ‘111111’b;
unsigned int(2) parallelismType;
bit(6) reserved = ‘111111’b;
unsigned int(2) chroma_format_idc;
bit(5) reserved = ‘11111’b;
unsigned int(3) bit_depth_luma_minus8;
bit(5) reserved = ‘11111’b;
unsigned int(3) bit_depth_chroma_minus8;
bit(16) avgFrameRate;
bit(2) constantFrameRate;
bit(3) numTemporalLayers;
bit(1) temporalIdNested;
unsigned int(2) lengthSizeMinusOne;
unsigned int(8) numOfArrays;
for (j=0; j < numOfArrays; j++)
{
bit(1) array_completeness;
unsigned int(1) reserved = 0;
unsigned int(6) NAL_unit_type;
unsigned int(16) numNalus;
for (i=0; i< numNalus; i++)
{
unsigned int(16) nalUnitLength;
bit(8*nalUnitLength) nalUnit;
}
}
}
public static void writeFirstVideoTag(ByteBuffer buffer,byte[] vps,byte[] sps,byte[] pps) {
//写入Flv Video Header
//wangpeng h265
writeVideoHeader(buffer,FlvVideoFrameType.KeyFrame,FlvVideoCodecID.HEVC,FlvVideoAVCPacketType.SequenceHeader);
//https://github.com/donwg/msnet/blob/8704f78ecb41960d9d29038cc1af4fd3e0f20a24/utils/UtilRtmp.h
buffer.put((byte)0x1C); //0x1c
// general_profile_idc 8bit
buffer.put(sps[1]);
// general_profile_compatibility_flags 32 bit
buffer.put(sps[2]);
buffer.put(sps[3]);
buffer.put(sps[4]);
buffer.put(sps[5]);
// 48 bit NUll nothing deal in rtmp
buffer.put(sps[6]);
buffer.put(sps[7]);
buffer.put(sps[8]);
buffer.put(sps[9]);
buffer.put(sps[10]);
buffer.put(sps[11]);
// general_level_idc
buffer.put(sps[12]);
// 48 bit NUll nothing deal in rtmp 24
for(int i=0;i<4;i++){// 6
buffer.put((byte)0x00);
}
// bit(16) avgFrameRate;
buffer.put((byte)0x00);
buffer.put((byte)0x00);
/* bit(2) constantFrameRate; */
/* bit(3) numTemporalLayers; */
/* bit(1) temporalIdNested; */
buffer.put((byte)0x00);
/* unsigned int(8) numOfArrays; 03 */
buffer.put((byte)0x03);
// vps 32
buffer.put((byte)0x20);
buffer.put((byte)0x00);
buffer.put((byte)0x01);
//todu vps
buffer.putShort((short)vps.length); //33
buffer.put(vps);
// sps 33
buffer.put((byte)0x21);
buffer.put((byte)0x00);
buffer.put((byte)0x01);
buffer.putShort((short)sps.length);
buffer.put(sps);
// pps
buffer.put((byte)0x22); // pps 34
buffer.put((byte)0x00);
buffer.put((byte)0x01);
buffer.putShort((short)pps.length);
buffer.put(pps);
}
如果缓冲区设置正确,可以给我一些建议吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)