0

I have written a C++ application with processing of RTP video and Audio packet(Bitstream packets) but can't able to find a way to get height and width from VPs,SPs or PPs from every keyframe. Note:I am using only pure c++ codes until encoding and writing the file part with ffmpeg lib

Need to know How to Extract it from that extra data for Memcopy it to add with start code.

Need to find Height and width with it(Parsing).

i have Written in case like the folowing:

 byte *packet=&*(frameData);
int size =ptr->m_size;
boost::shared_ptr<byte> dst ;
int naltype = (packet[0] >> 1) & 0x3f;

switch(naltype)
{
case HEVC_NAL_VPS:
    m_vpsSize=(size)+4;
    m_vpsHeader[3]=1;
    memcpy(&m_vpsHeader[4],&packet[0],size); //need size and packet start and End dimension
    break;
case HEVC_NAL_SPS:
    m_spsSize=(size)+4;
    m_spsHeader[3]=1;
    memcpy(&m_spsHeader[4],&packet[0],size);//need size and packet start and End dimension
    break;
case HEVC_NAL_PPS:
    m_ppsSize=(size)+4;
    m_ppsHeader[3]=1;
    memcpy(&m_ppsHeader[4],&packet[0],size);//need size and packet start and End dimension
    break;
case 49:
    byte new_nal_header[2]={0};
    int startFU=packet[2]&0x80;
    int endFU = packet[2]&0x40;
    int fuType=packet[2] & 0x3f;
    new_nal_header[0] = (packet[0] & 0x81) | (fuType<<1);
    new_nal_header[1]=packet[1];

}
dinesh47
  • 37
  • 7
  • 2
    Is your question on figuring out *where* the dimensions are being communicated or how to extract it? If the latter, you should add that information so people can help you better. – Botje Aug 02 '21 at 11:07
  • The-h264 Sequence-parameter-set. https://stackoverflow.com/questions/31919054/h264-getting-frame-height-and-width-from-sequence-parameter-set-sps-nal-unit – Nadeem Taj Aug 02 '21 at 17:50

0 Answers0