{"id":23358,"date":"2025-04-19T07:36:41","date_gmt":"2025-04-18T23:36:41","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/23358.html"},"modified":"2025-04-19T07:36:41","modified_gmt":"2025-04-18T23:36:41","slug":"%e7%ae%97%e6%b3%95%e4%bb%bf%e7%9c%9f%e5%b9%b3%e5%8f%b0%e6%90%ad%e5%bb%ba1-ffmpegrtspsever%e5%bf%ab%e9%80%9f%e6%90%ad%e5%bb%ba%e4%b8%80%e4%b8%aartsp%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/23358.html","title":{"rendered":"\u7b97\u6cd5\u4eff\u771f\u5e73\u53f0\u642d\u5efa1-FFMPEG+RtspSever\u5feb\u901f\u642d\u5efa\u4e00\u4e2aRTSP\u670d\u52a1\u5668"},"content":{"rendered":"<h2>\u4e00\u3001\u524d\u8a00<\/h2>\n<p>\u672c\u6587\u76f8\u5173\u7684\u5168\u90e8\u6e90\u7801\u548cRtspSever\u5e93&#xff0c;\u6211\u5df2\u6253\u5305\u4e0a\u4f20&#xff0c;\u6b22\u8fce\u5927\u5bb6\u514d\u8d39\u4e0b\u8f7d&#xff0c;testRTSPSever\u3002 \u6bcf\u4e00\u4e2a\u5d4c\u5165\u5f0f\u89c6\u89c9\u7b97\u6cd5\u5de5\u7a0b\u5e08&#xff0c;\u90fd\u5e94\u8be5\u6709\u4e00\u5957\u5c5e\u4e8e\u81ea\u5df1\u7684\u7b97\u6cd5\u4eff\u771f\u548c\u6d4b\u8bd5\u73af\u5883\u3002\u53ef\u4ee5\u65b9\u4fbf\u5730\u8fdb\u884c\u89c6\u9891\u3001\u56fe\u50cf\u7b49\u7d20\u6750\u8fdb\u884c\u5728\u7ebf\u5bfc\u5165&#xff0c;\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c55\u793a\u7b97\u6cd5\u7ed3\u679c&#xff0c;\u53ef\u4ee5\u5feb\u901f\u5730\u6a21\u62df\u5e94\u7528\u573a\u666f&#xff0c;\u8fdb\u884c\u7b97\u6cd5\u5f00\u53d1\u3002\u5728\u89c6\u9891\u3001\u56fe\u50cf\u6587\u4ef6\u7b49\u7d20\u6750\u7684\u5728\u7ebf\u5bfc\u5165\u6a21\u5757&#xff0c;\u642d\u5efa\u4e00\u4e2a\u5c5e\u4e8e\u81ea\u5df1\u7684RTSP\u670d\u52a1\u5668&#xff0c;\u662f\u4e00\u4e2a\u7406\u60f3\u7684\u9009\u62e9\u3002 \u4f5c\u4e3a\u5b9e\u65f6\u6d41\u5a92\u4f53\u4f20\u8f93\u534f\u8bae&#xff0c;RTSP\u670d\u52a1\u5668\u53ef\u65e0\u7f1d\u5bf9\u63a5\u5404\u7c7b\u89c6\u89c9\u91c7\u96c6\u8bbe\u5907&#xff0c;\u652f\u6301H.264\/H.265\u7f16\u7801\u683c\u5f0f\u7684\u5b9e\u65f6\u89c6\u9891\u6d41\u4f20\u8f93&#xff0c;\u4e3a\u7b97\u6cd5\u9a8c\u8bc1\u63d0\u4f9b\u7a33\u5b9a\u53ef\u9760\u7684\u8f93\u5165&#xff0c;\u964d\u4f4e\u7b97\u6cd5\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u7531\u4e8e\u8f93\u5165\u539f\u56e0\u5e26\u6765\u7684\u56f0\u6270\u3002<\/p>\n<h2>\u4e8c\u3001\u5982\u4f55\u9009\u62e9\u5f00\u6e90\u5e93<\/h2>\n<p>\u7ecf\u8fc7\u8c03\u7814&#xff0c;\u4f7f\u7528C&#043;&#043;\u642d\u5efaRTSP\u670d\u52a1\u5668&#xff0c;\u5728\u5b89\u9632\u9886\u57df\u4f7f\u7528\u9891\u7387\u6700\u9ad8\u7684\u662fLive555\u5f00\u6e90\u5e93\u3002<\/p>\n<h3>2.1 Live555<\/h3>\n<p>Live555\u662f\u4e00\u4e2a\u4e3a\u5b9e\u65f6\u6d41\u5a92\u4f53\u4f20\u8f93\u63d0\u4f9b\u5b8c\u6574\u89e3\u51b3\u65b9\u6848\u7684\u8de8\u5e73\u53f0C&#043;&#043;\u5f00\u6e90\u6846\u67b6&#xff0c;\u5176\u7279\u70b9\u53ef\u6982\u62ec\u5982\u4e0b&#xff1a;<\/p>\n<ul>\n<li>\u5b8c\u6574\u5b9e\u73b0RTSP(\u5b9e\u65f6\u6d41\u63a7\u5236\u534f\u8bae)\u3001RTP\/RTCP(\u5b9e\u65f6\u4f20\u8f93\u4e0e\u63a7\u5236\u534f\u8bae)\u6807\u51c6\u534f\u8bae\u6808&#xff0c;\u652f\u6301HTTP\u3001SIP\u7b49\u8f85\u52a9\u534f\u8bae\u6269\u5c55\u3002<\/li>\n<li>\u539f\u751f\u652f\u6301H.264\/H.265\u3001MPEG\u3001JPEG\u7b4920&#043;\u79cd\u97f3\u89c6\u9891\u683c\u5f0f&#xff0c;\u53ef\u901a\u8fc7\u6d3e\u751f\u7c7b\u6269\u5c55\u65b0\u578b\u7f16\u7801\u3002<\/li>\n<li>\u57fa\u4e8eRTP\u534f\u8bae\u5b9e\u73b0&lt;200ms\u7ea7\u4f4e\u5ef6\u8fdf\u4f20\u8f93&#xff0c;\u652f\u6301\u81ea\u9002\u5e94\u7801\u7387\u8c03\u8282\u4e0e\u7f51\u7edc\u6296\u52a8\u3002<\/li>\n<li>\u652f\u6301\u642d\u5efa\u652f\u6301100&#043;\u5e76\u53d1\u8fde\u63a5\u7684RTSP\u670d\u52a1\u5668&#xff0c;\u5e94\u7528\u4e8e\u7f51\u7edc\u6444\u50cf\u5934\u63a8\u6d41\u3001\u89c6\u9891\u4f1a\u8bae\u7cfb\u7edf\u3002<\/li>\n<li>\u51ed\u501f&lt;500KB\u7684\u8f7b\u91cf\u5316\u5185\u5b58\u5360\u7528&#xff0c;\u9002\u914d\u667a\u80fd\u5bb6\u5c45\u3001\u8f66\u8f7d\u7ec8\u7aef\u7b49\u8d44\u6e90\u53d7\u9650\u573a\u666f\u3002<\/li>\n<\/ul>\n<p>\u529f\u80fd\u8d8a\u5f3a\u5927&#xff0c;\u5176\u6846\u67b6\u7684\u5f00\u653e\u7a0b\u5ea6\u4e5f\u8d8a\u9ad8&#xff0c;\u4f46\u662f&#xff0c;\u968f\u4e4b\u800c\u6765\u7684\u5b66\u4e60\u6210\u672c\u4e5f\u53d8\u9ad8\u4e86\u3002\u56e0\u6b64&#xff0c;\u5728\u8fd9\u91cc\u6211\u6ca1\u6709\u9009\u62e9Live555&#xff0c;\u800c\u662f\u9009\u62e9\u4e86\u4e00\u4e2a\u5f00\u653e\u7a0b\u5ea6\u8f83\u4f4e\u7684RtspSever\u7684\u5f00\u6e90\u9879\u76ee\u3002<\/p>\n<h3>2.2 RtspSever<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418233639-6802e207f35cd.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>RtspSever\u662fC&#043;&#043;11\u5b9e\u73b0\u7684RTSP\u670d\u52a1\u5668\u548c\u63a8\u6d41\u5668&#xff0c;\u6e90\u4ee3\u7801\u5b8c\u5168\u5f00\u653e&#xff0c;\u53ef\u7528\u4e8e\u5d4c\u5165\u5f0f\u7684\u4ea4\u53c9\u7f16\u8bd1&#xff0c;\u4e5f\u53ef\u4ee5\u5728Windows\u4e0b\u8fdb\u7f16\u8bd1\u5f00\u53d1\u3002 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418233640-6802e20827251.jpg\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> RtspSever\u63d0\u4f9b\u4e86\u4e00\u4e2a\u4f8b\u5b50&#xff0c;\u53ef\u4ee5\u622a\u53d6\u5c4f\u5e55\u8fdb\u884c\u63a8\u6d41&#xff0c;\u8fd9\u6b63\u597d\u7b26\u5408\u6211\u7684\u9700\u6c42\u3002\u56e0\u4e3a&#xff0c;\u622a\u53d6\u5c4f\u5e55\u5c31\u80af\u5b9a\u6d89\u53ca\u5230\u4ece\u5185\u5b58\u4e2d\u83b7\u53d6\u89c6\u9891\u548c\u56fe\u50cf&#xff0c;\u8fdb\u884c\u63a8\u6d41\u3002<\/p>\n<h3>2.3 FFMPEG<\/h3>\n<p>\u5bf9\u4e8e\u89c6\u9891\u7684\u7f16\u7801\u90e8\u5206&#xff0c;\u6211\u9009\u62e9\u7684\u662fFFMPEG\u3002FFMPEG\u662f\u4e00\u4e2a\u8de8\u5e73\u53f0\u5f00\u6e90\u591a\u5a92\u4f53\u5904\u7406\u6846\u67b6&#xff0c;\u7531\u591a\u4e2a\u6838\u5fc3\u5e93\u7ec4\u6210&#xff0c;\u4e3b\u8981\u7528\u4e8e\u97f3\u89c6\u9891\u7f16\u89e3\u7801\u3001\u5c01\u88c5\u8f6c\u6362\u3001\u6d41\u5a92\u4f53\u4f20\u8f93\u7b49\u573a\u666f\u3002\u5176\u6838\u5fc3\u529f\u80fd\u4e0e\u6a21\u5757\u5305\u62ec&#xff1a;<\/p>\n<ul>\n<li>\n<p>libavcode&#xff1a; \u63d0\u4f9b\u97f3\u89c6\u9891\u7f16\u89e3\u7801\u529f\u80fd&#xff0c;\u652f\u6301H.264\u3001AAC\u7b49\u4e3b\u6d41\u683c\u5f0f&#xff0c;\u652f\u6301GPU\u52a0\u901f\u3002<\/p>\n<\/li>\n<li>\n<p>libavformat: \u5904\u7406\u97f3\u89c6\u9891\u5c01\u88c5\u683c\u5f0f&#xff08;\u5982MP4\u3001FLV&#xff09;&#xff0c;\u5b9e\u73b0\u89e3\u5c01\u88c5&#xff08;Demuxing&#xff09;\u4e0e\u5c01\u88c5&#xff08;Muxing&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>libavfilter: \u652f\u6301\u97f3\u89c6\u9891\u6ee4\u955c\u5904\u7406&#xff0c;\u4f8b\u5982\u6dfb\u52a0\u6c34\u5370\u3001\u8c03\u6574\u5206\u8fa8\u7387\u6216\u97f3\u9891\u53d8\u58f0\u3002<\/p>\n<\/li>\n<li>\n<p>\u5176\u4ed6\u6838\u5fc3\u6a21\u5757&#xff1a; libswscale&#xff1a;\u56fe\u50cf\u683c\u5f0f\u8f6c\u6362&#xff08;\u5982YUV\u4e0eRGB\u4e92\u8f6c&#xff09;&#xff1b; libavdevice&#xff1a;\u786c\u4ef6\u8bbe\u5907\u91c7\u96c6\u4e0e\u6e32\u67d3&#xff08;\u5982\u6444\u50cf\u5934\u3001\u5c4f\u5e55\u5f55\u5236&#xff09; libswresample&#xff1a;\u97f3\u9891\u91cd\u91c7\u6837\u4e0e\u683c\u5f0f\u5904\u7406\u3002<\/p>\n<\/li>\n<\/ul>\n<p>FFMPEG\u5e7f\u6cdb\u5e94\u7528\u4e8e\u89c6\u9891\u8f6c\u7801\u3001\u76f4\u64ad\u63a8\u6d41\u3001\u97f3\u89c6\u9891\u7f16\u8f91\u7b49\u9886\u57df&#xff0c;\u652f\u6301Windows\u3001Linux\u3001macOS\u7b49\u7cfb\u7edf&#xff0c;\u5e76\u53ef\u901a\u8fc7\u547d\u4ee4\u884c\u5de5\u5177&#xff08;ffmpeg\u3001ffplay\u7b49&#xff09;\u5feb\u901f\u5b9e\u73b0\u591a\u5a92\u4f53\u5904\u7406\u3002 FFMPEG\u7684\u5b89\u88c5\u548c\u914d\u7f6e&#xff0c;\u5728\u6211\u7684\u6587\u7ae0VS2022\u914d\u7f6eFFMPEG\u6709\u8be6\u7ec6\u4ecb\u7ecd&#xff0c;\u8fd9\u91cc\u4e0d\u518d\u91cd\u590d\u8bf4\u660e\u3002<\/p>\n<h2>\u4e09\u3001\u4ee3\u7801\u8be6\u89e3<\/h2>\n<p>\u5728\u786e\u5b9a\u597d\u5f00\u6e90\u5e93\u540e&#xff0c;\u63a5\u4e0b\u6765\u7684\u4e8b\u60c5\u5c31\u662f\u5f00\u5de5\u64b8\u4ee3\u7801\u4e86\u3002\u8d85\u51fa\u4e86\u6211\u7684\u9884\u671f&#xff0c;\u6211\u4ec5\u4ec5\u4f7f\u7528\u4e86\u4e0d\u5230200\u884c\u7684\u4ee3\u7801\u5c31\u5b8c\u6210\u4e86RTSP\u7684\u670d\u52a1\u5668\u3002<\/p>\n<h3>3.1 \u4ee3\u7801\u8bbe\u8ba1<\/h3>\n<li>\n<p>\u521d\u59cb\u5316\u9636\u6bb5&#xff1a;<\/p>\n<ul>\n<li>\u521b\u5efaRTSP\u670d\u52a1\u5668\u5e76\u7ed1\u5b9a\u7aef\u53e3\u3002<\/li>\n<li>\u5b9a\u4e49\u5a92\u4f53\u4f1a\u8bdd&#xff0c;\u914d\u7f6eH264\u89c6\u9891\u6e90\u3002<\/li>\n<li>\u521d\u59cb\u5316FFmpeg\u56fe\u50cf\u8f6c\u6362\u548cH264\u7f16\u7801\u5668\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4e3b\u5faa\u73af\u9636\u6bb5&#xff1a;<\/p>\n<ul>\n<li>\u751f\u6210\u6d4b\u8bd5\u56fe\u50cf&#xff08;\u7eff\u8272\u5706\u5708\u52a8\u753b&#xff09;\u3002<\/li>\n<li>\u5c06BGR\u56fe\u50cf\u8f6c\u6362\u4e3aNV12\u683c\u5f0f\u3002<\/li>\n<li>\u4f7f\u7528H264\u7f16\u7801\u5668\u538b\u7f29\u89c6\u9891\u5e27\u3002<\/li>\n<li>\u5c06\u7f16\u7801\u540e\u7684\u6570\u636e\u901a\u8fc7RTSP\u534f\u8bae\u63a8\u9001\u3002<\/li>\n<li>\u672c\u5730\u7a97\u53e3\u663e\u793a\u5b9e\u65f6\u753b\u9762\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u8d44\u6e90\u91ca\u653e&#xff1a;<\/p>\n<ul>\n<li>\u9000\u51fa\u5faa\u73af\u540e\u91ca\u653e\u7f16\u7801\u5668\u3001\u5e27\u5185\u5b58\u7b49\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<\/li>\n<p>\u4ee3\u7801\u903b\u8f91\u6d41\u7a0b\u5982\u4e0b\u56fe\u6240\u793a&#xff1a;<\/p>\n<p>  #mermaid-svg-86QNj0kG3yvq5SRR {font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-86QNj0kG3yvq5SRR .error-icon{fill:#552222;}#mermaid-svg-86QNj0kG3yvq5SRR .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-86QNj0kG3yvq5SRR .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-86QNj0kG3yvq5SRR .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-86QNj0kG3yvq5SRR .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-86QNj0kG3yvq5SRR .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-86QNj0kG3yvq5SRR .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-86QNj0kG3yvq5SRR .marker{fill:#333333;stroke:#333333;}#mermaid-svg-86QNj0kG3yvq5SRR .marker.cross{stroke:#333333;}#mermaid-svg-86QNj0kG3yvq5SRR svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-86QNj0kG3yvq5SRR .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-86QNj0kG3yvq5SRR .cluster-label text{fill:#333;}#mermaid-svg-86QNj0kG3yvq5SRR .cluster-label span{color:#333;}#mermaid-svg-86QNj0kG3yvq5SRR .label text,#mermaid-svg-86QNj0kG3yvq5SRR span{fill:#333;color:#333;}#mermaid-svg-86QNj0kG3yvq5SRR .node rect,#mermaid-svg-86QNj0kG3yvq5SRR .node circle,#mermaid-svg-86QNj0kG3yvq5SRR .node ellipse,#mermaid-svg-86QNj0kG3yvq5SRR .node polygon,#mermaid-svg-86QNj0kG3yvq5SRR .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-86QNj0kG3yvq5SRR .node .label{text-align:center;}#mermaid-svg-86QNj0kG3yvq5SRR .node.clickable{cursor:pointer;}#mermaid-svg-86QNj0kG3yvq5SRR .arrowheadPath{fill:#333333;}#mermaid-svg-86QNj0kG3yvq5SRR .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-86QNj0kG3yvq5SRR .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-86QNj0kG3yvq5SRR .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-86QNj0kG3yvq5SRR .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-86QNj0kG3yvq5SRR .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-86QNj0kG3yvq5SRR .cluster text{fill:#333;}#mermaid-svg-86QNj0kG3yvq5SRR .cluster span{color:#333;}#mermaid-svg-86QNj0kG3yvq5SRR div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-86QNj0kG3yvq5SRR :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;} <\/p>\n<p>         <span id=\"L-L-A-B\" class=\"edgeLabel L-LS-A&#039; L-LE-B\"><\/span> <\/p>\n<p>         <span id=\"L-L-B-C\" class=\"edgeLabel L-LS-B&#039; L-LE-C\"><\/span> <\/p>\n<p>         <span id=\"L-L-C-D\" class=\"edgeLabel L-LS-C&#039; L-LE-D\"><\/span> <\/p>\n<p>         <span id=\"L-L-D-E\" class=\"edgeLabel L-LS-D&#039; L-LE-E\"><\/span> <\/p>\n<p>         <span id=\"L-L-E-F\" class=\"edgeLabel L-LS-E&#039; L-LE-F\"><\/span> <\/p>\n<p>         <span id=\"L-L-F-G\" class=\"edgeLabel L-LS-F&#039; L-LE-G\"><\/span> <\/p>\n<p>         <span id=\"L-L-G-H\" class=\"edgeLabel L-LS-G&#039; L-LE-H\"><\/span> <\/p>\n<p>         <span id=\"L-L-H-I\" class=\"edgeLabel L-LS-H&#039; L-LE-I\"><\/span> <\/p>\n<p>         <span id=\"L-L-I-J\" class=\"edgeLabel L-LS-I&#039; L-LE-J\"><\/span> <\/p>\n<p>         <span id=\"L-L-J-E\" class=\"edgeLabel L-LS-J&#039; L-LE-E\"><\/span> <\/p>\n<p>         <span id=\"L-L-E-K\" class=\"edgeLabel L-LS-E&#039; L-LE-K\"><\/span> <\/p>\n<p>         <span id=\"L-L-K-L\" class=\"edgeLabel L-LS-K&#039; L-LE-L\"><\/span> <\/p>\n<p>           \u5f00\u59cb <\/p>\n<p>           \u521d\u59cb\u5316RTSP\u670d\u52a1\u5668 <\/p>\n<p>           \u521b\u5efa\u5a92\u4f53\u4f1a\u8bdd\u5e76\u7ed1\u5b9aH264\u6e90 <\/p>\n<p>           \u914d\u7f6eFFmpeg\u8f6c\u6362\u548c\u7f16\u7801\u5668 <\/p>\n<p>           \u8fdb\u5165\u4e3b\u5faa\u73af <\/p>\n<p>           \u751f\u6210\u6d4b\u8bd5\u56fe\u50cf <\/p>\n<p>           BGR\u8f6cNV12 <\/p>\n<p>           H264\u7f16\u7801 <\/p>\n<p>           \u63a8\u9001RTSP\u6570\u636e <\/p>\n<p>           \u663e\u793a\u672c\u5730\u9884\u89c8 <\/p>\n<p>           \u5faa\u73af\u76f4\u5230\u9000\u51fa? <\/p>\n<p>           \u91ca\u653e\u8d44\u6e90 <\/p>\n<h3>3.2 \u4ee3\u7801\u8be6\u89e3<\/h3>\n<p><span class=\"token comment\">\/* \u5934\u6587\u4ef6\u5f15\u5165 *\/<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;fstream&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;iostream&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;queue&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;mutex&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;atomic&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;thread&gt;<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;winsock2.h&gt;<\/span>          <span class=\"token comment\">\/\/ Windows\u7f51\u7edc\u5e93<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;iphlpapi.h&gt;<\/span>          <span class=\"token comment\">\/\/ IP\u8f85\u52a9\u5e93<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">pragma<\/span> <span class=\"token expression\"><span class=\"token function\">comment<\/span><span class=\"token punctuation\">(<\/span>lib<span class=\"token punctuation\">,<\/span> <\/span><span class=\"token string\">&#034;ws2_32.lib&#034;<\/span><span class=\"token expression\"><span class=\"token punctuation\">)<\/span>   <\/span><span class=\"token comment\">\/\/ \u94fe\u63a5Winsock\u5e93<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">pragma<\/span> <span class=\"token expression\"><span class=\"token function\">comment<\/span><span class=\"token punctuation\">(<\/span>lib<span class=\"token punctuation\">,<\/span> <\/span><span class=\"token string\">&#034;iphlpapi.lib&#034;<\/span><span class=\"token expression\"><span class=\"token punctuation\">)<\/span> <\/span><span class=\"token comment\">\/\/ \u94fe\u63a5IP\u8f85\u52a9\u5e93<\/span><\/span><\/p>\n<p><span class=\"token keyword\">extern<\/span> <span class=\"token string\">&#034;C&#034;<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token comment\">\/\/ FFmpeg\u5e93\u4f7f\u7528C\u8bed\u8a00\u63a5\u53e3<\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;libavcodec\/avcodec.h&gt;<\/span>   <span class=\"token comment\">\/\/ \u97f3\u89c6\u9891\u7f16\u89e3\u7801<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;libavformat\/avformat.h&gt;<\/span> <span class=\"token comment\">\/\/ \u5a92\u4f53\u683c\u5f0f\u5904\u7406<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&lt;libswscale\/swscale.h&gt;<\/span>   <span class=\"token comment\">\/\/ \u56fe\u50cf\u7f29\u653e\u4e0e\u683c\u5f0f\u8f6c\u6362<\/span><\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&#034;xop\/RtspServer.h&#034;<\/span>   <span class=\"token comment\">\/\/ RTSP\u670d\u52a1\u5668\u5e93<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&#034;net\/Timer.h&#034;<\/span>        <span class=\"token comment\">\/\/ \u5b9a\u65f6\u5668<\/span><\/span><br \/>\n<span class=\"token macro property\"><span class=\"token directive-hash\">#<\/span><span class=\"token directive keyword\">include<\/span> <span class=\"token string\">&#034;opencv2\/opencv.hpp&#034;<\/span> <span class=\"token comment\">\/\/ OpenCV\u56fe\u50cf\u5904\u7406\u5e93<\/span><\/span><br \/>\n<span class=\"token keyword\">int<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/* RTSP\u670d\u52a1\u914d\u7f6e *\/<\/span><br \/>\n    std<span class=\"token double-colon punctuation\">::<\/span>string suffix <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;live&#034;<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6d41\u540e\u7f00<\/span><br \/>\n    std<span class=\"token double-colon punctuation\">::<\/span>string ip <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;192.168.1.14&#034;<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u670d\u52a1\u5668IP<\/span><br \/>\n    std<span class=\"token double-colon punctuation\">::<\/span>string port <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;554&#034;<\/span><span class=\"token punctuation\">;<\/span>        <span class=\"token comment\">\/\/ RTSP\u9ed8\u8ba4\u7aef\u53e3<\/span><br \/>\n    std<span class=\"token double-colon punctuation\">::<\/span>string rtsp_url <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;rtsp:\/\/&#034;<\/span> <span class=\"token operator\">&#043;<\/span> ip <span class=\"token operator\">&#043;<\/span> <span class=\"token string\">&#034;:&#034;<\/span> <span class=\"token operator\">&#043;<\/span> port <span class=\"token operator\">&#043;<\/span> <span class=\"token string\">&#034;\/&#034;<\/span> <span class=\"token operator\">&#043;<\/span> suffix<span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5b8c\u6574URL<\/span><\/p>\n<p>    <span class=\"token comment\">\/* \u521d\u59cb\u5316\u4e8b\u4ef6\u5faa\u73af\u548cRTSP\u670d\u52a1\u5668 *\/<\/span><br \/>\n    std<span class=\"token double-colon punctuation\">::<\/span>shared_ptr<span class=\"token operator\">&lt;<\/span>xop<span class=\"token double-colon punctuation\">::<\/span>EventLoop<span class=\"token operator\">&gt;<\/span> <span class=\"token function\">event_loop<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">new<\/span> xop<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">EventLoop<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u521b\u5efa\u4e8b\u4ef6\u5faa\u73af<\/span><br \/>\n    std<span class=\"token double-colon punctuation\">::<\/span>shared_ptr<span class=\"token operator\">&lt;<\/span>xop<span class=\"token double-colon punctuation\">::<\/span>RtspServer<span class=\"token operator\">&gt;<\/span> server <span class=\"token operator\">&#061;<\/span> xop<span class=\"token double-colon punctuation\">::<\/span><span class=\"token class-name\">RtspServer<\/span><span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">Create<\/span><span class=\"token punctuation\">(<\/span>event_loop<span class=\"token punctuation\">.<\/span><span class=\"token function\">get<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u521b\u5efaRTSP\u670d\u52a1\u5668\u5b9e\u4f8b<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>server<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">Start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;0.0.0.0&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token function\">atoi<\/span><span class=\"token punctuation\">(<\/span>port<span class=\"token punctuation\">.<\/span><span class=\"token function\">c_str<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token comment\">\/\/ \u542f\u52a8\u670d\u52a1\u5668&#xff08;\u76d1\u542c\u6240\u6709\u7f51\u5361&#xff09;<\/span><br \/>\n        <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;RTSP Server\u542f\u52a8\u5931\u8d25&#xff0c;\u7aef\u53e3&#xff1a;%s\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> port<span class=\"token punctuation\">.<\/span><span class=\"token function\">c_str<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token comment\">\/* \u521b\u5efa\u5a92\u4f53\u4f1a\u8bdd *\/<\/span><br \/>\n    xop<span class=\"token double-colon punctuation\">::<\/span>MediaSession<span class=\"token operator\">*<\/span> session <span class=\"token operator\">&#061;<\/span> xop<span class=\"token double-colon punctuation\">::<\/span><span class=\"token class-name\">MediaSession<\/span><span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">CreateNew<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;live&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u521b\u5efa\u4f1a\u8bdd<\/span><br \/>\n    session<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">AddSource<\/span><span class=\"token punctuation\">(<\/span>xop<span class=\"token double-colon punctuation\">::<\/span>channel_0<span class=\"token punctuation\">,<\/span> xop<span class=\"token double-colon punctuation\">::<\/span><span class=\"token class-name\">H264Source<\/span><span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">CreateNew<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6dfb\u52a0H264\u6e90<\/span><\/p>\n<p>    <span class=\"token comment\">\/\/ \u5ba2\u6237\u7aef\u8fde\u63a5\/\u65ad\u5f00\u56de\u8c03<\/span><br \/>\n    session<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">AddNotifyConnectedCallback<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">(<\/span>xop<span class=\"token double-colon punctuation\">::<\/span>MediaSessionId sessionId<span class=\"token punctuation\">,<\/span> std<span class=\"token double-colon punctuation\">::<\/span>string peer_ip<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">uint16_t<\/span> peer_port<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token function\">printf<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u5ba2\u6237\u7aef\u8fde\u63a5: IP&#061;%s \u7aef\u53e3&#061;%hu\\\\n&#034;<\/span><span class=\"token punctuation\">,<\/span> peer_ip<span class=\"token punctuation\">.<\/span><span class=\"token function\">c_str<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> peer_port<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    session<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">AddNotifyDisconnectedCallback<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token comment\">\/* \u7c7b\u4f3c\u5904\u7406\u65ad\u5f00\u4e8b\u4ef6 *\/<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    xop<span class=\"token double-colon punctuation\">::<\/span>MediaSessionId session_id <span class=\"token operator\">&#061;<\/span> server<span class=\"token operator\">-&gt;<\/span><span class=\"token function\">AddSession<\/span><span class=\"token punctuation\">(<\/span>session<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6ce8\u518c\u4f1a\u8bdd<\/span><br \/>\n    std<span class=\"token double-colon punctuation\">::<\/span>cout <span class=\"token operator\">&lt;&lt;<\/span> <span class=\"token string\">&#034;\u64ad\u653e\u5730\u5740: &#034;<\/span> <span class=\"token operator\">&lt;&lt;<\/span> rtsp_url <span class=\"token operator\">&lt;&lt;<\/span> std<span class=\"token double-colon punctuation\">::<\/span>endl<span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/* \u89c6\u9891\u53c2\u6570\u914d\u7f6e *\/<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> <span class=\"token keyword\">int<\/span> frame_width <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">512<\/span><span class=\"token punctuation\">,<\/span> frame_height <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">512<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token comment\">\/* FFmpeg\u56fe\u50cf\u8f6c\u6362\u914d\u7f6e *\/<\/span><br \/>\n    SwsContext<span class=\"token operator\">*<\/span> sws_ctx <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">sws_getContext<\/span><span class=\"token punctuation\">(<\/span> <span class=\"token comment\">\/\/ \u521b\u5efa\u989c\u8272\u7a7a\u95f4\u8f6c\u6362\u4e0a\u4e0b\u6587<\/span><br \/>\n        frame_width<span class=\"token punctuation\">,<\/span> frame_height<span class=\"token punctuation\">,<\/span> AV_PIX_FMT_BGR24<span class=\"token punctuation\">,<\/span>  <span class=\"token comment\">\/\/ \u8f93\u5165\u53c2\u6570&#xff08;BGR\u683c\u5f0f&#xff09;<\/span><br \/>\n        frame_width<span class=\"token punctuation\">,<\/span> frame_height<span class=\"token punctuation\">,<\/span> AV_PIX_FMT_NV12<span class=\"token punctuation\">,<\/span>   <span class=\"token comment\">\/\/ \u8f93\u51fa\u53c2\u6570&#xff08;NV12\u683c\u5f0f&#xff09;<\/span><br \/>\n        SWS_BILINEAR<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">nullptr<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">nullptr<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">nullptr<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>     <span class=\"token comment\">\/\/ \u8f6c\u6362\u7b97\u6cd5<\/span><\/p>\n<p>    AVFrame<span class=\"token operator\">*<\/span> sws_frame <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">av_frame_alloc<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5206\u914d\u8f6c\u6362\u540e\u7684\u5e27\u5185\u5b58<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230;&#xff08;\u8bbe\u7f6esws_frame\u53c2\u6570\u5e76\u5206\u914d\u7f13\u51b2\u533a&#xff09;<\/span><\/p>\n<p>    <span class=\"token comment\">\/* H264\u7f16\u7801\u5668\u521d\u59cb\u5316 *\/<\/span><br \/>\n    <span class=\"token keyword\">const<\/span> AVCodec<span class=\"token operator\">*<\/span> encoder <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">avcodec_find_encoder<\/span><span class=\"token punctuation\">(<\/span>AV_CODEC_ID_H264<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u67e5\u627e\u7f16\u7801\u5668<\/span><br \/>\n    AVCodecContext<span class=\"token operator\">*<\/span> enc_ctx <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">avcodec_alloc_context3<\/span><span class=\"token punctuation\">(<\/span>encoder<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u521b\u5efa\u7f16\u7801\u5668\u4e0a\u4e0b\u6587<\/span><br \/>\n    enc_ctx<span class=\"token operator\">-&gt;<\/span>width <span class=\"token operator\">&#061;<\/span> frame_width<span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u5206\u8fa8\u7387<\/span><br \/>\n    enc_ctx<span class=\"token operator\">-&gt;<\/span>height <span class=\"token operator\">&#061;<\/span> frame_height<span class=\"token punctuation\">;<\/span><br \/>\n    enc_ctx<span class=\"token operator\">-&gt;<\/span>time_base <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">25<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u65f6\u95f4\u57fa&#xff08;25FPS&#xff09;<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230;&#xff08;\u5176\u4ed6\u7f16\u7801\u53c2\u6570\u8bbe\u7f6e&#xff09;<\/span><br \/>\n    <span class=\"token function\">avcodec_open2<\/span><span class=\"token punctuation\">(<\/span>enc_ctx<span class=\"token punctuation\">,<\/span> encoder<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">nullptr<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u6253\u5f00\u7f16\u7801\u5668<\/span><\/p>\n<p>    <span class=\"token comment\">\/* \u4e3b\u5faa\u73af *\/<\/span><br \/>\n    <span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token boolean\">true<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u751f\u6210\u6d4b\u8bd5\u56fe\u50cf&#xff08;\u7eff\u8272\u5706\u5708&#xff09;<\/span><br \/>\n        cv<span class=\"token double-colon punctuation\">::<\/span>Mat frame <span class=\"token operator\">&#061;<\/span> cv<span class=\"token double-colon punctuation\">::<\/span><span class=\"token class-name\">Mat<\/span><span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">zeros<\/span><span class=\"token punctuation\">(<\/span>frame_height<span class=\"token punctuation\">,<\/span> frame_width<span class=\"token punctuation\">,<\/span> CV_8UC3<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ &#8230;&#xff08;\u7ed8\u5236\u52a8\u6001\u5706\u5708&#xff09;<\/span><\/p>\n<p>        <span class=\"token comment\">\/* BGR\u8f6cNV12 *\/<\/span><br \/>\n        <span class=\"token function\">sws_scale<\/span><span class=\"token punctuation\">(<\/span>sws_ctx<span class=\"token punctuation\">,<\/span> bgr_frame<span class=\"token operator\">-&gt;<\/span>data<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">,<\/span> sws_frame<span class=\"token operator\">-&gt;<\/span>data<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <\/p>\n<p>        <span class=\"token comment\">\/* H264\u7f16\u7801 *\/<\/span><br \/>\n        <span class=\"token function\">avcodec_send_frame<\/span><span class=\"token punctuation\">(<\/span>enc_ctx<span class=\"token punctuation\">,<\/span> sws_frame<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u53d1\u9001\u5e27\u5230\u7f16\u7801\u5668<\/span><br \/>\n        <span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token function\">avcodec_receive_packet<\/span><span class=\"token punctuation\">(<\/span>enc_ctx<span class=\"token punctuation\">,<\/span> enc_pkt<span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#061;&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span> <span class=\"token comment\">\/\/ \u63a5\u6536\u7f16\u7801\u540e\u7684\u5305<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u5c01\u88c5\u89c6\u9891\u5e27\u5e76\u63a8\u9001\u5230RTSP\u670d\u52a1\u5668<\/span><br \/>\n            xop<span class=\"token double-colon punctuation\">::<\/span>AVFrame videoFrame <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token comment\">\/\/ &#8230;&#xff08;\u586b\u5145\u6570\u636e\u5e76\u8c03\u7528PushFrame&#xff09;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><\/p>\n<p>        cv<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">imshow<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;server&#034;<\/span><span class=\"token punctuation\">,<\/span> frame<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u663e\u793a\u672c\u5730\u9884\u89c8<\/span><br \/>\n        cv<span class=\"token double-colon punctuation\">::<\/span><span class=\"token function\">waitKey<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">3<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u7b49\u5f853ms<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><\/p>\n<p>    <span class=\"token comment\">\/* \u8d44\u6e90\u91ca\u653e *\/<\/span><br \/>\n    <span class=\"token function\">av_packet_free<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&amp;<\/span>enc_pkt<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token function\">av_frame_free<\/span><span class=\"token punctuation\">(<\/span><span class=\"token operator\">&amp;<\/span>sws_frame<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ &#8230;&#xff08;\u5176\u4ed6\u8d44\u6e90\u6e05\u7406&#xff09;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h3>3.3\u3001\u5173\u952eAPI\u8bf4\u660e\u8868\u683c<\/h3>\n<h4>3.3.1. sws_getContext()<\/h4>\n<table>\n<tr>\u53c2\u6570\u7c7b\u578b\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>srcW<\/td>\n<td>int<\/td>\n<td>\u6e90\u56fe\u50cf\u5bbd\u5ea6<\/td>\n<\/tr>\n<tr>\n<td>srcH<\/td>\n<td>int<\/td>\n<td>\u6e90\u56fe\u50cf\u9ad8\u5ea6<\/td>\n<\/tr>\n<tr>\n<td>srcFormat<\/td>\n<td>AVPixelFormat<\/td>\n<td>\u6e90\u50cf\u7d20\u683c\u5f0f&#xff08;\u5982AV_PIX_FMT_BGR24&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>dstW<\/td>\n<td>int<\/td>\n<td>\u76ee\u6807\u56fe\u50cf\u5bbd\u5ea6<\/td>\n<\/tr>\n<tr>\n<td>dstH<\/td>\n<td>int<\/td>\n<td>\u76ee\u6807\u56fe\u50cf\u9ad8\u5ea6<\/td>\n<\/tr>\n<tr>\n<td>dstFormat<\/td>\n<td>AVPixelFormat<\/td>\n<td>\u76ee\u6807\u50cf\u7d20\u683c\u5f0f&#xff08;\u5982AV_PIX_FMT_NV12&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>flags<\/td>\n<td>int<\/td>\n<td>\u7f29\u653e\u7b97\u6cd5&#xff08;\u5982SWS_BILINEAR&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>srcFilter<\/td>\n<td>SwsFilter*<\/td>\n<td>\u6e90\u6ee4\u6ce2\u5668&#xff08;\u901a\u5e38\u4e3anullptr&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>dstFilter<\/td>\n<td>SwsFilter*<\/td>\n<td>\u76ee\u6807\u6ee4\u6ce2\u5668&#xff08;\u901a\u5e38\u4e3anullptr&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>param<\/td>\n<td>const double*<\/td>\n<td>\u7b97\u6cd5\u53c2\u6570&#xff08;\u901a\u5e38\u4e3anullptr&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u529f\u80fd<\/td>\n<td>\u521b\u5efa\u56fe\u50cf\u7f29\u653e\/\u683c\u5f0f\u8f6c\u6362\u4e0a\u4e0b\u6587<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u8fd4\u56de\u503c<\/td>\n<td>SwsContext*<\/td>\n<td>\u8f6c\u6362\u4e0a\u4e0b\u6587\u53e5\u67c4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>3.3. 2. avcodec_find_encoder()<\/h4>\n<table>\n<tr>\u53c2\u6570\u7c7b\u578b\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>id<\/td>\n<td>enum AVCodecID<\/td>\n<td>\u7f16\u7801\u5668ID&#xff08;\u5982AV_CODEC_ID_H264&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u529f\u80fd<\/td>\n<td>\u6839\u636eID\u67e5\u627e\u5df2\u6ce8\u518c\u7684\u7f16\u7801\u5668<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u8fd4\u56de\u503c<\/td>\n<td>const AVCodec*<\/td>\n<td>\u7f16\u7801\u5668\u6307\u9488&#xff08;\u5931\u8d25\u8fd4\u56deNULL&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>3.3.3. avcodec_open2()<\/h4>\n<table>\n<tr>\u53c2\u6570\u7c7b\u578b\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>avctx<\/td>\n<td>AVCodecContext*<\/td>\n<td>\u7f16\u7801\u5668\u4e0a\u4e0b\u6587<\/td>\n<\/tr>\n<tr>\n<td>codec<\/td>\n<td>const AVCodec*<\/td>\n<td>\u76ee\u6807\u7f16\u7801\u5668<\/td>\n<\/tr>\n<tr>\n<td>options<\/td>\n<td>AVDictionary**<\/td>\n<td>\u9644\u52a0\u9009\u9879&#xff08;\u901a\u5e38\u4e3anullptr&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u529f\u80fd<\/td>\n<td>\u4f7f\u7528\u6307\u5b9a\u7f16\u7801\u5668\u521d\u59cb\u5316\u4e0a\u4e0b\u6587<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>\u8fd4\u56de\u503c<\/td>\n<td>int<\/td>\n<td>0\u6210\u529f&#xff0c;\u8d1f\u6570\u9519\u8bef\u7801<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u56db\u3001\u6d4b\u8bd5<\/h2>\n<p>\u8fd0\u884c\u7a0b\u5e8f&#xff0c;\u4f7f\u7528VLC\u8fdb\u884c\u62c9\u6d41\u6d4b\u8bd5&#xff1a; <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418233640-6802e20871430.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/> \u5ef6\u65f6\u6709\u70b9\u5927&#xff0c;\u4f46\u662f&#xff0c;\u89c6\u9891\u6d41\u8fd8\u662f\u5f88\u7a33\u5b9a\u7684\u3002\u6709\u61c2\u7684\u5c0f\u4f19\u4f34&#xff0c;\u53ef\u4ee5\u5728\u8bc4\u8bba\u533a\u7559\u8a00&#xff0c;\u600e\u4e48\u89e3\u51b3\u8fd9\u4e2a\u5ef6\u65f6\u7684\u95ee\u9898\u3002<\/p>\n<h2>\u4e94\u3001\u5c0f\u7ed3<\/h2>\n<ul>\n<li>\u5bf9\u5c0f\u767d\u6765\u8bf4&#xff0c;\u5f00\u6e90\u5e93&#xff0c;\u9009\u62e9\u597d\u5165\u95e8\u7684&#xff0c;\u5c01\u88c5\u7a0b\u5ea6\u9ad8\u7684\u3002<\/li>\n<li>\u53ef\u4ee5\u505a\u4e0b\u4e00\u6b65\u4e86&#xff0c;\u5728\u5f00\u53d1\u677f\u5b8c\u6210RTSP\u6d41\u7684\u63a5\u6536\u548c\u89e3\u7801\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e8\u6b21\uff0c\u6536\u85cf20\u6b21\u3002\u672c\u6587\u76f8\u5173\u7684\u5168\u90e8\u6e90\u7801\u548cRtspSever\u5e93\uff0c\u6211\u5df2\u6253\u5305\u4e0a\u4f20\uff0c\u6b22\u8fce\u5927\u5bb6\u514d\u8d39\u4e0b\u8f7d\uff0c\u3002\u6bcf\u4e00\u4e2a\u5d4c\u5165\u5f0f\u89c6\u89c9\u7b97\u6cd5\u5de5\u7a0b\u5e08\uff0c\u90fd\u5e94\u8be5\u6709\u4e00\u5957\u5c5e\u4e8e\u81ea\u5df1\u7684\u7b97\u6cd5\u4eff\u771f\u548c\u6d4b\u8bd5\u73af\u5883\u3002\u53ef\u4ee5\u65b9\u4fbf\u5730\u8fdb\u884c\u89c6\u9891\u3001\u56fe\u50cf\u7b49\u7d20\u6750\u8fdb\u884c\u5728\u7ebf\u5bfc\u5165\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c55\u793a\u7b97\u6cd5\u7ed3\u679c\uff0c\u53ef\u4ee5\u5feb\u901f\u5730\u6a21\u62df\u5e94\u7528\u573a\u666f\uff0c\u8fdb\u884c\u7b97\u6cd5\u5f00\u53d1\u3002\u5728\u89c6\u9891\u3001\u56fe\u50cf\u6587\u4ef6\u7b49\u7d20\u6750\u7684\u5728\u7ebf\u5bfc\u5165\u6a21\u5757\uff0c\u642d\u5efa\u4e00\u4e2a\u5c5e\u4e8e\u81ea\u5df1\u7684RTSP\u670d\u52a1\u5668\uff0c\u662f\u4e00\u4e2a\u7406\u60f3\u7684\u9009\u62e9\u3002_ffmpeg rtsp server<\/p>\n","protected":false},"author":2,"featured_media":23355,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,213,1787,427,215],"topic":[],"class_list":["post-23358","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-c","tag-ffmpeg","tag-1787","tag-427","tag-215"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7b97\u6cd5\u4eff\u771f\u5e73\u53f0\u642d\u5efa1-FFMPEG+RtspSever\u5feb\u901f\u642d\u5efa\u4e00\u4e2aRTSP\u670d\u52a1\u5668 - \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\/23358.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7b97\u6cd5\u4eff\u771f\u5e73\u53f0\u642d\u5efa1-FFMPEG+RtspSever\u5feb\u901f\u642d\u5efa\u4e00\u4e2aRTSP\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e8\u6b21\uff0c\u6536\u85cf20\u6b21\u3002\u672c\u6587\u76f8\u5173\u7684\u5168\u90e8\u6e90\u7801\u548cRtspSever\u5e93\uff0c\u6211\u5df2\u6253\u5305\u4e0a\u4f20\uff0c\u6b22\u8fce\u5927\u5bb6\u514d\u8d39\u4e0b\u8f7d\uff0c\u3002\u6bcf\u4e00\u4e2a\u5d4c\u5165\u5f0f\u89c6\u89c9\u7b97\u6cd5\u5de5\u7a0b\u5e08\uff0c\u90fd\u5e94\u8be5\u6709\u4e00\u5957\u5c5e\u4e8e\u81ea\u5df1\u7684\u7b97\u6cd5\u4eff\u771f\u548c\u6d4b\u8bd5\u73af\u5883\u3002\u53ef\u4ee5\u65b9\u4fbf\u5730\u8fdb\u884c\u89c6\u9891\u3001\u56fe\u50cf\u7b49\u7d20\u6750\u8fdb\u884c\u5728\u7ebf\u5bfc\u5165\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c55\u793a\u7b97\u6cd5\u7ed3\u679c\uff0c\u53ef\u4ee5\u5feb\u901f\u5730\u6a21\u62df\u5e94\u7528\u573a\u666f\uff0c\u8fdb\u884c\u7b97\u6cd5\u5f00\u53d1\u3002\u5728\u89c6\u9891\u3001\u56fe\u50cf\u6587\u4ef6\u7b49\u7d20\u6750\u7684\u5728\u7ebf\u5bfc\u5165\u6a21\u5757\uff0c\u642d\u5efa\u4e00\u4e2a\u5c5e\u4e8e\u81ea\u5df1\u7684RTSP\u670d\u52a1\u5668\uff0c\u662f\u4e00\u4e2a\u7406\u60f3\u7684\u9009\u62e9\u3002_ffmpeg rtsp server\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/23358.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-18T23:36:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418233639-6802e207f35cd.png\" \/>\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=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/23358.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/23358.html\",\"name\":\"\u7b97\u6cd5\u4eff\u771f\u5e73\u53f0\u642d\u5efa1-FFMPEG+RtspSever\u5feb\u901f\u642d\u5efa\u4e00\u4e2aRTSP\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T23:36:41+00:00\",\"dateModified\":\"2025-04-18T23:36:41+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/23358.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/23358.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/23358.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7b97\u6cd5\u4eff\u771f\u5e73\u53f0\u642d\u5efa1-FFMPEG+RtspSever\u5feb\u901f\u642d\u5efa\u4e00\u4e2aRTSP\u670d\u52a1\u5668\"}]},{\"@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":"\u7b97\u6cd5\u4eff\u771f\u5e73\u53f0\u642d\u5efa1-FFMPEG+RtspSever\u5feb\u901f\u642d\u5efa\u4e00\u4e2aRTSP\u670d\u52a1\u5668 - \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\/23358.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7b97\u6cd5\u4eff\u771f\u5e73\u53f0\u642d\u5efa1-FFMPEG+RtspSever\u5feb\u901f\u642d\u5efa\u4e00\u4e2aRTSP\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.2k\u6b21\uff0c\u70b9\u8d5e8\u6b21\uff0c\u6536\u85cf20\u6b21\u3002\u672c\u6587\u76f8\u5173\u7684\u5168\u90e8\u6e90\u7801\u548cRtspSever\u5e93\uff0c\u6211\u5df2\u6253\u5305\u4e0a\u4f20\uff0c\u6b22\u8fce\u5927\u5bb6\u514d\u8d39\u4e0b\u8f7d\uff0c\u3002\u6bcf\u4e00\u4e2a\u5d4c\u5165\u5f0f\u89c6\u89c9\u7b97\u6cd5\u5de5\u7a0b\u5e08\uff0c\u90fd\u5e94\u8be5\u6709\u4e00\u5957\u5c5e\u4e8e\u81ea\u5df1\u7684\u7b97\u6cd5\u4eff\u771f\u548c\u6d4b\u8bd5\u73af\u5883\u3002\u53ef\u4ee5\u65b9\u4fbf\u5730\u8fdb\u884c\u89c6\u9891\u3001\u56fe\u50cf\u7b49\u7d20\u6750\u8fdb\u884c\u5728\u7ebf\u5bfc\u5165\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5c55\u793a\u7b97\u6cd5\u7ed3\u679c\uff0c\u53ef\u4ee5\u5feb\u901f\u5730\u6a21\u62df\u5e94\u7528\u573a\u666f\uff0c\u8fdb\u884c\u7b97\u6cd5\u5f00\u53d1\u3002\u5728\u89c6\u9891\u3001\u56fe\u50cf\u6587\u4ef6\u7b49\u7d20\u6750\u7684\u5728\u7ebf\u5bfc\u5165\u6a21\u5757\uff0c\u642d\u5efa\u4e00\u4e2a\u5c5e\u4e8e\u81ea\u5df1\u7684RTSP\u670d\u52a1\u5668\uff0c\u662f\u4e00\u4e2a\u7406\u60f3\u7684\u9009\u62e9\u3002_ffmpeg rtsp server","og_url":"https:\/\/www.wsisp.com\/helps\/23358.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T23:36:41+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418233639-6802e207f35cd.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/23358.html","url":"https:\/\/www.wsisp.com\/helps\/23358.html","name":"\u7b97\u6cd5\u4eff\u771f\u5e73\u53f0\u642d\u5efa1-FFMPEG+RtspSever\u5feb\u901f\u642d\u5efa\u4e00\u4e2aRTSP\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T23:36:41+00:00","dateModified":"2025-04-18T23:36:41+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/23358.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/23358.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/23358.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7b97\u6cd5\u4eff\u771f\u5e73\u53f0\u642d\u5efa1-FFMPEG+RtspSever\u5feb\u901f\u642d\u5efa\u4e00\u4e2aRTSP\u670d\u52a1\u5668"}]},{"@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\/23358","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=23358"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/23358\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/23355"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=23358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=23358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=23358"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=23358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}