Trang chủ‎ > ‎IT‎ > ‎

Video Processing

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;
           }

I have to get stream video [ which is from rtsp server] width and height.

Third party servers give the following info at RTSP DESCRIBE REQUEST:

One RTSP server give me width-height

Server Response:

RTSP/1.0 200 OK
....

Content-Type: application/sdp

Content-Length: 376

a=x-dimensions:1280,1024 // GET WIDTH HEIGHT

....

a=x-dimensions:1280,1024

But the other does not give me width/height info.... It seems that it supports ONVIF...

Server Response:


RTSP/1.0 200 OK

x-Accept-Dynamic-Rate: 1
... 
Content-Length: 625
... 
m=video 0 RTP/AVP 96

i=Video channel in H264 VBR format

a=mpeg4-esid:201

a=control:trackID=0

a=rtpmap:96 H264/90000

a=fmtp:96 packetization-mode=1;profile-level-id=640032;....

m=application 0 RTP/AVP 107

i=ONVIF metadata

a=control:events

a=sendonly

a=rtpmap:107 vnd.onvif.metadata/90000

Anyway-method to get stream width-height?Suggestions...

=> Width and height can be extracted from the H.264 sequence parameters set, which is is usually part of the fmtp line of the SDP in the DESCRIBE response. See this helpful SO post by cipi.