{"id":34021,"date":"2025-04-29T00:55:42","date_gmt":"2025-04-28T16:55:42","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/34021.html"},"modified":"2025-04-29T00:55:42","modified_gmt":"2025-04-28T16:55:42","slug":"%e3%80%90gb28181%e3%80%91rtsp%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%bc%a0%e8%be%93aac%e9%9f%b3%e9%a2%91","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/34021.html","title":{"rendered":"\u3010GB28181\u3011RTSP\u670d\u52a1\u5668\u4f20\u8f93AAC\u97f3\u9891"},"content":{"rendered":"<h2>\u6982\u8ff0<\/h2>\n<p>\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684RTSP\u670d\u52a1\u5668&#xff0c;\u4e3b\u8981\u7528\u4e8e\u4ece\u672c\u5730AAC\u6587\u4ef6\u8bfb\u53d6\u97f3\u9891\u6570\u636e&#xff0c;\u7136\u540e\u901a\u8fc7RTP\u534f\u8bae\u5b9e\u65f6\u4f20\u8f93AAC\u97f3\u9891\u6d41\u3002\u6574\u4f53\u7ed3\u6784\u548cH264\u89c6\u9891\u6d41\u670d\u52a1\u5668\u7ed3\u6784\u76f8\u4f3c<\/p>\n<h2>ADTS\u5934\u90e8<\/h2>\n<p>\u7ed3\u6784\u4f53\u5206\u6790<\/p>\n<p>\u8be5\u7ed3\u6784\u4f53\u4e3b\u8981\u7528\u4e8e\u63cf\u8ff0ADTS\u5934\u90e8&#xff0c;\u8be5\u5934\u90e8\u4fe1\u606f\u4f4d\u4e8e\u6bcf\u4e2aAAC\u97f3\u9891\u5e27\u4e4b\u524d&#xff0c;\u5176\u4e2d\u5305\u542b\u4e86\u97f3\u9891\u5e27\u7684\u540c\u6b65\u4fe1\u606f\u3001\u957f\u5ea6\u3001\u91c7\u6837\u7387\u7b49\u91cd\u8981\u53c2\u6570<\/p>\n<ul>\n<li>syncword: \u540c\u6b65\u5b57 (0xFFF)&#xff0c;\u6807\u5fd7 ADTS \u5e27\u7684\u5f00\u59cb\u3002<\/li>\n<li>aacFrameLength: ADTS \u5e27\u957f\u5ea6 (\u5305\u62ec\u5934\u90e8\u548c AAC \u539f\u59cb\u6570\u636e)&#xff0c;\u8fd9\u662f\u786e\u5b9a\u6bcf\u4e2a AAC \u5e27\u5927\u5c0f\u7684\u5173\u952e\u4fe1\u606f\u3002<\/li>\n<li>samplingFreqIndex: \u91c7\u6837\u7387\u7d22\u5f15&#xff0c;\u5bf9\u5e94\u5b9e\u9645\u7684\u91c7\u6837\u7387 (\u5982 44100Hz, 48000Hz)\u3002<\/li>\n<li>channelCfg: \u58f0\u9053\u914d\u7f6e&#xff0c;\u8868\u793a\u97f3\u9891\u58f0\u9053\u6570 (\u5982\u5355\u58f0\u9053\u3001\u7acb\u4f53\u58f0)<\/li>\n<\/ul>\n<p>struct AdtsHeader {<br \/>\n    unsigned int syncword;  \/\/12 bit \u540c\u6b65\u5b57 &#039;1111 1111 1111&#039;&#xff0c;\u4e00\u4e2aADTS\u5e27\u7684\u5f00\u59cb<br \/>\n    uint8_t id;        \/\/1 bit 0\u4ee3\u8868MPEG-4, 1\u4ee3\u8868MPEG-2\u3002<br \/>\n    uint8_t layer;     \/\/2 bit \u5fc5\u987b\u4e3a0<br \/>\n    uint8_t protectionAbsent;  \/\/1 bit 1\u4ee3\u8868\u6ca1\u6709CRC&#xff0c;0\u4ee3\u8868\u6709CRC<br \/>\n    uint8_t profile;           \/\/1 bit AAC\u7ea7\u522b&#xff08;MPEG-2 AAC\u4e2d\u5b9a\u4e49\u4e863\u79cdprofile&#xff0c;MPEG-4 AAC\u4e2d\u5b9a\u4e49\u4e866\u79cdprofile&#xff09;<br \/>\n    uint8_t samplingFreqIndex; \/\/4 bit \u91c7\u6837\u7387<br \/>\n    uint8_t privateBit;        \/\/1bit \u7f16\u7801\u65f6\u8bbe\u7f6e\u4e3a0&#xff0c;\u89e3\u7801\u65f6\u5ffd\u7565<br \/>\n    uint8_t channelCfg;        \/\/3 bit \u58f0\u9053\u6570\u91cf<br \/>\n    uint8_t originalCopy;      \/\/1bit \u7f16\u7801\u65f6\u8bbe\u7f6e\u4e3a0&#xff0c;\u89e3\u7801\u65f6\u5ffd\u7565<br \/>\n    uint8_t home;               \/\/1 bit \u7f16\u7801\u65f6\u8bbe\u7f6e\u4e3a0&#xff0c;\u89e3\u7801\u65f6\u5ffd\u7565<\/p>\n<p>    uint8_t copyrightIdentificationBit;   \/\/1 bit \u7f16\u7801\u65f6\u8bbe\u7f6e\u4e3a0&#xff0c;\u89e3\u7801\u65f6\u5ffd\u7565<br \/>\n    uint8_t copyrightIdentificationStart; \/\/1 bit \u7f16\u7801\u65f6\u8bbe\u7f6e\u4e3a0&#xff0c;\u89e3\u7801\u65f6\u5ffd\u7565<br \/>\n    unsigned int aacFrameLength;               \/\/13 bit \u4e00\u4e2aADTS\u5e27\u7684\u957f\u5ea6\u5305\u62ecADTS\u5934\u548cAAC\u539f\u59cb\u6d41<br \/>\n    unsigned int adtsBufferFullness;           \/\/11 bit \u7f13\u51b2\u533a\u5145\u6ee1\u5ea6&#xff0c;0x7FF\u8bf4\u660e\u662f\u7801\u7387\u53ef\u53d8\u7684\u7801\u6d41&#xff0c;\u4e0d\u9700\u8981\u6b64\u5b57\u6bb5\u3002CBR\u53ef\u80fd\u9700\u8981\u6b64\u5b57\u6bb5&#xff0c;\u4e0d\u540c\u7f16\u7801\u5668\u4f7f\u7528\u60c5\u51b5\u4e0d\u540c\u3002\u8fd9\u4e2a\u5728\u4f7f\u7528\u97f3\u9891\u7f16\u7801\u7684\u65f6\u5019\u9700\u8981\u6ce8\u610f\u3002<\/p>\n<p>    \/* number_of_raw_data_blocks_in_frame<br \/>\n     * \u8868\u793aADTS\u5e27\u4e2d\u6709number_of_raw_data_blocks_in_frame &#043; 1\u4e2aAAC\u539f\u59cb\u5e27<br \/>\n     * \u6240\u4ee5\u8bf4number_of_raw_data_blocks_in_frame &#061;&#061; 0<br \/>\n     * \u8868\u793a\u8bf4ADTS\u5e27\u4e2d\u6709\u4e00\u4e2aAAC\u6570\u636e\u5757\u5e76\u4e0d\u662f\u8bf4\u6ca1\u6709\u3002(\u4e00\u4e2aAAC\u539f\u59cb\u5e27\u5305\u542b\u4e00\u6bb5\u65f6\u95f4\u51851024\u4e2a\u91c7\u6837\u53ca\u76f8\u5173\u6570\u636e)<br \/>\n     *\/<br \/>\n    uint8_t numberOfRawDataBlockInFrame; \/\/2 bit<br \/>\n}; <\/p>\n<p>\u89e3\u6790\u51fd\u6570\u5206\u6790<\/p>\n<p>\u4e3b\u8981\u7528\u4e8e\u89e3\u6790ADTS\u5934\u90e8&#xff0c;\u4ece\u5b57\u8282\u6d41\u4e2d\u63d0\u53d6ADTS\u5934\u90e8\u4fe1\u606f&#xff0c;\u7136\u540e\u586b\u5145\u5230AdtsHeader\u7ed3\u6784\u4f53\u4e2d<\/p>\n<ul>\n<li>\u540c\u6b65\u5b57\u6821\u9a8c: \u9996\u5148\u68c0\u67e5\u524d\u4e24\u4e2a\u5b57\u8282\u662f\u5426\u4e3a ADTS \u540c\u6b65\u5b57 (0xFFF)&#xff0c;\u8fd9\u662f\u5224\u65ad\u662f\u5426\u4e3a\u6709\u6548 ADTS \u5934\u90e8\u7684\u9996\u8981\u6761\u4ef6<\/li>\n<li>\u4f4d\u57df\u63d0\u53d6: \u4f7f\u7528\u4f4d\u8fd0\u7b97\u4ece ADTS \u5934\u90e8\u5b57\u8282\u4e2d\u63d0\u53d6\u5404\u4e2a\u5b57\u6bb5\u7684\u503c&#xff0c;\u4f8b\u5982 AAC \u7ea7\u522b\u3001\u91c7\u6837\u7387\u7d22\u5f15\u3001\u58f0\u9053\u914d\u7f6e\u3001ADTS \u5e27\u957f\u5ea6\u7b49&#xff0c;\u5e76\u5c06\u89e3\u6790\u51fa\u7684\u503c\u5b58\u50a8\u5230 AdtsHeader \u7ed3\u6784\u4f53\u4e2d<\/li>\n<li>\u9519\u8bef\u5904\u7406: \u5982\u679c\u540c\u6b65\u5b57\u6821\u9a8c\u5931\u8d25&#xff0c;\u5219\u8ba4\u4e3a ADTS \u5934\u90e8\u89e3\u6790\u5931\u8d25&#xff0c;\u8fd4\u56de\u9519\u8bef\u4ee3\u7801<\/li>\n<\/ul>\n<p>static int parseAdtsHeader(uint8_t* in, struct AdtsHeader* res) {<br \/>\n    static int frame_number &#061; 0;<br \/>\n    memset(res, 0, sizeof(*res));<\/p>\n<p>    if ((in[0] &#061;&#061; 0xFF) &amp;&amp; ((in[1] &amp; 0xF0) &#061;&#061; 0xF0))<br \/>\n    {<br \/>\n        res-&gt;id &#061; ((uint8_t)in[1] &amp; 0x08) &gt;&gt; 3;\/\/\u7b2c\u4e8c\u4e2a\u5b57\u8282\u4e0e0x08\u4e0e\u8fd0\u7b97\u4e4b\u540e&#xff0c;\u83b7\u5f97\u7b2c13\u4f4dbit\u5bf9\u5e94\u7684\u503c<br \/>\n        res-&gt;layer &#061; ((uint8_t)in[1] &amp; 0x06) &gt;&gt; 1;\/\/\u7b2c\u4e8c\u4e2a\u5b57\u8282\u4e0e0x06\u4e0e\u8fd0\u7b97\u4e4b\u540e&#xff0c;\u53f3\u79fb1\u4f4d&#xff0c;\u83b7\u5f97\u7b2c14,15\u4f4d\u4e24\u4e2abit\u5bf9\u5e94\u7684\u503c<br \/>\n        res-&gt;protectionAbsent &#061; (uint8_t)in[1] &amp; 0x01;<br \/>\n        res-&gt;profile &#061; ((uint8_t)in[2] &amp; 0xc0) &gt;&gt; 6;<br \/>\n        res-&gt;samplingFreqIndex &#061; ((uint8_t)in[2] &amp; 0x3c) &gt;&gt; 2;<br \/>\n        res-&gt;privateBit &#061; ((uint8_t)in[2] &amp; 0x02) &gt;&gt; 1;<br \/>\n        res-&gt;channelCfg &#061; ((((uint8_t)in[2] &amp; 0x01) &lt;&lt; 2) | (((unsigned int)in[3] &amp; 0xc0) &gt;&gt; 6));<br \/>\n        res-&gt;originalCopy &#061; ((uint8_t)in[3] &amp; 0x20) &gt;&gt; 5;<br \/>\n        res-&gt;home &#061; ((uint8_t)in[3] &amp; 0x10) &gt;&gt; 4;<br \/>\n        res-&gt;copyrightIdentificationBit &#061; ((uint8_t)in[3] &amp; 0x08) &gt;&gt; 3;<br \/>\n        res-&gt;copyrightIdentificationStart &#061; (uint8_t)in[3] &amp; 0x04 &gt;&gt; 2;<\/p>\n<p>        res-&gt;aacFrameLength &#061; (((((unsigned int)in[3]) &amp; 0x03) &lt;&lt; 11) |<br \/>\n            (((unsigned int)in[4] &amp; 0xFF) &lt;&lt; 3) |<br \/>\n            ((unsigned int)in[5] &amp; 0xE0) &gt;&gt; 5);<\/p>\n<p>        res-&gt;adtsBufferFullness &#061; (((unsigned int)in[5] &amp; 0x1f) &lt;&lt; 6 |<br \/>\n            ((unsigned int)in[6] &amp; 0xfc) &gt;&gt; 2);<br \/>\n        res-&gt;numberOfRawDataBlockInFrame &#061; ((uint8_t)in[6] &amp; 0x03);<\/p>\n<p>        return 0;<br \/>\n    }<br \/>\n    else<br \/>\n    {<br \/>\n        printf(&#034;failed to parse adts header\\\\n&#034;);<br \/>\n        return -1;<br \/>\n    }<br \/>\n} <\/p>\n<h2>RTP AAC\u5e27\u53d1\u9001\u51fd\u6570<\/h2>\n<p>\u8d1f\u8d23\u5c06 AAC \u97f3\u9891\u5e27\u5c01\u88c5\u6210 RTP \u5305\u5e76\u901a\u8fc7 UDP \u53d1\u9001&#xff0c;\u5176\u4e2dAAC\u7684RTP\u8d1f\u8f7d\u683c\u5f0f\u4f7f\u7528\u7684\u662fAU\u5934\u90e8&#xff1b;\u6574\u4f53\u903b\u8f91\u662f\u5148\u8bbe\u7f6e\u901a\u7528\u7684AU\u5934\u90e8&#xff0c;\u7136\u540e\u5c06\u8d1f\u8f7d\u52a0\u5165\u5230RTP\u8d1f\u8f7d\u7a7a\u95f4\u4e2d&#xff0c;\u901a\u8fc7RTP\u53d1\u9001&#xff0c;\u7136\u540e\u66f4\u65b0\u5e8f\u5217\u53f7\u548c\u65f6\u95f4\u6233<\/p>\n<p>\u4ee3\u7801\u5206\u6790<\/p>\n<p>\u4e3b\u8981\u6d41\u7a0b\u603b\u7ed3<\/p>\n<ul>\n<li>\u4eceAAC\u97f3\u9891\u6587\u4ef6\u4e2d\u8bfb\u53d6\u6570\u636e&#xff0c;\u7136\u540e\u89e3\u6790ADTS\u7684\u5934\u90e8<\/li>\n<li>RTP\u6570\u636e\u5305\u5c01\u88c5&#xff1a;\u5c06\u97f3\u9891\u6570\u636e\u5c01\u88c5\u8fdb\u4e00\u4e2aRTP\u5305\u4e2d&#xff0c;\u7136\u540e\u901a\u8fc7\u7f51\u7edc\u8fdb\u884c\u53d1\u9001<\/li>\n<li>\u63a7\u5236\u5e27\u7387&#xff0c;\u786e\u4fdd\u97f3\u9891\u6570\u636e\u6309\u7167\u6b63\u786e\u7684\u901f\u5ea6\u8fdb\u884c\u64ad\u653e\u00a0<\/li>\n<\/ul>\n<p> \/\/\u5f00\u59cb\u64ad\u653e&#xff0c;\u53d1\u9001RTP\u5305<br \/>\n        if (!strcmp(method, &#034;PLAY&#034;)) {<\/p>\n<p>            struct AdtsHeader adtsHeader; \/\/ \u5b58\u50a8ADTS\u5934\u90e8\u4fe1\u606f<br \/>\n            struct RtpPacket* rtpPacket;  \/\/ RTP\u5305<br \/>\n            uint8_t* frame; \/\/\u5b58\u50a8\u6587\u4ef6\u4e2d\u8bfb\u53d6AAC\u97f3\u9891\u6570\u636e<br \/>\n            int ret;<\/p>\n<p>            FILE* fp &#061; fopen(AAC_FILE_NAME, &#034;rb&#034;);<br \/>\n            if (!fp) {<br \/>\n                printf(&#034;\u8bfb\u53d6 %s \u5931\u8d25\\\\n&#034;, AAC_FILE_NAME);<br \/>\n                break;<br \/>\n            }<\/p>\n<p>            frame &#061; (uint8_t*)malloc(5000);<br \/>\n            rtpPacket &#061; (struct RtpPacket*)malloc(5000);<\/p>\n<p>            \/\/ \u521d\u59cb\u5316RTP\u5305\u5934\u4fe1\u606f&#xff08;\u4e00\u822c\u662f\u7248\u672c\u8d1f\u8f7d\u7c7b\u578b\u7b49&#xff09;<br \/>\n            rtpHeaderInit(rtpPacket, 0, 0, 0, RTP_VESION, RTP_PAYLOAD_TYPE_AAC, 1, 0, 0, 0x32411);<\/p>\n<p>            while (true)<br \/>\n            {<br \/>\n                \/\/ \u8bfb\u53d6\u524d7\u4e2a\u5b57\u8282\u5b58\u50a8\u5230frame\u4e2d&#xff0c;\u4e5f\u5c31\u662fADTS\u5934\u90e8\u6570\u636e<br \/>\n                ret &#061; fread(frame, 1, 7, fp);<br \/>\n                if (ret &lt;&#061; 0)<br \/>\n                {<br \/>\n                    printf(&#034;fread err\\\\n&#034;);<br \/>\n                    break;<br \/>\n                }<br \/>\n                printf(&#034;fread ret&#061;%d \\\\n&#034;,ret);<\/p>\n<p>                \/\/ \u89e3\u6790ADTS\u5934\u90e8\u4fe1\u606f<br \/>\n                if (parseAdtsHeader(frame, &amp;adtsHeader) &lt; 0)<br \/>\n                {<br \/>\n                    printf(&#034;parseAdtsHeader err\\\\n&#034;);<br \/>\n                    break;<br \/>\n                }<\/p>\n<p>                \/\/ \u8bfb\u53d6\u5b8c\u5269\u4e0b\u7684AAC\u97f3\u9891\u6570\u636e<br \/>\n                ret &#061; fread(frame, 1, adtsHeader.aacFrameLength &#8211; 7, fp);<br \/>\n                if (ret &lt;&#061; 0)<br \/>\n                {<br \/>\n                    printf(&#034;fread err\\\\n&#034;);<br \/>\n                    break;<br \/>\n                }<\/p>\n<p>                rtpSendAACFrame(serverRtpSockfd, clientIP, clientRtpPort,<br \/>\n                    rtpPacket, frame, adtsHeader.aacFrameLength &#8211; 7);<\/p>\n<p>                Sleep(1);<br \/>\n                \/\/usleep(23223);\/\/1000\/43.06 * 1000<br \/>\n            }<\/p>\n<p>            free(frame);<br \/>\n            free(rtpPacket);<\/p>\n<p>            break;<\/p>\n<p>        }<\/p>\n<p>        memset(method, 0, sizeof(method) \/ sizeof(char));<br \/>\n        memset(url, 0, sizeof(url) \/ sizeof(char));<br \/>\n        CSeq &#061; 0;<br \/>\n    } <\/p>\n<h2>RTSP\u5904\u7406AAC\u97f3\u9891SDP<\/h2>\n<p>\u5c06handleCmd_DESCRIBE\u4fee\u6539\u4e3a\u751f\u6210\u97f3\u9891\u6d41\u7684SDP\u63cf\u8ff0<\/p>\n<ul>\n<li>m&#061;audio 0 RTP\/AVP 97: \u5a92\u4f53\u7c7b\u578b\u6539\u4e3a audio&#xff0c;payload type \u8bbe\u7f6e\u4e3a 97 (\u52a8\u6001 payload type)\u3002<\/li>\n<li>a&#061;rtpmap:97 mpeg4-generic\/44100\/2: RTP map \u5c5e\u6027\u8bbe\u7f6e\u4e3a mpeg4-generic \u97f3\u9891&#xff0c;\u91c7\u6837\u7387 44100Hz&#xff0c;2 \u58f0\u9053 (\u7acb\u4f53\u58f0)\u3002<\/li>\n<li>a&#061;fmtp:97 &#8230; config&#061;1210;: \u5173\u952e\u7684 FMTP \u5c5e\u6027&#xff0c;\u5305\u542b AAC \u97f3\u9891\u6d41\u7684\u683c\u5f0f\u7279\u5b9a\u53c2\u6570&#xff0c;\u7279\u522b\u662f config&#061;1210&#xff0c;\u8fd9\u662f AudioSpecificConfig (\u97f3\u9891\u7279\u5b9a\u914d\u7f6e)&#xff0c;\u4ee5\u5341\u516d\u8fdb\u5236\u8868\u793a&#xff0c;\u89e3\u7801\u5668\u9700\u8981\u8fd9\u4e2a\u914d\u7f6e\u4fe1\u606f\u624d\u80fd\u6b63\u786e\u89e3\u7801 AAC \u97f3\u9891\u3002 0x1210 \u4ee3\u8868 44100Hz \u91c7\u6837\u7387\u548c 2 \u58f0\u9053<\/li>\n<\/ul>\n<p>\u4ee3\u7801\u5206\u6790<\/p>\n<p>\u6838\u5fc3\u6d41\u7a0b\u5206\u4e3a\u4e09\u6b65<\/p>\n<ul>\n<li>\u89e3\u6790RTSP\u7684URL&#xff0c;\u4eceURL\u4e2d\u63d0\u53d6\u672c\u5730\u7684IP\u5730\u5740<\/li>\n<li>\u751f\u6210SDP\u6570\u636e&#xff0c;\u6784\u5efa\u63cf\u8ff0\u6d41\u5a92\u4f53\u4fe1\u606f\u7684SDP\u5b57\u7b26\u4e32<\/li>\n<li>\u6784\u5efaRTSP\u54cd\u5e94&#xff0c;\u5c06\u751f\u6210\u7684SDP\u6570\u636e\u4e0eRTSP\u54cd\u5e94\u62fc\u63a5\u5728\u4e00\u8d77\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef<\/li>\n<\/ul>\n<p>static int handleCmd_DESCRIBE(char* result, int cseq, char* url) {<br \/>\n    char sdp[500];<br \/>\n    char localIp[100];<\/p>\n<p>    \/\/ \u4eceRTSP\u6d41\u5730\u5740\u4e2d\u83b7\u53d6IP\u5730\u5740<br \/>\n    sscanf(url, &#034;rtsp:\/\/%[^:]:&#034;, localIp);<\/p>\n<p>    \/\/ \u6784\u5efaSDP\u6570\u636e<br \/>\n    sprintf(sdp, &#034;v&#061;0\\\\r\\\\n&#034;<br \/>\n        &#034;o&#061;- 9%ld 1 IN IP4 %s\\\\r\\\\n&#034;<br \/>\n        &#034;t&#061;0 0\\\\r\\\\n&#034;<br \/>\n        &#034;a&#061;control:*\\\\r\\\\n&#034;<br \/>\n        &#034;m&#061;audio 0 RTP\/AVP 97\\\\r\\\\n&#034;<br \/>\n        &#034;a&#061;rtpmap:97 mpeg4-generic\/44100\/2\\\\r\\\\n&#034;<br \/>\n        &#034;a&#061;fmtp:97 profile-level-id&#061;1;mode&#061;AAC-hbr;sizelength&#061;13;indexlength&#061;3;indexdeltalength&#061;3;config&#061;1210;\\\\r\\\\n&#034;<\/p>\n<p>        \/\/&#034;a&#061;fmtp:97 SizeLength&#061;13;\\\\r\\\\n&#034;<br \/>\n        &#034;a&#061;control:track0\\\\r\\\\n&#034;,<br \/>\n        time(NULL), localIp);<\/p>\n<p>    sprintf(result, &#034;RTSP\/1.0 200 OK\\\\r\\\\nCSeq: %d\\\\r\\\\n&#034;<br \/>\n        &#034;Content-Base: %s\\\\r\\\\n&#034;<br \/>\n        &#034;Content-type: application\/sdp\\\\r\\\\n&#034;<br \/>\n        &#034;Content-length: %d\\\\r\\\\n\\\\r\\\\n&#034;<br \/>\n        &#034;%s&#034;,<br \/>\n        cseq,<br \/>\n        url,<br \/>\n        strlen(sdp),<br \/>\n        sdp);<\/p>\n<p>    return 0;<br \/>\n} <\/p>\n<p>\u6784\u5efaSDP\u7684\u5185\u5bb9\u5206\u6790<\/p>\n<ul>\n<li>v&#061;0: \u7248\u672c\u53f7\u3002<\/li>\n<li>o&#061;- 9%ld 1 IN IP4 %s: \u53d1\u9001\u8005\u548c\u4f1a\u8bdd\u6807\u8bc6\u3002time(NULL) \u63d0\u4f9b\u5f53\u524d\u65f6\u95f4\u6233&#xff0c;localIp \u5219\u662f\u4ece URL \u4e2d\u63d0\u53d6\u7684\u672c\u5730 IP \u5730\u5740\u3002<\/li>\n<li>t&#061;0 0: \u4f1a\u8bdd\u7684\u5f00\u59cb\u548c\u7ed3\u675f\u65f6\u95f4&#xff0c;\u8fd9\u91cc\u8bbe\u7f6e\u4e3a 0 0&#xff0c;\u8868\u793a\u8be5\u4f1a\u8bdd\u6ca1\u6709\u7279\u5b9a\u7684\u5f00\u59cb\u6216\u7ed3\u675f\u65f6\u95f4\u3002<\/li>\n<li>a&#061;control:: \u63a7\u5236\u6307\u4ee4&#xff0c;\u6307\u5b9a *&#xff0c;\u8868\u793a\u6240\u6709\u7684\u6d41\u90fd\u53ef\u4ee5\u88ab\u63a7\u5236\u3002<\/li>\n<li>m&#061;audio 0 RTP\/AVP 97: \u63cf\u8ff0\u97f3\u9891\u5a92\u4f53\u6d41&#xff0c;\u4f7f\u7528 RTP \u534f\u8bae&#xff0c;\u6d41\u7684\u5a92\u4f53\u7c7b\u578b\u662f\u97f3\u9891&#xff0c;\u8d1f\u8f7d\u7c7b\u578b&#xff08;Payload Type&#xff09;\u4e3a 97\u3002<\/li>\n<li>a&#061;rtpmap:97 mpeg4-generic\/44100\/2: \u8d1f\u8f7d\u7c7b\u578b 97 \u7684\u8be6\u7ec6\u4fe1\u606f&#xff0c;\u8868\u793a\u4f7f\u7528 MPEG4 \u7f16\u7801&#xff0c;\u91c7\u6837\u7387\u4e3a 44100 Hz&#xff0c;\u58f0\u9053\u6570\u4e3a 2\u3002<\/li>\n<li>a&#061;fmtp:97 &#8230;: \u4e3a\u8d1f\u8f7d\u7c7b\u578b 97 \u63d0\u4f9b\u7684\u683c\u5f0f\u7279\u5b9a\u53c2\u6570&#xff0c;\u6307\u5b9a\u7f16\u7801\u65b9\u5f0f\u3001\u6570\u636e\u7ed3\u6784\u7b49\u8be6\u7ec6\u4fe1\u606f\u3002<\/li>\n<li>a&#061;control:track0: \u63a7\u5236\u6307\u4ee4&#xff0c;\u6307\u5b9a\u97f3\u9891\u8f68\u9053\u4e3a track0<\/li>\n<\/ul><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb713\u6b21\uff0c\u70b9\u8d5e21\u6b21\uff0c\u6536\u85cf7\u6b21\u3002RTSP\u670d\u52a1\u5668\u4f20\u8f93aac\u6846\u67b6_rtsp\u534f\u8bae\u600e\u4e48\u6307\u5b9a\u97f3\u9891\u8f68\u9053<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2875,214],"topic":[],"class_list":["post-34021","post","type-post","status-publish","format-standard","hentry","category-server","tag-aac","tag-214"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010GB28181\u3011RTSP\u670d\u52a1\u5668\u4f20\u8f93AAC\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/34021.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010GB28181\u3011RTSP\u670d\u52a1\u5668\u4f20\u8f93AAC\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb713\u6b21\uff0c\u70b9\u8d5e21\u6b21\uff0c\u6536\u85cf7\u6b21\u3002RTSP\u670d\u52a1\u5668\u4f20\u8f93aac\u6846\u67b6_rtsp\u534f\u8bae\u600e\u4e48\u6307\u5b9a\u97f3\u9891\u8f68\u9053\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/34021.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-28T16:55:42+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/34021.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/34021.html\",\"name\":\"\u3010GB28181\u3011RTSP\u670d\u52a1\u5668\u4f20\u8f93AAC\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-28T16:55:42+00:00\",\"dateModified\":\"2025-04-28T16:55:42+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/34021.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/34021.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/34021.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010GB28181\u3011RTSP\u670d\u52a1\u5668\u4f20\u8f93AAC\u97f3\u9891\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010GB28181\u3011RTSP\u670d\u52a1\u5668\u4f20\u8f93AAC\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/34021.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010GB28181\u3011RTSP\u670d\u52a1\u5668\u4f20\u8f93AAC\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb713\u6b21\uff0c\u70b9\u8d5e21\u6b21\uff0c\u6536\u85cf7\u6b21\u3002RTSP\u670d\u52a1\u5668\u4f20\u8f93aac\u6846\u67b6_rtsp\u534f\u8bae\u600e\u4e48\u6307\u5b9a\u97f3\u9891\u8f68\u9053","og_url":"https:\/\/www.wsisp.com\/helps\/34021.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-28T16:55:42+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/34021.html","url":"https:\/\/www.wsisp.com\/helps\/34021.html","name":"\u3010GB28181\u3011RTSP\u670d\u52a1\u5668\u4f20\u8f93AAC\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-28T16:55:42+00:00","dateModified":"2025-04-28T16:55:42+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/34021.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/34021.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/34021.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010GB28181\u3011RTSP\u670d\u52a1\u5668\u4f20\u8f93AAC\u97f3\u9891"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/34021","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=34021"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/34021\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=34021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=34021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=34021"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=34021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}