{"id":3708,"date":"2026-04-12T00:17:46","date_gmt":"2026-04-11T16:17:46","guid":{"rendered":"http:\/\/www.51cos.com\/?p=3708"},"modified":"2026-04-12T00:17:46","modified_gmt":"2026-04-11T16:17:46","slug":"%e5%a6%82%e4%bd%95%e5%87%8f%e5%b0%91%e4%b8%b2%e6%b5%81%e5%bb%b6%e6%97%b6%ef%bc%9agstreamer-vs-gst-rtsp-server-%e7%9a%84%e5%85%b3%e7%b3%bb","status":"publish","type":"post","link":"http:\/\/www.51cos.com\/?p=3708","title":{"rendered":"\u5982\u4f55\u51cf\u5c11\u4e32\u6d41\u5ef6\u65f6\uff1aGStreamer vs gst-rtsp-server \u7684\u5173\u7cfb"},"content":{"rendered":"<h2>GStreamer vs gst-rtsp-server \u7684\u5173\u7cfb<\/h2>\n<h3>\u4e0d\u53ef\u4ee5\u53ea\u5b89\u88c5gst-rtsp-server<\/h3>\n<p><strong>gst-rtsp-server \u4f9d\u8d56\u4e8e GStreamer<\/strong>\uff0c\u5b83\u53ea\u662f\u4e00\u4e2a<strong>RTSP\u534f\u8bae\u5c01\u88c5\u5c42<\/strong>\uff0c\u4e0d\u80fd\u72ec\u7acb\u5de5\u4f5c\u3002\u5b9e\u9645\u7684\u89c6\u9891\u91c7\u96c6\u3001H.264\u5904\u7406\u3001RTP\u5c01\u88c5\u90fd\u662f\u7531GStreamer\u7684\u6838\u5fc3\u63d2\u4ef6\u5b8c\u6210\u7684\u3002<\/p>\n<pre><code class=\"line-numbers\">\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502     gst-rtsp-server (RTSP\u534f\u8bae\u5c42)     \u2502  \u2190 \u53ea\u8d1f\u8d23RTSP\u63e1\u624b\u3001\u4f1a\u8bdd\u7ba1\u7406\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502         GStreamer (\u591a\u5a92\u4f53\u6846\u67b6)        \u2502  \u2190 \u8d1f\u8d23\u5b9e\u9645\u7684\u89c6\u9891\u5904\u7406\n\u2502  \u251c\u2500 v4l2src (\u6444\u50cf\u5934\u91c7\u96c6)             \u2502\n\u2502  \u251c\u2500 h264parse (H.264\u89e3\u6790)           \u2502\n\u2502  \u2514\u2500 rtph264pay (RTP\u5c01\u88c5)            \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n         \u2193\n    UVC\u6444\u50cf\u5934 (H.264\u8f93\u51fa)\n<\/code><\/pre>\n<h2>\u5b9e\u9645\u4e0a\u4f60\u9700\u8981\u5b89\u88c5\u4ec0\u4e48<\/h2>\n<h3>\u6700\u5c0f\u5316\u5b89\u88c5\uff08\u5fc5\u9700\uff09<\/h3>\n<pre><code class=\"language-bash line-numbers\"># GStreamer\u6838\u5fc3\uff08\u5fc5\u987b\uff09\nopkg install gstreamer1 gstreamer1-libs\n\n# \u5fc5\u9700\u7684\u63d2\u4ef6\uff08\u5fc5\u987b\uff09\nopkg install gstreamer1-plugins-base    # \u57fa\u7840\u63d2\u4ef6\nopkg install gstreamer1-plugins-good    # v4l2\u3001udpsink\u7b49\n\n# \u5982\u679cOpenWRT\u4ed3\u5e93\u6709\u8fd9\u4e9b\uff08\u53ef\u9009\uff0c\u4f46\u63a8\u8350\uff09\nopkg install gstreamer1-plugins-bad     # \u53ef\u80fd\u5305\u542bh264parse\nopkg install gstreamer1-plugins-ugly    # \u53ef\u80fd\u5305\u542b\u66f4\u591a\u7f16\u7801\u5668\n<\/code><\/pre>\n<h3>\u53ef\u9009\uff1agst-rtsp-server<\/h3>\n<pre><code class=\"language-bash line-numbers\"># \u5982\u679c\u4ed3\u5e93\u4e2d\u6709\u8fd9\u4e2a\u5305\nopkg install gstreamer1-rtsp-server\n\n# \u5982\u679c\u4ed3\u5e93\u4e2d\u6ca1\u6709\uff0c\u9700\u8981\u81ea\u5df1\u7f16\u8bd1\uff08\u4f46\u4e0d\u662f\u5fc5\u9700\u7684\uff09\n<\/code><\/pre>\n<h2>\u4e3a\u4ec0\u4e48gst-rtsp-server\u4e0d\u662f\u5fc5\u9700\u7684\uff1f<\/h2>\n<h3>\u65b9\u6848A\uff1a\u4f7f\u7528gst-rtsp-server\uff08\u7b80\u5316RTSP\uff09<\/h3>\n<pre><code class=\"language-bash line-numbers\"># \u9700\u8981\u7f16\u8bd1\u6216\u627e\u5230\u8fd9\u4e2a\u5305\n\/usr\/bin\/test-launch \\\n  \"( v4l2src device=\/dev\/video0 ! \\\n     video\/x-h264 ! \\\n     h264parse ! \\\n     rtph264pay name=pay0 )\"\n\n# \u8f93\u51fa\uff1artsp:\/\/0.0.0.0:8554\/test\n<\/code><\/pre>\n<p><strong>\u4f18\u70b9<\/strong>\uff1a\u81ea\u52a8\u5904\u7406RTSP\u534f\u8bae\u7ec6\u8282<br \/>\n<strong>\u7f3a\u70b9<\/strong>\uff1a\u9700\u8981\u989d\u5916\u7f16\u8bd1\uff0cOpenWRT\u4ed3\u5e93\u901a\u5e38\u6ca1\u6709<\/p>\n<h3>\u65b9\u6848B\uff1a\u53ea\u7528GStreamer\u6838\u5fc3\uff08\u65e0\u9700gst-rtsp-server\uff09<\/h3>\n<pre><code class=\"language-bash line-numbers\"># \u53ea\u9700\u8981GStreamer\u6838\u5fc3\u548c\u63d2\u4ef6\ngst-launch-1.0 -e \\\n  v4l2src device=\/dev\/video0 ! \\\n  video\/x-h264,width=640,height=480,framerate=30\/1 ! \\\n  h264parse ! \\\n  rtph264pay config-interval=1 pt=96 ! \\\n  udpsink host=224.0.0.1 port=5004 sync=false\n\n# \u8f93\u51fa\uff1audp:\/\/224.0.0.1:5004 (\u539f\u59cbRTP\u6d41)\n<\/code><\/pre>\n<p><strong>\u4f18\u70b9<\/strong>\uff1a\u53ea\u9700\u5b89\u88c5\u6838\u5fc3\u5305\uff0c\u65e0\u9700\u989d\u5916\u7f16\u8bd1<br \/>\n<strong>\u7f3a\u70b9<\/strong>\uff1a\u5ba2\u6237\u7aef\u9700\u8981\u76f4\u63a5\u8fde\u63a5UDP\uff0c\u4e0d\u662f\u6807\u51c6RTSP<\/p>\n<h2>\u5bf9\u6bd4\uff1av4l2rtspserver vs GStreamer<\/h2>\n<table>\n<thead>\n<tr>\n<th>\u7ec4\u4ef6<\/th>\n<th>v4l2rtspserver<\/th>\n<th>GStreamer (\u65e0gst-rtsp-server)<\/th>\n<th>GStreamer (\u6709gst-rtsp-server)<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u6838\u5fc3\u5e93<\/td>\n<td>live555<\/td>\n<td>gstreamer1<\/td>\n<td>gstreamer1<\/td>\n<\/tr>\n<tr>\n<td>RTSP\u652f\u6301<\/td>\n<td>&#x2705; \u5185\u7f6e<\/td>\n<td>&#x274c; \u9700\u8981\u81ea\u5df1\u5b9e\u73b0<\/td>\n<td>&#x2705; \u901a\u8fc7\u5e93<\/td>\n<\/tr>\n<tr>\n<td>\u5b89\u88c5\u590d\u6742\u5ea6<\/td>\n<td>\u4f4e<\/td>\n<td>\u4f4e<\/td>\n<td>\u4e2d\uff08\u9700\u7f16\u8bd1\uff09<\/td>\n<\/tr>\n<tr>\n<td>H.264\u900f\u4f20<\/td>\n<td>&#x2705;<\/td>\n<td>&#x2705;<\/td>\n<td>&#x2705;<\/td>\n<\/tr>\n<tr>\n<td>\u5ef6\u65f6<\/td>\n<td>50-100ms<\/td>\n<td>30-50ms<\/td>\n<td>30-50ms<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u6211\u7684\u5efa\u8bae<\/h2>\n<h3>1. \u5982\u679c\u4f60\u60f3\u7528\u6807\u51c6RTSP\u534f\u8bae<\/h3>\n<p><strong>\u7ee7\u7eed\u7528v4l2rtspserver<\/strong>\uff0c\u5b83\u5df2\u7ecf\u5185\u7f6e\u4e86RTSP\u652f\u6301\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">v4l2rtspserver -fH264 -Q 1 \/dev\/video0\n<\/code><\/pre>\n<h3>2. \u5982\u679c\u4f60\u60f3\u7528GStreamer\u4f46\u4e0d\u7f16\u8bd1gst-rtsp-server<\/h3>\n<p><strong>\u53ea\u7528GStreamer\u6838\u5fc3 + UDP\u4f20\u8f93<\/strong>\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\"># \u5b89\u88c5\nopkg install gstreamer1 gstreamer1-libs gstreamer1-plugins-base gstreamer1-plugins-good\n\n# \u8fd0\u884c\ngst-launch-1.0 -e v4l2src device=\/dev\/video0 ! \\\n  video\/x-h264 ! h264parse ! rtph264pay ! \\\n  udpsink host=224.0.0.1 port=5004 sync=false\n\n# \u5ba2\u6237\u7aef\u8fde\u63a5\nvlc udp:\/\/@224.0.0.1:5004\n<\/code><\/pre>\n<h3>3. \u5982\u679c\u4f60\u575a\u6301\u8981GStreamer + RTSP\u4e14\u4e0d\u7f16\u8bd1<\/h3>\n<p><strong>\u7528\u7b80\u5355\u7684HTTP\u5305\u88c5<\/strong>\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\"># \u542f\u52a8GStreamer UDP\u6d41\ngst-launch-1.0 v4l2src device=\/dev\/video0 ! \\\n  video\/x-h264 ! h264parse ! rtph264pay ! \\\n  udpsink host=127.0.0.1 port=5004 sync=false &amp;\n\n# \u7528FFmpeg\u8f6c\u6210RTSP\nffmpeg -i udp:\/\/@127.0.0.1:5004 -c:v copy -f rtsp rtsp:\/\/0.0.0.0:8554\/stream\n<\/code><\/pre>\n<h2>\u7ed3\u8bba<\/h2>\n<p><strong>\u56de\u7b54\u4f60\u7684\u95ee\u9898<\/strong>\uff1a<br \/>\n&#8211; &#x274c; <strong>\u4e0d\u53ef\u4ee5<\/strong>\u53ea\u5b89\u88c5gst-rtsp-server\u914d\u5408v4l2<br \/>\n&#8211; &#x2705; <strong>\u5fc5\u987b\u5b89\u88c5GStreamer\u6838\u5fc3<\/strong>\uff08gstreamer1 + \u63d2\u4ef6\uff09<br \/>\n&#8211; &#x2705; gst-rtsp-server\u662f<strong>\u53ef\u9009\u7684<\/strong>\uff0c\u53ea\u662f\u63d0\u4f9b\u4e86\u66f4\u65b9\u4fbf\u7684RTSP\u63a5\u53e3<\/p>\n<p><strong>\u6700\u7b80\u5355\u7684\u4f4e\u5ef6\u65f6\u65b9\u6848<\/strong>\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\"># \u53ea\u9700\u8981\u8fd9\u4e9b\u5305\nopkg install gstreamer1 gstreamer1-libs gstreamer1-plugins-base gstreamer1-plugins-good\n\n# \u76f4\u63a5\u8fd0\u884c\uff08\u65e0\u9700gst-rtsp-server\uff09\ngst-launch-1.0 -e v4l2src device=\/dev\/video0 ! \\\n  video\/x-h264 ! h264parse ! rtph264pay ! \\\n  udpsink host=224.0.0.1 port=5004 sync=false\n<\/code><\/pre>\n<p>\u8fd9\u6837\u4f60\u5c31\u80fd\u83b7\u5f97\u6bd4v4l2rtspserver\u66f4\u4f4e\u7684\u5ef6\u65f6\uff0830-50ms\uff09\uff0c\u800c\u4e14\u5b89\u88c5\u66f4\u7b80\u5355\u3002<\/p>\n<p>\u8981\u8bd5\u8bd5\u8fd9\u4e2a\u65b9\u6848\u5417\uff1f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GStreamer vs gst-rtsp-server \u7684\u5173\u7cfb \u4e0d\u53ef\u4ee5\u53ea\u5b89\u88c5gst-rtsp-server  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,22],"tags":[],"class_list":["post-3708","post","type-post","status-publish","format-standard","hentry","category-embedded","category-plana"],"_links":{"self":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/3708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3708"}],"version-history":[{"count":1,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/3708\/revisions"}],"predecessor-version":[{"id":3709,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/3708\/revisions\/3709"}],"wp:attachment":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3708"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}