{"id":957968,"date":"2024-12-27T03:12:39","date_gmt":"2024-12-26T19:12:39","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/957968.html"},"modified":"2024-12-27T03:12:42","modified_gmt":"2024-12-26T19:12:42","slug":"python%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e8%a7%86%e9%a2%91%e7%9b%b4%e6%92%ad","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/957968.html","title":{"rendered":"python\u5982\u4f55\u5b9e\u73b0\u89c6\u9891\u76f4\u64ad"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25101115\/9ad97600-81e6-47a4-8e2b-9c6b3eaf355a.webp\" alt=\"python\u5982\u4f55\u5b9e\u73b0\u89c6\u9891\u76f4\u64ad\" \/><\/p>\n<p><p> <strong>\u8981\u5728Python\u4e2d\u5b9e\u73b0\u89c6\u9891\u76f4\u64ad\uff0c\u53ef\u4ee5\u4f7f\u7528OpenCV\u3001FFmpeg\u3001Flask\u7b49\u5de5\u5177\u3002<\/strong>\u9996\u5148\uff0c\u4f7f\u7528OpenCV\u6355\u83b7\u6444\u50cf\u5934\u89c6\u9891\u6d41\u3001\u4f7f\u7528Flask\u521b\u5efaWeb\u670d\u52a1\u5668\u6765\u53d1\u5e03\u89c6\u9891\u6d41\u3001\u4f7f\u7528FFmpeg\u8fdb\u884c\u89c6\u9891\u683c\u5f0f\u8f6c\u6362\u3002\u63a5\u4e0b\u6765\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u5b9e\u73b0\u89c6\u9891\u76f4\u64ad\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001OPENCV\u6355\u83b7\u89c6\u9891\u6d41<\/p>\n<\/p>\n<p><p>OpenCV\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u8ba1\u7b97\u673a\u89c6\u89c9\u5e93\uff0c\u53ef\u4ee5\u8f7b\u677e\u6355\u83b7\u89c6\u9891\u6d41\u3002\u5b89\u88c5OpenCV\u4e4b\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528<code>cv2.VideoCapture()<\/code>\u51fd\u6570\u8bbf\u95ee\u6444\u50cf\u5934\uff0c\u5e76\u4f7f\u7528<code>cv2.imshow()<\/code>\u663e\u793a\u6355\u83b7\u7684\u89c6\u9891\u5e27\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5\u548c\u8bbe\u7f6eOpenCV<\/li>\n<\/ol>\n<p><p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u786e\u4fddPython\u73af\u5883\u4e2d\u5b89\u88c5\u4e86OpenCV\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install opencv-python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u5f00\u59cb\u7f16\u5199Python\u811a\u672c\u6765\u6355\u83b7\u89c6\u9891\u6d41\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import cv2<\/p>\n<p>def capture_video():<\/p>\n<p>    cap = cv2.VideoCapture(0)  # 0\u4ee3\u8868\u9ed8\u8ba4\u6444\u50cf\u5934<\/p>\n<p>    while True:<\/p>\n<p>        ret, frame = cap.read()<\/p>\n<p>        if not ret:<\/p>\n<p>            break<\/p>\n<p>        cv2.imshow(&#39;Video Stream&#39;, frame)<\/p>\n<p>        # \u6309\u4e0b &#39;q&#39; \u952e\u9000\u51fa<\/p>\n<p>        if cv2.w<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>tKey(1) &amp; 0xFF == ord(&#39;q&#39;):<\/p>\n<p>            break<\/p>\n<p>    cap.release()<\/p>\n<p>    cv2.destroyAllWindows()<\/p>\n<p>capture_video()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u89c6\u9891\u6d41\u6355\u83b7\u5b9e\u73b0\u7ec6\u8282<\/li>\n<\/ol>\n<p><p>\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c<code>cv2.VideoCapture(0)<\/code>\u521b\u5efa\u4e00\u4e2a\u89c6\u9891\u6355\u83b7\u5bf9\u8c61\uff0c\u53c2\u6570\u4e3a0\u8868\u793a\u6253\u5f00\u9ed8\u8ba4\u6444\u50cf\u5934\u3002<code>cap.read()<\/code>\u7528\u4e8e\u8bfb\u53d6\u5e27\u6570\u636e\uff0c\u8fd4\u56de\u4e24\u4e2a\u503c\uff1a<code>ret<\/code>\u8868\u793a\u662f\u5426\u6210\u529f\u8bfb\u53d6\u5e27\uff0c<code>frame<\/code>\u662f\u6355\u83b7\u7684\u5e27\u3002<code>cv2.imshow()<\/code>\u663e\u793a\u5e27\uff0c<code>cv2.waitKey(1)<\/code>\u8bbe\u5b9a\u5e27\u4e4b\u95f4\u7684\u7b49\u5f85\u65f6\u95f4\uff0c\u5f53\u6309\u4e0b&#39;q&#39;\u65f6\u9000\u51fa\u5faa\u73af\u3002\u6700\u540e\uff0c<code>cap.release()<\/code>\u91ca\u653e\u6444\u50cf\u5934\uff0c<code>cv2.destroyAllWindows()<\/code>\u5173\u95ed\u6240\u6709\u7a97\u53e3\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528FLASK\u521b\u5efaWEB\u670d\u52a1\u5668<\/p>\n<\/p>\n<p><p>Flask\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7Web\u6846\u67b6\uff0c\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u521b\u5efa\u4e00\u4e2aWeb\u670d\u52a1\u5668\u6765\u53d1\u5e03\u89c6\u9891\u6d41\u3002\u901a\u8fc7Flask\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u6355\u83b7\u7684\u89c6\u9891\u5e27\u53d1\u9001\u5230\u7f51\u9875\u4e0a\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5\u548c\u8bbe\u7f6eFlask<\/li>\n<\/ol>\n<p><p>\u9996\u5148\uff0c\u786e\u4fddFlask\u5e93\u5df2\u7ecf\u5b89\u88c5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install flask<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u521b\u5efaFlask\u5e94\u7528<\/li>\n<\/ol>\n<p><p>\u521b\u5efa\u4e00\u4e2aFlask\u5e94\u7528\u5e76\u5c06\u89c6\u9891\u6d41\u4f5c\u4e3a\u54cd\u5e94\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from flask import Flask, Response<\/p>\n<p>import cv2<\/p>\n<p>app = Flask(__name__)<\/p>\n<p>def generate_frames():<\/p>\n<p>    cap = cv2.VideoCapture(0)<\/p>\n<p>    while True:<\/p>\n<p>        success, frame = cap.read()<\/p>\n<p>        if not success:<\/p>\n<p>            break<\/p>\n<p>        else:<\/p>\n<p>            ret, buffer = cv2.imencode(&#39;.jpg&#39;, frame)<\/p>\n<p>            frame = buffer.tobytes()<\/p>\n<p>            yield (b&#39;--frame\\r\\n&#39;<\/p>\n<p>                   b&#39;Content-Type: image\/jpeg\\r\\n\\r\\n&#39; + frame + b&#39;\\r\\n&#39;)<\/p>\n<p>@app.route(&#39;\/video_feed&#39;)<\/p>\n<p>def video_feed():<\/p>\n<p>    return Response(generate_frames(), mimetype=&#39;multipart\/x-mixed-replace; boundary=frame&#39;)<\/p>\n<p>if __name__ == &#39;__main__&#39;:<\/p>\n<p>    app.run(debug=True)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>Web\u670d\u52a1\u5668\u5b9e\u73b0\u7ec6\u8282<\/li>\n<\/ol>\n<p><p>\u5728\u8fd9\u4e2a\u4ee3\u7801\u4e2d\uff0c\u521b\u5efa\u4e86\u4e00\u4e2aFlask\u5e94\u7528\uff0c\u5e76\u5b9a\u4e49\u4e86<code>generate_frames()<\/code>\u51fd\u6570\u6765\u6355\u83b7\u5e76\u751f\u6210\u89c6\u9891\u5e27\u3002<code>cv2.imencode(&#39;.jpg&#39;, frame)<\/code>\u5c06\u5e27\u7f16\u7801\u4e3aJPEG\u683c\u5f0f\uff0c<code>frame.tobytes()<\/code>\u5c06\u5176\u8f6c\u6362\u4e3a\u5b57\u8282\u6d41\u3002<code>yield<\/code>\u8bed\u53e5\u7528\u4e8e\u751f\u6210\u89c6\u9891\u6d41\u6570\u636e\uff0c\u901a\u8fc7<code>Response<\/code>\u5bf9\u8c61\u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u3002<code>\/video_feed<\/code>\u8def\u7531\u7528\u4e8e\u63d0\u4f9b\u89c6\u9891\u6d41\u670d\u52a1\uff0c\u8bbe\u7f6e\u54cd\u5e94\u7c7b\u578b\u4e3a<code>multipart\/x-mixed-replace<\/code>\u4ee5\u652f\u6301\u89c6\u9891\u6d41\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u4f7f\u7528FFMPEG\u8fdb\u884c\u89c6\u9891\u683c\u5f0f\u8f6c\u6362<\/p>\n<\/p>\n<p><p>FFmpeg\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u591a\u5a92\u4f53\u5904\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4e8e\u97f3\u89c6\u9891\u683c\u5f0f\u8f6c\u6362\u3001\u6d41\u5a92\u4f53\u5904\u7406\u7b49\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528FFmpeg\u5c06OpenCV\u6355\u83b7\u7684\u89c6\u9891\u6d41\u8f6c\u6362\u4e3a\u5176\u4ed6\u683c\u5f0f\uff0c\u4ee5\u4fbf\u5728\u7f51\u9875\u4e0a\u66f4\u597d\u5730\u64ad\u653e\u3002<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5FFmpeg<\/li>\n<\/ol>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u5b89\u88c5FFmpeg\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\"># \u5bf9\u4e8eDebian\/Ubuntu<\/p>\n<p>sudo apt-get install ffmpeg<\/p>\n<h2><strong>\u5bf9\u4e8emacOS<\/strong><\/h2>\n<p>brew install ffmpeg<\/p>\n<h2><strong>\u5bf9\u4e8eWindows\uff0c\u8bf7\u4eceFFmpeg\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5<\/strong><\/h2>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u4f7f\u7528FFmpeg\u8fdb\u884c\u683c\u5f0f\u8f6c\u6362<\/li>\n<\/ol>\n<p><p>\u5728\u4f7f\u7528FFmpeg\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u5c06\u89c6\u9891\u6d41\u8f6c\u6362\u4e3a\u7279\u5b9a\u683c\u5f0f\uff0c\u4f8b\u5982\u5c06\u89c6\u9891\u6d41\u8f6c\u6362\u4e3aHLS\u683c\u5f0f\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">ffmpeg -i input.mp4 -c:v libx264 -f hls output.m3u8<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c<code>-i input.mp4<\/code>\u6307\u5b9a\u8f93\u5165\u89c6\u9891\u6587\u4ef6\uff0c<code>-c:v libx264<\/code>\u6307\u5b9a\u89c6\u9891\u7f16\u7801\u683c\u5f0f\u4e3aH.264\uff0c<code>-f hls<\/code>\u6307\u5b9a\u8f93\u51fa\u683c\u5f0f\u4e3aHLS\uff0c<code>output.m3u8<\/code>\u4e3a\u8f93\u51fa\u6587\u4ef6\u540d\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u96c6\u6210\u4e0e\u4f18\u5316<\/p>\n<\/p>\n<p><p>\u5c06\u4e0a\u8ff0\u6280\u672f\u96c6\u6210\u5230\u4e00\u4e2a\u5b8c\u6574\u7684\u89c6\u9891\u76f4\u64ad\u5e94\u7528\u4e2d\uff0c\u5e76\u8fdb\u884c\u4f18\u5316\u4ee5\u63d0\u9ad8\u6027\u80fd\u548c\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n<\/p>\n<ol>\n<li>\u96c6\u6210OpenCV\u548cFlask<\/li>\n<\/ol>\n<p><p>\u5c06OpenCV\u6355\u83b7\u7684\u89c6\u9891\u5e27\u901a\u8fc7Flask\u5e94\u7528\u53d1\u9001\u5230\u7f51\u9875\u4e0a\u8fdb\u884c\u76f4\u64ad\u3002\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2aHTML\u9875\u9762\u6765\u63a5\u6536\u89c6\u9891\u6d41\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-html\">&lt;!DOCTYPE html&gt;<\/p>\n<p>&lt;html lang=&quot;en&quot;&gt;<\/p>\n<p>&lt;head&gt;<\/p>\n<p>    &lt;meta charset=&quot;UTF-8&quot;&gt;<\/p>\n<p>    &lt;title&gt;Video Stream&lt;\/title&gt;<\/p>\n<p>&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<\/p>\n<p>    &lt;h1&gt;Video Stream&lt;\/h1&gt;<\/p>\n<p>    &lt;img src=&quot;{{ url_for(&#39;video_feed&#39;) }}&quot; width=&quot;640&quot; height=&quot;480&quot;&gt;<\/p>\n<p>&lt;\/body&gt;<\/p>\n<p>&lt;\/html&gt;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728Flask\u5e94\u7528\u4e2d\u8fd4\u56de\u8fd9\u4e2aHTML\u9875\u9762\uff0c\u5e76\u786e\u4fdd\u89c6\u9891\u6d41\u80fd\u591f\u6b63\u786e\u663e\u793a\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li>\u4f18\u5316\u6027\u80fd<\/li>\n<\/ol>\n<p><p>\u4e3a\u4e86\u63d0\u9ad8\u6027\u80fd\uff0c\u53ef\u4ee5\u8003\u8651\u4ee5\u4e0b\u4f18\u5316\u63aa\u65bd\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>\u964d\u4f4e\u5206\u8fa8\u7387<\/strong>\uff1a\u964d\u4f4e\u89c6\u9891\u6d41\u7684\u5206\u8fa8\u7387\u4ee5\u51cf\u5c11\u6570\u636e\u4f20\u8f93\u91cf\u3002<\/li>\n<li><strong>\u8c03\u6574\u5e27\u7387<\/strong>\uff1a\u51cf\u5c11\u5e27\u7387\u4ee5\u964d\u4f4eCPU\u8d1f\u8f7d\u548c\u5e26\u5bbd\u4f7f\u7528\u3002<\/li>\n<li><strong>\u4f7f\u7528\u591a\u7ebf\u7a0b<\/strong>\uff1a\u5728\u89c6\u9891\u6355\u83b7\u548c\u4f20\u8f93\u4e2d\u4f7f\u7528\u591a\u7ebf\u7a0b\uff0c\u4ee5\u63d0\u9ad8\u54cd\u5e94\u901f\u5ea6\u3002<\/li>\n<li><strong>\u4f7f\u7528\u5f02\u6b65\u6846\u67b6<\/strong>\uff1a\u4f7f\u7528\u5982FastAPI\u7b49\u5f02\u6b65\u6846\u67b6\u6765\u63d0\u9ad8\u5e76\u53d1\u80fd\u529b\u3002<\/li>\n<\/ul>\n<ol start=\"3\">\n<li>\u5904\u7406\u97f3\u9891<\/li>\n<\/ol>\n<p><p>\u5728\u89c6\u9891\u76f4\u64ad\u4e2d\uff0c\u97f3\u9891\u540c\u6837\u91cd\u8981\u3002\u53ef\u4ee5\u4f7f\u7528PyAudio\u5e93\u6765\u6355\u83b7\u97f3\u9891\u6d41\uff0c\u5e76\u5c06\u5176\u4e0e\u89c6\u9891\u6d41\u4e00\u8d77\u4f20\u8f93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pyaudio<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f7f\u7528PyAudio\u6355\u83b7\u97f3\u9891\uff0c\u5e76\u5728Flask\u5e94\u7528\u4e2d\u5c06\u97f3\u89c6\u9891\u6d41\u8fdb\u884c\u540c\u6b65\u4f20\u8f93\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u603b\u7ed3\u4e0e\u5c55\u671b<\/p>\n<\/p>\n<p><p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728Python\u4e2d\u4f7f\u7528OpenCV\u3001Flask\u3001FFmpeg\u5b9e\u73b0\u89c6\u9891\u76f4\u64ad\u3002\u901a\u8fc7\u7ed3\u5408\u8fd9\u4e9b\u5de5\u5177\uff0c\u53ef\u4ee5\u6784\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u89c6\u9891\u76f4\u64ad\u7cfb\u7edf\uff0c\u5e76\u6839\u636e\u5177\u4f53\u9700\u6c42\u8fdb\u884c\u6269\u5c55\u548c\u4f18\u5316\u3002\u5728\u672a\u6765\uff0c\u53ef\u4ee5\u8fdb\u4e00\u6b65\u63a2\u7d22\u5982\u4f55\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u76f4\u64ad\u529f\u80fd\uff0c\u5982\u5b9e\u65f6\u804a\u5929\u3001\u7528\u6237\u4ea4\u4e92\u3001\u89c6\u9891\u5f55\u5236\u7b49\uff0c\u4ee5\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u548c\u7cfb\u7edf\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u5b9e\u8df5\u8fd9\u4e9b\u6280\u672f\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u63d0\u5347Python\u7f16\u7a0b\u80fd\u529b\uff0c\u8fd8\u80fd\u66f4\u597d\u5730\u7406\u89e3\u89c6\u9891\u76f4\u64ad\u7684\u5b9e\u73b0\u539f\u7406\u548c\u6280\u672f\u7ec6\u8282\u3002\u5e0c\u671b\u672c\u6587\u80fd\u591f\u4e3a\u4f60\u5728Python\u9886\u57df\u7684\u89c6\u9891\u76f4\u64ad\u5f00\u53d1\u4e2d\u63d0\u4f9b\u4e00\u4e9b\u6709\u4ef7\u503c\u7684\u53c2\u8003\u548c\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u4f7f\u7528Python\u5e93\u5b9e\u73b0\u89c6\u9891\u76f4\u64ad\u529f\u80fd\uff1f<\/strong><br \/>\u8981\u5b9e\u73b0\u89c6\u9891\u76f4\u64ad\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2aPython\u5e93\uff0c\u4f8b\u5982OpenCV\u548cFlask\u3002OpenCV\u53ef\u4ee5\u7528\u4e8e\u6355\u83b7\u89c6\u9891\u6d41\uff0c\u800cFlask\u5219\u53ef\u4ee5\u4f5c\u4e3a\u8f7b\u91cf\u7ea7\u7684web\u6846\u67b6\u6765\u521b\u5efa\u76f4\u64ad\u670d\u52a1\u5668\u3002\u901a\u8fc7\u5c06\u89c6\u9891\u6d41\u4f20\u8f93\u5230Flask\u5e94\u7528\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u4e2d\u89c2\u770b\u76f4\u64ad\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u5b9e\u73b0\u89c6\u9891\u76f4\u64ad\u9700\u8981\u54ea\u4e9b\u73af\u5883\u914d\u7f6e\uff1f<\/strong><br \/>\u5728\u5f00\u59cb\u4e4b\u524d\uff0c\u786e\u4fdd\u5b89\u88c5\u4e86Python\u53ca\u76f8\u5173\u5e93\u3002\u60a8\u9700\u8981\u5b89\u88c5OpenCV\uff08<code>opencv-python<\/code>\uff09\u3001Flask\uff08<code>Flask<\/code>\uff09\u548c\u5176\u4ed6\u53ef\u80fd\u9700\u8981\u7684\u5e93\uff0c\u5982NumPy\u3002\u6b64\u5916\uff0c\u786e\u4fdd\u60a8\u7684\u5f00\u53d1\u73af\u5883\u652f\u6301\u89c6\u9891\u6355\u83b7\u529f\u80fd\uff0c\u6bd4\u5982\u914d\u7f6e\u5408\u9002\u7684\u6444\u50cf\u5934\u9a71\u52a8\u3002<\/p>\n<p><strong>\u5982\u4f55\u786e\u4fdd\u89c6\u9891\u76f4\u64ad\u7684\u6d41\u7545\u6027\u548c\u7a33\u5b9a\u6027\uff1f<\/strong><br \/>\u4e3a\u4e86\u786e\u4fdd\u76f4\u64ad\u7684\u6d41\u7545\u6027\uff0c\u5efa\u8bae\u4f7f\u7528\u5408\u9002\u7684\u89c6\u9891\u7f16\u7801\u683c\u5f0f\uff0c\u5982H.264\uff0c\u5e76\u8c03\u6574\u5206\u8fa8\u7387\u548c\u5e27\u7387\u4ee5\u9002\u5e94\u7f51\u7edc\u6761\u4ef6\u3002\u4f7f\u7528\u7ebf\u7a0b\u5904\u7406\u89c6\u9891\u6d41\u53ef\u4ee5\u51cf\u5c11\u5ef6\u8fdf\uff0c\u5e76\u901a\u8fc7\u8d1f\u8f7d\u5747\u8861\u65b9\u6cd5\u6765\u5e94\u5bf9\u9ad8\u5e76\u53d1\u8bbf\u95ee\uff0c\u4ece\u800c\u63d0\u5347\u7a33\u5b9a\u6027\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728\u76f4\u64ad\u4e2d\u6dfb\u52a0\u97f3\u9891\u529f\u80fd\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pyaudio<\/code>\u5e93\u6765\u5904\u7406\u97f3\u9891\u6d41\u5e76\u4e0e\u89c6\u9891\u76f4\u64ad\u76f8\u7ed3\u5408\u3002\u901a\u8fc7\u5c06\u97f3\u9891\u6d41\u548c\u89c6\u9891\u6d41\u540c\u6b65\uff0c\u53ef\u4ee5\u5b9e\u73b0\u66f4\u597d\u7684\u76f4\u64ad\u4f53\u9a8c\u3002\u5177\u4f53\u5b9e\u73b0\u4e2d\uff0c\u9700\u8981\u786e\u4fdd\u97f3\u9891\u4e0e\u89c6\u9891\u7684\u5e27\u7387\u5339\u914d\uff0c\u907f\u514d\u51fa\u73b0\u4e0d\u540c\u6b65\u7684\u95ee\u9898\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u5728Python\u4e2d\u5b9e\u73b0\u89c6\u9891\u76f4\u64ad\uff0c\u53ef\u4ee5\u4f7f\u7528OpenCV\u3001FFmpeg\u3001Flask\u7b49\u5de5\u5177\u3002\u9996\u5148\uff0c\u4f7f\u7528OpenCV\u6355 [&hellip;]","protected":false},"author":3,"featured_media":957973,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/957968"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=957968"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/957968\/revisions"}],"predecessor-version":[{"id":957975,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/957968\/revisions\/957975"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/957973"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=957968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=957968"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=957968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}