How to decode sprop-parameter-sets in a H264 SDP?

前端 未结 4 1174
我在风中等你
我在风中等你 2020-12-15 08:36

What is the meaning of Base64 decoded bytes in sprop-parameter-sets in SDP for a h264 stream? How can I know the video size from this example?

SDP example:

4条回答
  •  被撕碎了的回忆
    2020-12-15 09:07

    The video size is in the "framesize" line of SDP, isn't it ?

    00028 int av_strstart(const char *str, const char *pfx, const char **ptr)
    00029 {
    00030     while (*pfx && *pfx == *str) {
    00031         pfx++;
    00032         str++;
    00033     }
    00034     if (!*pfx && ptr)
    00035         *ptr = str;
    00036     return !*pfx;
    00037 }
    00038 
    

    p is a pointer of your line SDP

           if (av_strstart(p, "framesize:", &p)) {
    00370         char buf1[50];
    00371         char *dst = buf1;
    00372 
    00373         // remove the protocol identifier..
    00374         while (*p && *p == ' ') p++; // strip spaces.
    00375         while (*p && *p != ' ') p++; // eat protocol identifier
    00376         while (*p && *p == ' ') p++; // strip trailing spaces.
    00377         while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1) {
    00378             *dst++ = *p++;
    00379         }
    00380         *dst = '\0';
    00381 
    00382         // a='framesize:96 320-240'
    00383         // set our parameters..
    00384         codec->width = atoi(buf1);
    00385         codec->height = atoi(p + 1); // skip the -
    00386         codec->pix_fmt = PIX_FMT_YUV420P;
               }
    

    reference : http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/rtpdec__h264_8c-source.html#l00360

提交回复
热议问题