{"id":77147,"date":"2026-02-24T01:17:21","date_gmt":"2026-02-23T17:17:21","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/77147.html"},"modified":"2026-02-24T01:17:21","modified_gmt":"2026-02-23T17:17:21","slug":"rtmp%e5%8d%8f%e8%ae%ae%e5%ae%9e%e6%88%98%ef%bc%9a%e4%bb%8e%e9%9b%b6%e6%90%ad%e5%bb%ba%e7%9b%b4%e6%92%ad%e6%8e%a8%e6%b5%81%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%88%e5%90%abwireshark%e6%8a%93%e5%8c%85","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/77147.html","title":{"rendered":"RTMP\u534f\u8bae\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668\uff08\u542bWireshark\u6293\u5305\u5206\u6790\uff09"},"content":{"rendered":"<h2>RTMP\u534f\u8bae\u5b9e\u6218&#xff1a;\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668&#xff08;\u542bWireshark\u6293\u5305\u5206\u6790&#xff09;<\/h2>\n<p>\u76f4\u64ad\u6280\u672f\u5df2\u7ecf\u6210\u4e3a\u4e92\u8054\u7f51\u5185\u5bb9\u5206\u53d1\u7684\u6838\u5fc3\u5f62\u6001\u4e4b\u4e00&#xff0c;\u800cRTMP\u534f\u8bae\u4f5c\u4e3a\u76f4\u64ad\u9886\u57df\u7684\u57fa\u77f3\u534f\u8bae&#xff0c;\u81f3\u4eca\u4ecd\u5728\u5404\u7c7b\u76f4\u64ad\u573a\u666f\u4e2d\u53d1\u6325\u7740\u5173\u952e\u4f5c\u7528\u3002\u672c\u6587\u5c06\u5e26\u60a8\u6df1\u5165RTMP\u534f\u8bae\u7684\u6280\u672f\u7ec6\u8282&#xff0c;\u5e76\u901a\u8fc7\u5b9e\u6218\u6f14\u793a\u5982\u4f55\u4ece\u96f6\u642d\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668&#xff0c;\u540c\u65f6\u7ed3\u5408Wireshark\u6293\u5305\u5de5\u5177&#xff0c;\u9010\u5e27\u89e3\u6790\u534f\u8bae\u4ea4\u4e92\u8fc7\u7a0b\u3002<\/p>\n<h3>1. RTMP\u534f\u8bae\u6280\u672f\u89e3\u6790<\/h3>\n<p>RTMP&#xff08;Real-Time Messaging Protocol&#xff09;\u662fAdobe\u516c\u53f8\u5f00\u53d1\u7684\u4e13\u6709\u534f\u8bae&#xff0c;\u6700\u521d\u7528\u4e8eFlash\u5e73\u53f0\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u97f3\u89c6\u9891\u548c\u6570\u636e\u4f20\u8f93\u3002\u5c3d\u7ba1Flash\u6280\u672f\u5df2\u9000\u51fa\u5386\u53f2\u821e\u53f0&#xff0c;\u4f46RTMP\u534f\u8bae\u56e0\u5176\u6210\u719f\u7a33\u5b9a\u3001\u4f4e\u5ef6\u8fdf\u7684\u7279\u6027&#xff0c;\u4ecd\u7136\u662f\u76f4\u64ad\u63a8\u6d41\u9886\u57df\u7684\u4e8b\u5b9e\u6807\u51c6\u3002<\/p>\n<h4>1.1 \u534f\u8bae\u6808\u67b6\u6784<\/h4>\n<p>RTMP\u534f\u8bae\u6808\u91c7\u7528\u5206\u5c42\u8bbe\u8ba1&#xff1a;<\/p>\n<ul>\n<li>\u4f20\u8f93\u5c42&#xff1a;\u57fa\u4e8eTCP\u534f\u8bae&#xff0c;\u9ed8\u8ba4\u4f7f\u75281935\u7aef\u53e3<\/li>\n<li>\u4f1a\u8bdd\u5c42&#xff1a;\u8d1f\u8d23\u8fde\u63a5\u5efa\u7acb\u548c\u7ef4\u62a4<\/li>\n<li>\u6d88\u606f\u5c42&#xff1a;\u5904\u7406\u4e0d\u540c\u7c7b\u578b\u7684\u5a92\u4f53\u548c\u63a7\u5236\u6d88\u606f<\/li>\n<li>\u5757\u6d41\u5c42&#xff1a;\u5c06\u6d88\u606f\u5206\u5757\u4f20\u8f93<\/li>\n<\/ul>\n<p>\u5173\u952e\u6570\u636e\u7ed3\u6784\u5173\u7cfb&#xff1a;<\/p>\n<p>Message \u2192 \u5206\u5272\u4e3a \u2192 Chunk \u2192 \u901a\u8fc7 \u2192 Chunk Stream\u4f20\u8f93<\/p>\n<h4>1.2 \u6d88\u606f\u7c7b\u578b\u4e0e\u683c\u5f0f<\/h4>\n<p>RTMP\u5b9a\u4e49\u4e86\u5341\u4f59\u79cd\u6d88\u606f\u7c7b\u578b&#xff0c;\u4e3b\u8981\u5206\u4e3a\u4e09\u7c7b&#xff1a;<\/p>\n<table>\n<tr>\u7c7b\u578bID\u6d88\u606f\u7c7b\u578b\u7528\u9014\u63cf\u8ff0<\/tr>\n<tbody>\n<tr>\n<td>1-7<\/td>\n<td>\u534f\u8bae\u63a7\u5236\u6d88\u606f<\/td>\n<td>\u8bbe\u7f6e\u5757\u5927\u5c0f\u3001\u786e\u8ba4\u7a97\u53e3\u7b49<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>\u97f3\u9891\u6570\u636e<\/td>\n<td>\u4f20\u8f93AAC\/MP3\u7b49\u7f16\u7801\u7684\u97f3\u9891\u5e27<\/td>\n<\/tr>\n<tr>\n<td>9<\/td>\n<td>\u89c6\u9891\u6570\u636e<\/td>\n<td>\u4f20\u8f93H.264\/HEVC\u7b49\u7f16\u7801\u7684\u89c6\u9891\u5e27<\/td>\n<\/tr>\n<tr>\n<td>15-20<\/td>\n<td>AMF\u7f16\u7801\u547d\u4ee4<\/td>\n<td>\u64ad\u653e\u3001\u6682\u505c\u7b49\u63a7\u5236\u6307\u4ee4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5178\u578b\u6d88\u606f\u5934\u7ed3\u6784&#xff1a;<\/p>\n<p>struct MessageHeader {<br \/>\n    uint32_t timestamp;     \/\/ \u65f6\u95f4\u6233&#xff08;\u6beb\u79d2&#xff09;<br \/>\n    uint32_t length;        \/\/ \u8d1f\u8f7d\u957f\u5ea6<br \/>\n    uint8_t type_id;        \/\/ \u6d88\u606f\u7c7b\u578b<br \/>\n    uint32_t stream_id;     \/\/ \u6d41ID<br \/>\n};<\/p>\n<h3>2. \u73af\u5883\u642d\u5efa\u4e0e\u5de5\u5177\u51c6\u5907<\/h3>\n<h4>2.1 \u5f00\u53d1\u73af\u5883\u914d\u7f6e<\/h4>\n<p>\u63a8\u8350\u4f7f\u7528Linux\u7cfb\u7edf\u8fdb\u884c\u5f00\u53d1\u6d4b\u8bd5&#xff0c;\u4ee5\u4e0b\u662fUbuntu\u4e0b\u7684\u73af\u5883\u51c6\u5907&#xff1a;<\/p>\n<p># \u5b89\u88c5\u7f16\u8bd1\u5de5\u5177\u548c\u4f9d\u8d56\u5e93<br \/>\nsudo apt update<br \/>\nsudo apt install -y build-essential git pkg-config<br \/>\nsudo apt install -y libssl-dev zlib1g-dev libpcre3-dev<\/p>\n<p># \u5b89\u88c5Wireshark\u6293\u5305\u5de5\u5177<br \/>\nsudo apt install -y wireshark<br \/>\nsudo usermod -aG wireshark $(whoami)  # \u5f53\u524d\u7528\u6237\u52a0\u5165wireshark\u7ec4<\/p>\n<p># \u5b89\u88c5FFmpeg\u5de5\u5177\u94fe<br \/>\nsudo apt install -y ffmpeg<\/p>\n<h4>2.2 RTMP\u670d\u52a1\u5668\u9009\u578b<\/h4>\n<p>\u4e3b\u6d41\u5f00\u6e90RTMP\u670d\u52a1\u5668\u5bf9\u6bd4&#xff1a;<\/p>\n<table>\n<tr>\u670d\u52a1\u5668\u8bed\u8a00\u7279\u70b9\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>Nginx-rtmp<\/td>\n<td>C<\/td>\n<td>\u8f7b\u91cf\u7ea7\u3001\u9ad8\u5e76\u53d1<\/td>\n<td>\u4e2d\u5c0f\u89c4\u6a21\u76f4\u64ad<\/td>\n<\/tr>\n<tr>\n<td>SRS<\/td>\n<td>C&#043;&#043;<\/td>\n<td>\u529f\u80fd\u4e30\u5bcc\u3001\u652f\u6301\u96c6\u7fa4<\/td>\n<td>\u4f01\u4e1a\u7ea7\u76f4\u64ad<\/td>\n<\/tr>\n<tr>\n<td>Node-Media-Server<\/td>\n<td>JavaScript<\/td>\n<td>\u5f00\u53d1\u4fbf\u6377\u3001\u6613\u6269\u5c55<\/td>\n<td>\u5feb\u901f\u539f\u578b\u5f00\u53d1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u672c\u6587\u9009\u7528Nginx-rtmp\u6a21\u5757\u4f5c\u4e3a\u6f14\u793a&#xff1a;<\/p>\n<p># \u7f16\u8bd1\u5b89\u88c5Nginx with RTMP\u6a21\u5757<br \/>\ngit clone https:\/\/github.com\/arut\/nginx-rtmp-module.git<br \/>\nwget http:\/\/nginx.org\/download\/nginx-1.21.6.tar.gz<br \/>\ntar zxf nginx-1.21.6.tar.gz<br \/>\ncd nginx-1.21.6<\/p>\n<p>.\/configure &#8211;add-module&#061;..\/nginx-rtmp-module \\\\<br \/>\n            &#8211;with-http_ssl_module<br \/>\nmake -j$(nproc)<br \/>\nsudo make install<\/p>\n<h3>3. RTMP\u534f\u8bae\u4ea4\u4e92\u5168\u6d41\u7a0b\u89e3\u6790<\/h3>\n<h4>3.1 \u63e1\u624b\u8fc7\u7a0b&#xff08;Handshake&#xff09;<\/h4>\n<p>RTMP\u8fde\u63a5\u5fc5\u987b\u4ece\u63e1\u624b\u5f00\u59cb&#xff0c;\u91c7\u7528\u4e09\u9636\u6bb5\u63e1\u624b\u673a\u5236&#xff1a;<\/p>\n<li>\n<p>\u5ba2\u6237\u7aef\u53d1\u9001C0&#043;C1&#xff1a;<\/p>\n<ul>\n<li>C0&#xff1a;1\u5b57\u8282&#xff0c;\u5305\u542bRTMP\u7248\u672c\u53f7&#xff08;\u901a\u5e38\u4e3a3&#xff09;<\/li>\n<li>C1&#xff1a;1536\u5b57\u8282\u968f\u673a\u6570\u636e<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u670d\u52a1\u7aef\u56de\u5e94S0&#043;S1&#043;S2&#xff1a;<\/p>\n<ul>\n<li>S0&#xff1a;1\u5b57\u8282\u7248\u672c\u786e\u8ba4<\/li>\n<li>S1&#xff1a;1536\u5b57\u8282\u968f\u673a\u6570\u636e<\/li>\n<li>S2&#xff1a;\u6839\u636eC1\u8ba1\u7b97\u7684\u6821\u9a8c\u6570\u636e<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5ba2\u6237\u7aef\u53d1\u9001C2&#xff1a;<\/p>\n<ul>\n<li>\u6839\u636eS1\u8ba1\u7b97\u7684\u6821\u9a8c\u6570\u636e<\/li>\n<\/ul>\n<\/li>\n<p>Wireshark\u8fc7\u6ee4\u8868\u8fbe\u5f0f&#xff1a;<\/p>\n<p>tcp.port &#061;&#061; 1935 &amp;&amp; rtmp<\/p>\n<p>\u5173\u952e\u6293\u5305\u5b57\u6bb5\u5206\u6790&#xff1a;<\/p>\n<p>RTMP Handshake Type: 0x03 (Version 3)<br \/>\nTimestamp: 0 (for C0\/S0)<br \/>\nRandom Data: 1536 bytes (for C1\/S1)<\/p>\n<h4>3.2 \u8fde\u63a5\u5efa\u7acb&#xff08;NetConnection&#xff09;<\/h4>\n<p>\u63e1\u624b\u6210\u529f\u540e&#xff0c;\u5ba2\u6237\u7aef\u53d1\u8d77NetConnection\u5efa\u7acb\u8bf7\u6c42&#xff1a;<\/p>\n<p>\/\/ ActionScript\u793a\u4f8b\u4ee3\u7801<br \/>\nvar nc:NetConnection &#061; new NetConnection();<br \/>\nnc.connect(&#034;rtmp:\/\/server\/app&#034;);<\/p>\n<p>\u534f\u8bae\u4ea4\u4e92\u6d41\u7a0b&#xff1a;<\/p>\n<li>\u5ba2\u6237\u7aef\u53d1\u9001Connect\u547d\u4ee4&#xff08;AMF\u7f16\u7801&#xff09;<\/li>\n<li>\u670d\u52a1\u7aef\u56de\u5e94Window Acknowledgement Size<\/li>\n<li>\u670d\u52a1\u7aef\u8bbe\u7f6e\u5e26\u5bbd\u53c2\u6570<\/li>\n<li>\u5ba2\u6237\u7aef\u786e\u8ba4\u5e26\u5bbd\u8bbe\u7f6e<\/li>\n<li>\u670d\u52a1\u7aef\u8fd4\u56de\u8fde\u63a5\u7ed3\u679c&#xff08;_result&#xff09;<\/li>\n<p>\u5173\u952eAMF\u6570\u636e\u683c\u5f0f&#xff1a;<\/p>\n<p>&#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#043;<br \/>\n| \u5b57\u6bb5\u540d         | \u503c                  |<br \/>\n&#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#043;<br \/>\n| app            | \u5e94\u7528\u540d\u79f0&#xff08;\u5982&#034;live&#034;&#xff09;|<br \/>\n| flashVer       | Flash\u64ad\u653e\u5668\u7248\u672c     |<br \/>\n| tcUrl          | \u8fde\u63a5URL             |<br \/>\n| fpad           | \u662f\u5426\u4f7f\u7528\u4ee3\u7406        |<br \/>\n| audioCodecs    | \u652f\u6301\u7684\u97f3\u9891\u7f16\u7801      |<br \/>\n| videoCodecs    | \u652f\u6301\u7684\u89c6\u9891\u7f16\u7801      |<br \/>\n&#043;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#043;<\/p>\n<h4>3.3 \u6d41\u521b\u5efa&#xff08;NetStream&#xff09;<\/h4>\n<p>\u57fa\u4e8e\u5df2\u5efa\u7acb\u7684NetConnection\u521b\u5efa\u5a92\u4f53\u6d41&#xff1a;<\/p>\n<p>var ns:NetStream &#061; new NetStream(nc);<br \/>\nns.play(&#034;streamName&#034;);<\/p>\n<p>\u534f\u8bae\u4ea4\u4e92\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u5ba2\u6237\u7aef\u53d1\u9001createStream\u547d\u4ee4<\/li>\n<li>\u670d\u52a1\u7aef\u8fd4\u56de\u6d41ID&#xff08;\u901a\u5e38\u4ece1\u5f00\u59cb&#xff09;<\/li>\n<li>\u5ba2\u6237\u7aef\u53d1\u9001play\u547d\u4ee4\u6307\u5b9a\u6d41\u540d\u79f0<\/li>\n<li>\u670d\u52a1\u7aef\u8fd4\u56deStream Begin\u901a\u77e5<\/li>\n<li>\u5f00\u59cb\u4f20\u8f93\u97f3\u89c6\u9891\u6570\u636e<\/li>\n<p>\u6ce8\u610f&#xff1a;\u5355\u4e2aNetConnection\u53ef\u4ee5\u521b\u5efa\u591a\u4e2aNetStream&#xff0c;\u6bcf\u4e2a\u6d41\u6709\u72ec\u7acb\u7684ID<\/p>\n<h3>4. \u63a8\u6d41\u670d\u52a1\u5668\u5b9e\u6218\u914d\u7f6e<\/h3>\n<h4>4.1 Nginx-rtmp\u914d\u7f6e\u8be6\u89e3<\/h4>\n<p>\u7f16\u8f91\/usr\/local\/nginx\/conf\/nginx.conf&#xff1a;<\/p>\n<p>rtmp {<br \/>\n    server {<br \/>\n        listen 1935;<br \/>\n        chunk_size 4096;<\/p>\n<p>        application live {<br \/>\n            live on;<br \/>\n            meta copy;  # \u4fdd\u7559\u5143\u6570\u636e<\/p>\n<p>            # \u8bbf\u95ee\u63a7\u5236<br \/>\n            allow publish 192.168.1.0\/24;<br \/>\n            deny publish all;<\/p>\n<p>            # HLS\u8f6c\u7801&#xff08;\u53ef\u9009&#xff09;<br \/>\n            hls on;<br \/>\n            hls_path \/tmp\/hls;<br \/>\n            hls_fragment 3s;<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>http {<br \/>\n    server {<br \/>\n        listen 8080;<\/p>\n<p>        location \/stat {<br \/>\n            rtmp_stat all;<br \/>\n            rtmp_stat_stylesheet stat.xsl;<br \/>\n        }<\/p>\n<p>        location \/hls {<br \/>\n            types {<br \/>\n                application\/vnd.apple.mpegurl m3u8;<br \/>\n                video\/mp2t ts;<br \/>\n            }<br \/>\n            alias \/tmp\/hls;<br \/>\n            add_header Cache-Control no-cache;<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\u542f\u52a8\u547d\u4ee4&#xff1a;<\/p>\n<p>sudo \/usr\/local\/nginx\/sbin\/nginx<\/p>\n<h4>4.2 \u63a8\u6d41\u5ba2\u6237\u7aef\u5b9e\u73b0<\/h4>\n<p>\u4f7f\u7528FFmpeg\u8fdb\u884c\u6d4b\u8bd5\u63a8\u6d41&#xff1a;<\/p>\n<p># \u672c\u5730\u6587\u4ef6\u63a8\u6d41<br \/>\nffmpeg -re -i input.mp4 -c copy -f flv rtmp:\/\/server\/live\/streamkey<\/p>\n<p># \u6444\u50cf\u5934\u91c7\u96c6\u63a8\u6d41&#xff08;Linux&#xff09;<br \/>\nffmpeg -f v4l2 -i \/dev\/video0 -f alsa -i hw:0 \\\\<br \/>\n       -vcodec libx264 -preset ultrafast -tune zerolatency \\\\<br \/>\n       -acodec aac -f flv rtmp:\/\/server\/live\/streamkey<\/p>\n<p>\u5173\u952e\u53c2\u6570\u8bf4\u660e&#xff1a;<\/p>\n<ul>\n<li>-re&#xff1a;\u6309\u539f\u59cb\u5e27\u7387\u8bfb\u53d6<\/li>\n<li>-c copy&#xff1a;\u4e0d\u91cd\u65b0\u7f16\u7801<\/li>\n<li>-preset ultrafast&#xff1a;\u6700\u4f4e\u7f16\u7801\u5ef6\u8fdf<\/li>\n<li>-tune zerolatency&#xff1a;\u96f6\u5ef6\u8fdf\u4f18\u5316<\/li>\n<\/ul>\n<h3>5. Wireshark\u9ad8\u7ea7\u6293\u5305\u5206\u6790<\/h3>\n<h4>5.1 \u5173\u952e\u8fc7\u6ee4\u5668\u8bbe\u7f6e<\/h4>\n<p># \u57fa\u672cRTMP\u8fc7\u6ee4<br \/>\nrtmp<\/p>\n<p># \u7279\u5b9a\u6d88\u606f\u7c7b\u578b\u8fc7\u6ee4<br \/>\nrtmp.msgtypeid &#061;&#061; 8    # \u97f3\u9891\u6570\u636e<br \/>\nrtmp.msgtypeid &#061;&#061; 9    # \u89c6\u9891\u6570\u636e<br \/>\nrtmp.msgtypeid &#061;&#061; 20   # AMF\u547d\u4ee4<\/p>\n<p># \u5757\u6d41\u5206\u6790<br \/>\nrtmp.chunk.streamid &#061;&#061; 1<\/p>\n<h4>5.2 \u5178\u578b\u95ee\u9898\u8bca\u65ad\u6848\u4f8b<\/h4>\n<p>\u6848\u4f8b1&#xff1a;\u63e1\u624b\u5931\u8d25<\/p>\n<ul>\n<li>\u73b0\u8c61&#xff1a;\u8fde\u63a5\u7acb\u5373\u65ad\u5f00<\/li>\n<li>\u6392\u67e5&#xff1a;\u68c0\u67e5C0\/S0\u7248\u672c\u53f7\u662f\u5426\u5339\u914d&#xff0c;\u786e\u8ba4\u9632\u706b\u5899\u8bbe\u7f6e<\/li>\n<\/ul>\n<p>\u6848\u4f8b2&#xff1a;\u89c6\u9891\u5361\u987f<\/p>\n<ul>\n<li>\u6392\u67e5\u6b65\u9aa4&#xff1a;\n<li>\u68c0\u67e5\u5e26\u5bbd\u8bbe\u7f6e\u6d88\u606f&#xff08;Message Type 5&#xff09;<\/li>\n<li>\u5206\u6790Acknowledgement\u7a97\u53e3\u5927\u5c0f<\/li>\n<li>\u89c2\u5bdf\u89c6\u9891\u5173\u952e\u5e27\u95f4\u9694<\/li>\n<\/li>\n<\/ul>\n<p>\u6848\u4f8b3&#xff1a;\u97f3\u9891\u4e0d\u540c\u6b65<\/p>\n<ul>\n<li>\u5206\u6790\u65b9\u6cd5&#xff1a;\n<li>\u5bf9\u6bd4\u97f3\u89c6\u9891\u65f6\u95f4\u6233<\/li>\n<li>\u68c0\u67e5Chunk\u6d41\u4ea4\u9519\u60c5\u51b5<\/li>\n<li>\u9a8c\u8bc1NALU\u5355\u5143\u5b8c\u6574\u6027<\/li>\n<\/li>\n<\/ul>\n<h3>6. \u6027\u80fd\u4f18\u5316\u4e0e\u5b89\u5168\u5b9e\u8df5<\/h3>\n<h4>6.1 \u4f20\u8f93\u4f18\u5316\u6280\u5de7<\/h4>\n<li>\n<p>\u5757\u5927\u5c0f\u8c03\u4f18&#xff1a;<\/p>\n<p>rtmp {<br \/>\n    chunk_size 8192;  # \u9ed8\u8ba44096<br \/>\n}<\/p>\n<\/li>\n<li>\n<p>\u7f13\u51b2\u533a\u914d\u7f6e&#xff1a;<\/p>\n<p>application live {<br \/>\n    buflen 500ms;  # \u7f13\u51b2\u533a\u957f\u5ea6<br \/>\n    drop_idle_publisher 10s; # \u7a7a\u95f2\u65ad\u5f00<br \/>\n}<\/p>\n<\/li>\n<li>\n<p>\u591a\u7801\u7387\u9002\u914d&#xff1a;<\/p>\n<p>ffmpeg -i input -map 0:v:0 -map 0:a:0 \\\\<br \/>\n       -c:v libx264 -b:v 3000k -f flv rtmp:\/\/server\/live\/high \\\\<br \/>\n       -c:v libx264 -b:v 1500k -f flv rtmp:\/\/server\/live\/medium \\\\<br \/>\n       -c:v libx264 -b:v 800k  -f flv rtmp:\/\/server\/live\/low<\/p>\n<\/li>\n<h4>6.2 \u5b89\u5168\u9632\u62a4\u65b9\u6848<\/h4>\n<li>\n<p>\u63a8\u6d41\u9274\u6743&#xff1a;<\/p>\n<p>application live {<br \/>\n    on_publish http:\/\/auth_server\/verify;<br \/>\n}<\/p>\n<\/li>\n<li>\n<p>RTMPS\u914d\u7f6e&#xff1a;<\/p>\n<p>rtmp {<br \/>\n    server {<br \/>\n        listen 1935;<br \/>\n        listen 1936 ssl;<\/p>\n<p>        ssl_certificate     \/path\/to\/cert.pem;<br \/>\n        ssl_certificate_key \/path\/to\/key.pem;<br \/>\n    }<br \/>\n}<\/p>\n<\/li>\n<li>\n<p>\u9632\u76d7\u94fe\u63aa\u65bd&#xff1a;<\/p>\n<p>application live {<br \/>\n    allow play 192.168.1.0\/24;<br \/>\n    deny play all;<\/p>\n<p>    # \u6216\u4f7f\u7528token\u9a8c\u8bc1<br \/>\n    on_play http:\/\/auth_server\/check_token;<br \/>\n}<\/p>\n<\/li>\n<h3>7. \u73b0\u4ee3\u76f4\u64ad\u67b6\u6784\u4e2d\u7684RTMP<\/h3>\n<p>\u867d\u7136WebRTC\u7b49\u65b0\u6280\u672f\u4e0d\u65ad\u6d8c\u73b0&#xff0c;RTMP\u5728\u4ee5\u4e0b\u573a\u666f\u4ecd\u4e0d\u53ef\u66ff\u4ee3&#xff1a;<\/p>\n<li>\u4e13\u4e1a\u76f4\u64ad\u63a8\u6d41&#xff1a;OBS\u7b49\u4e13\u4e1a\u5de5\u5177\u666e\u904d\u652f\u6301<\/li>\n<li>CDN\u517c\u5bb9\u6027&#xff1a;\u6240\u6709\u4e3b\u6d41CDN\u90fd\u652f\u6301RTMP\u63a5\u5165<\/li>\n<li>\u8f6c\u7801\u4e2d\u95f4\u4ef6&#xff1a;\u4f5c\u4e3a\u4e0d\u540c\u534f\u8bae\u95f4\u7684\u8f6c\u6362\u6865\u6881<\/li>\n<p>\u5178\u578b\u6df7\u5408\u67b6\u6784\u793a\u4f8b&#xff1a;<\/p>\n<p>[\u63a8\u6d41\u7aef] &#8211;RTMP&#8211;&gt; [\u8fb9\u7f18\u670d\u52a1\u5668] &#8211;HLS\/DASH&#8211;&gt; [\u89c2\u4f17]<br \/>\n                     \u2191<br \/>\n[WebRTC\u8f93\u5165] &#8211;\u8f6cRTMP&#8211;&#043;<\/p>\n<p>\u5728\u5b9e\u9645\u9879\u76ee\u4e2d&#xff0c;\u6211\u4eec\u66fe\u9047\u5230\u4e00\u4e2a\u63a8\u6d41\u5ef6\u8fdf\u5f02\u5e38\u6848\u4f8b\u3002\u901a\u8fc7Wireshark\u5206\u6790\u53d1\u73b0&#xff0c;\u5ba2\u6237\u7aef\u8bbe\u7f6e\u7684\u5757\u5927\u5c0f&#xff08;Chunk Size&#xff09;\u4ec5\u4e3a128\u5b57\u8282&#xff0c;\u5bfc\u81f4TCP\u4f20\u8f93\u6548\u7387\u4f4e\u4e0b\u3002\u8c03\u6574\u52304096\u5b57\u8282\u540e&#xff0c;\u5ef6\u8fdf\u4ece3\u79d2\u964d\u81f3800\u6beb\u79d2\u4ee5\u5185\u3002\u8fd9\u4e2a\u6848\u4f8b\u5145\u5206\u8bf4\u660e\u534f\u8bae\u5c42\u8c03\u4f18\u7684\u91cd\u8981\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RTMP\u534f\u8bae\u5b9e\u6218&#xff1a;\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668&#xff08;\u542bWireshark\u6293\u5305\u5206\u6790&#xff09;<br \/>\n\u76f4\u64ad\u6280\u672f\u5df2\u7ecf\u6210\u4e3a\u4e92\u8054\u7f51\u5185\u5bb9\u5206\u53d1\u7684\u6838\u5fc3\u5f62\u6001\u4e4b\u4e00&#xff0c;\u800cRTMP\u534f\u8bae\u4f5c\u4e3a\u76f4\u64ad\u9886\u57df\u7684\u57fa\u77f3\u534f\u8bae&#xff0c;\u81f3\u4eca\u4ecd\u5728\u5404\u7c7b\u76f4\u64ad\u573a\u666f\u4e2d\u53d1\u6325\u7740\u5173\u952e\u4f5c\u7528\u3002\u672c\u6587\u5c06\u5e26\u60a8\u6df1\u5165RTMP\u534f\u8bae\u7684\u6280\u672f\u7ec6\u8282&#xff0c;\u5e76\u901a\u8fc7\u5b9e\u6218\u6f14\u793a\u5982\u4f55\u4ece\u96f6\u642d\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668&#xff0c;\u540c\u65f6\u7ed3\u5408Wireshark\u6293\u5305\u5de5\u5177&#xff0c;\u9010\u5e27\u89e3\u6790\u534f\u8bae\u4ea4\u4e92\u8fc7\u7a0b\u3002<br \/>\n1. RTMP\u534f\u8bae\u6280\u672f<\/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":[8463,8462,610,2570],"topic":[],"class_list":["post-77147","post","type-post","status-publish","format-standard","hentry","category-server","tag-8463","tag-8462","tag-rtmp","tag-wireshark"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>RTMP\u534f\u8bae\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668\uff08\u542bWireshark\u6293\u5305\u5206\u6790\uff09 - \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\/77147.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RTMP\u534f\u8bae\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668\uff08\u542bWireshark\u6293\u5305\u5206\u6790\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"RTMP\u534f\u8bae\u5b9e\u6218&#xff1a;\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668&#xff08;\u542bWireshark\u6293\u5305\u5206\u6790&#xff09; \u76f4\u64ad\u6280\u672f\u5df2\u7ecf\u6210\u4e3a\u4e92\u8054\u7f51\u5185\u5bb9\u5206\u53d1\u7684\u6838\u5fc3\u5f62\u6001\u4e4b\u4e00&#xff0c;\u800cRTMP\u534f\u8bae\u4f5c\u4e3a\u76f4\u64ad\u9886\u57df\u7684\u57fa\u77f3\u534f\u8bae&#xff0c;\u81f3\u4eca\u4ecd\u5728\u5404\u7c7b\u76f4\u64ad\u573a\u666f\u4e2d\u53d1\u6325\u7740\u5173\u952e\u4f5c\u7528\u3002\u672c\u6587\u5c06\u5e26\u60a8\u6df1\u5165RTMP\u534f\u8bae\u7684\u6280\u672f\u7ec6\u8282&#xff0c;\u5e76\u901a\u8fc7\u5b9e\u6218\u6f14\u793a\u5982\u4f55\u4ece\u96f6\u642d\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668&#xff0c;\u540c\u65f6\u7ed3\u5408Wireshark\u6293\u5305\u5de5\u5177&#xff0c;\u9010\u5e27\u89e3\u6790\u534f\u8bae\u4ea4\u4e92\u8fc7\u7a0b\u3002 1. RTMP\u534f\u8bae\u6280\u672f\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/77147.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-23T17:17:21+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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/77147.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/77147.html\",\"name\":\"RTMP\u534f\u8bae\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668\uff08\u542bWireshark\u6293\u5305\u5206\u6790\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-23T17:17:21+00:00\",\"dateModified\":\"2026-02-23T17:17:21+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/77147.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/77147.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/77147.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"RTMP\u534f\u8bae\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668\uff08\u542bWireshark\u6293\u5305\u5206\u6790\uff09\"}]},{\"@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":"RTMP\u534f\u8bae\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668\uff08\u542bWireshark\u6293\u5305\u5206\u6790\uff09 - \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\/77147.html","og_locale":"zh_CN","og_type":"article","og_title":"RTMP\u534f\u8bae\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668\uff08\u542bWireshark\u6293\u5305\u5206\u6790\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"RTMP\u534f\u8bae\u5b9e\u6218&#xff1a;\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668&#xff08;\u542bWireshark\u6293\u5305\u5206\u6790&#xff09; \u76f4\u64ad\u6280\u672f\u5df2\u7ecf\u6210\u4e3a\u4e92\u8054\u7f51\u5185\u5bb9\u5206\u53d1\u7684\u6838\u5fc3\u5f62\u6001\u4e4b\u4e00&#xff0c;\u800cRTMP\u534f\u8bae\u4f5c\u4e3a\u76f4\u64ad\u9886\u57df\u7684\u57fa\u77f3\u534f\u8bae&#xff0c;\u81f3\u4eca\u4ecd\u5728\u5404\u7c7b\u76f4\u64ad\u573a\u666f\u4e2d\u53d1\u6325\u7740\u5173\u952e\u4f5c\u7528\u3002\u672c\u6587\u5c06\u5e26\u60a8\u6df1\u5165RTMP\u534f\u8bae\u7684\u6280\u672f\u7ec6\u8282&#xff0c;\u5e76\u901a\u8fc7\u5b9e\u6218\u6f14\u793a\u5982\u4f55\u4ece\u96f6\u642d\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668&#xff0c;\u540c\u65f6\u7ed3\u5408Wireshark\u6293\u5305\u5de5\u5177&#xff0c;\u9010\u5e27\u89e3\u6790\u534f\u8bae\u4ea4\u4e92\u8fc7\u7a0b\u3002 1. RTMP\u534f\u8bae\u6280\u672f","og_url":"https:\/\/www.wsisp.com\/helps\/77147.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-23T17:17:21+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/77147.html","url":"https:\/\/www.wsisp.com\/helps\/77147.html","name":"RTMP\u534f\u8bae\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668\uff08\u542bWireshark\u6293\u5305\u5206\u6790\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-23T17:17:21+00:00","dateModified":"2026-02-23T17:17:21+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/77147.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/77147.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/77147.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"RTMP\u534f\u8bae\u5b9e\u6218\uff1a\u4ece\u96f6\u642d\u5efa\u76f4\u64ad\u63a8\u6d41\u670d\u52a1\u5668\uff08\u542bWireshark\u6293\u5305\u5206\u6790\uff09"}]},{"@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\/77147","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=77147"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/77147\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=77147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=77147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=77147"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=77147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}