{"id":48174,"date":"2020-03-08T15:07:01","date_gmt":"2020-03-08T07:07:01","guid":{"rendered":"http:\/\/4563.org\/?p=48174"},"modified":"2020-03-08T15:07:04","modified_gmt":"2020-03-08T07:07:04","slug":"%e8%a7%86%e9%a2%91%e5%88%87%e7%89%87%e5%90%8e%e8%87%aa%e5%8a%a8%e4%b8%8a%e4%bc%a0%e8%87%b3%e5%9b%bd%e5%86%85%e5%85%8d%e8%b4%b9cdn%ef%bc%8c%e6%97%a0%e6%88%90%e6%9c%ac%e5%8a%a0%e9%80%9f%e8%a7%86","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=48174","title":{"rendered":"\u89c6\u9891\u5207\u7247\u540e\u81ea\u52a8\u4e0a\u4f20\u81f3\u56fd\u5185\u514d\u8d39CDN\uff0c\u65e0\u6210\u672c\u52a0\u901f\u89c6\u9891\u64ad\u653e"},"content":{"rendered":"<p><strong>\u8bf4\u660e\uff1a<\/strong>\u4e00\u822c\u6211\u4eec\u89c2\u770b\u81ea\u5df1\u4e0b\u8f7d\u7684\u7535\u5f71\u65f6\u5019\uff0c\u901a\u5e38\u4f1a\u56e0\u4e3a\u7f51\u7edc\u6216\u8005\u5e26\u5bbd\u539f\u56e0\u5f88\u5361\uff0c\u6240\u4ee5\u5c31\u5f97\u5904\u7406\u4e0b\uff0c\u8fd9\u91cc<a href=\"https:\/\/moeclub.org\/\" target=\"_blank\" rel=\"noopener\">\u840c\u5496<\/a>\u5927\u4f6c\u95ed\u5173\u534a\u4e2a\u6708\uff0c\u5199\u51fa\u4e86\u4e00\u4e2a\u89c6\u9891\u8f6c\u7801\u5207\u7247\u540e\u81ea\u52a8\u4e0a\u4f20\u81f3\u56fd\u5185<code>cdn<\/code>\u7684\u811a\u672c\uff0c\u811a\u672c\u9ed8\u8ba4\u63d0\u4f9b\u4e0a\u4f20\u5230\u8bed\u96c0<code>cdn<\/code>\u7684\u811a\u672c\u3001\u91c7\u7528\u591a\u7ebf\u7a0b\u4e0a\u4f20\uff0c\u8fd9\u91cc\u9ed8\u8ba4<code>10<\/code>\u7ebf\u7a0b\uff0c\u57fa\u672c\u4e0a\u53ef\u4ee5\u5f88\u5927\u7a0b\u5ea6\u4e0a\u63d0\u9ad8\u89c6\u9891\u7684\u64ad\u653e\u901f\u5ea6\u3002<\/p>\n<div data-unique=\"\u4f7f\u7528\"><\/div>\n<h2>\u4f7f\u7528<\/h2>\n<p><strong>Github\u5730\u5740\uff1a<\/strong><a href=\"https:\/\/github.com\/MoeClub\/Note\/tree\/master\/ffmpeg\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/MoeClub\/Note\/tree\/master\/ffmpeg<\/a><\/p>\n<p><strong>1\u3001\u5b89\u88c5ffmpeg<\/strong><\/p>\n<pre><code class=\"hljs javascript\">wget https:<span class=\"hljs-comment\">\/\/www.moerats.com\/usr\/down\/ffmpeg\/ffmpeg-git-$(getconf LONG_BIT)bit-static.tar.xz<\/span>\r\ntar xvf ffmpeg-git-*-<span class=\"hljs-keyword\">static<\/span>.tar.xz\r\nmv ffmpeg-git-*<span class=\"hljs-regexp\">\/ffmpeg  ffmpeg-git-*\/<\/span>ffprobe \/usr\/local\/bin\/\r\nrm -rf ffmpeg-git-*\r\n<\/code><\/pre>\n<p><strong>2\u3001\u6ce8\u518c\u8bed\u96c0<\/strong><br \/>\n\u5148\u524d\u5f80\u8bed\u96c0\u5b98\u7f51\u6ce8\u518c\u4e00\u4e2a\u8d26\u53f7\u2192<a href=\"https:\/\/www.yuque.com\/\" target=\"_blank\" rel=\"noopener\">\u4f20\u9001\u95e8<\/a>\uff0c\u7136\u540e\u83b7\u53d6<code>ctoken<\/code>\u548c<code>session<\/code>\u7684\u503c\uff0c\u8fd9\u91cc\u8bf4\u4e0b\u5927\u6982\u83b7\u53d6\u65b9\u6cd5\uff0c\u4ee5\u8c37\u6b4c\u6d4f\u89c8\u5668\u4e3a\u4f8b\u3002<\/p>\n<p>\u767b\u5f55\u540e\uff0c<code>F12<\/code>\u8fdb\u5165\u63a7\u5236\u53f0\u9009\u62e9<code>Network<\/code>\uff0c\u968f\u4fbf\u70b9\u51fb\u4e00\u4e2a\u4ee5<code>yuque<\/code>\u5f00\u5934\u7684\u94fe\u63a5\u6587\u4ef6\uff0c\u518d\u9009\u62e9<code>Cookies<\/code>\u5373\u53ef\u770b\u5230\u6240\u9700\u8981\u7684<code>2<\/code>\u4e2a\u53c2\u6570\u3002<br \/>\n<a class=\"light-link\" href=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/03\/m3u8_cdn.png\" data-fancybox=\"gallery\" data-type=\"image\" data-caption=\"\u8bf7\u8f93\u5165\u56fe\u7247\u63cf\u8ff0\"><img decoding=\"async\" title=\"\u8bf7\u8f93\u5165\u56fe\u7247\u63cf\u8ff0\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/03\/m3u8_cdn.png\" alt=\"\u8bf7\u8f93\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/a><br \/>\n\u7136\u540e\u590d\u5236<code>ctoken<\/code>\u548c<code>session<\/code>\u7684\u503c\u3002<\/p>\n<p><strong>3\u3001\u5b89\u88c5\u811a\u672c<\/strong><\/p>\n<pre><code class=\"hljs nginx\"><span class=\"hljs-comment\">#\u65b0\u5efa\/opt\/ffmpeg\u6587\u4ef6\u5939\u5b58\u653e\u811a\u672c\u7b49\u6587\u4ef6<\/span>\r\n<span class=\"hljs-attribute\">mkdir<\/span> \/opt\/ffmpeg &amp;&amp; cd <span class=\"hljs-variable\">$_<\/span>\r\n<span class=\"hljs-comment\">#\u4e0b\u8f7d\u811a\u672c<\/span>\r\nwget https:\/\/raw.githubusercontent.com\/MoeClub\/Note\/master\/ffmpeg\/Install.sh\r\n<span class=\"hljs-comment\">#\u628a\u540e\u97622\u4e2a\u53c2\u6570\u6539\u6210\u4f60\u83b7\u53d6\u5230\u7684ctoken\u548csession\u540e\u518d\u8fd0\u884c\uff0c\u4fee\u6539\u540e\u8bf7\u4e0d\u8981\u5e26\u4e0a&lt;&gt;<\/span>\r\nbash Install.sh &lt;yuque_ctoken&gt; &lt;yuque_session&gt;\r\n<\/code><\/pre>\n<p>\u5982\u679c\u586b\u9519\u4e86\u6216\u8005\u540e\u9762\u60f3\u4fee\u6539<code>ctoken<\/code>\u548c<code>session<\/code>\uff0c\u5c31\u76f4\u63a5\u4fee\u6539<code>upload.sh<\/code>\u6587\u4ef6\u5373\u53ef\u3002<\/p>\n<p><strong>4\u3001\u542f\u52a8\u64ad\u653e\u5668<\/strong><br \/>\n\u7531\u4e8e\u5207\u7247\u751f\u6210<code>m3u8<\/code>\u6587\u4ef6\u540e\uff0c\u9700\u8981\u64ad\u653e\u5668\u624d\u80fd\u64ad\u653e\uff0c\u800c\u4e0a\u4f20\u811a\u672c\u4e5f\u4f1a\u81ea\u52a8\u63a8\u9001<code>m3u8<\/code>\u6587\u4ef6\u5230\u64ad\u653e\u5668\u6839\u76ee\u5f55\uff0c\u6240\u4ee5\u8fd9\u91cc\u53ef\u4ee5\u914d\u5408\u4e00\u8d77\u7528\uff0c\u5f53\u7136\u81ea\u5df1\u4f1a\u64ad\u653e<code>m3u8<\/code>\u7684\u4e5f\u53ef\u4ee5\u4e0d\u7528\u642d\u5efa\uff0c\u81ea\u884c\u9009\u62e9\u3002<\/p>\n<p>\u5b89\u88c5<code>pip3<\/code>\uff1a<\/p>\n<pre><code class=\"hljs cs\"><span class=\"hljs-meta\">#CenOS 6\u7cfb\u7edf<\/span>\r\nrpm -Uvh https:<span class=\"hljs-comment\">\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-6.noarch.rpm<\/span>\r\nyum install python34 -y\r\nwget https:<span class=\"hljs-comment\">\/\/bootstrap.pypa.io\/get-pip.py<\/span>\r\npython3 <span class=\"hljs-keyword\">get<\/span>-pip.py\r\n\r\n<span class=\"hljs-meta\">#CenOS 7\u7cfb\u7edf<\/span>\r\nrpm -Uvh https:<span class=\"hljs-comment\">\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-7.noarch.rpm<\/span>\r\nyum install python36 -y\r\nwget https:<span class=\"hljs-comment\">\/\/bootstrap.pypa.io\/get-pip.py<\/span>\r\npython3 <span class=\"hljs-keyword\">get<\/span>-pip.py\r\n\r\n<span class=\"hljs-meta\">#Debian\/Ubuntu\u7cfb\u7edf<\/span>\r\napt update\r\napt install python3-pip -y\r\n<\/code><\/pre>\n<p>\u5b89\u88c5\u4f9d\u8d56\uff1a<\/p>\n<pre><code class=\"hljs nginx\"><span class=\"hljs-comment\">#\u8fdb\u5165\u5230\u64ad\u653e\u6e90\u7801\u6587\u4ef6\u5939<\/span>\r\n<span class=\"hljs-attribute\">cd<\/span> \/opt\/ffmpeg\/Player\r\npip3 install tornado\r\n<\/code><\/pre>\n<p>\u540e\u53f0\u542f\u52a8\uff1a<\/p>\n<pre><code class=\"hljs css\"><span class=\"hljs-selector-tag\">nohup<\/span> <span class=\"hljs-selector-tag\">python3<\/span> <span class=\"hljs-selector-tag\">Player<\/span><span class=\"hljs-selector-class\">.py<\/span>&amp;\r\n<\/code><\/pre>\n<p>\u6ce8\u610f<code>Player.py<\/code>\u6587\u4ef6\u7684<code>MasterKey<\/code>\u503c\u9700\u548c<code>publish.sh<\/code>\u7684<code>Token<\/code>\u503c\u5bf9\u5e94\uff0c\u522b\u4e71\u6539\u5c31\u884c\u3002<\/p>\n<p><strong>5\u3001\u811a\u672c\u7528\u6cd5<\/strong><\/p>\n<pre><code class=\"hljs shell\"><span class=\"hljs-meta\">#<\/span><span class=\"bash\">\u547d\u4ee4\u793a\u4f8b<\/span>\r\nbash \/path\/to\/media.sh &lt;\u4e0d\u542b\u7279\u6b8a\u5b57\u7b26\u7684\u6587\u4ef6\u540d.mp4&gt; [\u7279\u6b8a\u9009\u9879]\r\n<span class=\"hljs-meta\">\r\n#<\/span><span class=\"bash\">\u7279\u6b8a\u9009\u9879: \u6570\u5b57\uff1b\u53ef\u9009\u53c2\u6570\uff0c\u9ed8\u8ba4\u4e3a0<\/span>\r\n<span class=\"hljs-meta\">#<\/span><span class=\"bash\">0\uff1a\u81ea\u52a8\u6839\u636e\u6587\u4ef6\u6bd4\u7279\u7387\u8ba1\u7b97\u5408\u9002\u7684\u5207\u7247\u5927\u5c0f\u3002(\u76ee\u6807\u6587\u4ef6\u5927\u5c0f\u5c0f\u4e8e20M\uff0c\u4e00\u822c\u60c5\u51b5\u4e0b\u6ca1\u95ee\u9898)<\/span>\r\n<span class=\"hljs-meta\">#<\/span><span class=\"bash\">1\uff1a\u5f3a\u5236\u91cd\u65b0\u7f16\u7801\uff0c\u91cd\u65b0\u7f16\u7801\u6bd4\u7279\u7387\u4e3a2400k\u3002(\u4e00\u822c\u7528\u4e8e\u975eH264\u7f16\u7801\uff0c\u6587\u4ef6\u5207\u7247\uff0c\u901f\u5ea6\u8f83\u6162)<\/span>\r\n<span class=\"hljs-meta\">#<\/span><span class=\"bash\">2\uff1a\u81ea\u5b9a\u4e49\u5207\u7247\u65f6\u95f4\uff0c\u5f53\u4e3a2\u65f6\u5207\u7247\u65f6\u95f4\u4e3a3\u79d2\uff0c\u5f53\u5927\u4e8e\u7b49\u4e8e3\u65f6\u5207\u7247\u65f6\u95f4\u4e3a\u7279\u6b8a\u9009\u9879\u6570\u5b57\u3002<\/span>\r\n<\/code><\/pre>\n<p>\u4f7f\u7528\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"hljs shell\"><span class=\"hljs-meta\">#<\/span><span class=\"bash\">\u8fdb\u5165\u89c6\u9891\u6240\u5728\u76ee\u5f55<\/span>\r\ncd \/root\/movies\r\n<span class=\"hljs-meta\">\r\n#<\/span><span class=\"bash\">\u9ed8\u8ba4\u6a21\u5f0f\u5207\u7247<\/span>\r\nbash \/opt\/ffmpeg\/media.sh rats.mp4\r\n<span class=\"hljs-meta\">#<\/span><span class=\"bash\">\u5f3a\u5236\u91cd\u65b0\u7f16\u7801<\/span>\r\nbash \/opt\/ffmpeg\/media.sh rats.mp4 1\r\n<span class=\"hljs-meta\">#<\/span><span class=\"bash\">\u8bbe\u7f6e3s\u4e00\u4e2a\u5207\u7247<\/span>\r\nbash \/opt\/ffmpeg\/media.sh rats.mp4 3\r\n<\/code><\/pre>\n<p><strong>6\u3001\u64ad\u653e\u793a\u4f8b<\/strong><\/p>\n<pre><code class=\"hljs objectivec\"><span class=\"hljs-meta\">#\u67e5\u770b\u63a8\u9001\u5230\u64ad\u653e\u5668\u8fd9\u8fb9\u7684m3u8\u6240\u6709\u6587\u4ef6<\/span>\r\nhttp:<span class=\"hljs-comment\">\/\/ip:5866\/Player\/list<\/span>\r\n\r\n<span class=\"hljs-meta\">#\u64ad\u653elist\u663e\u793a\u7684\u6839\u76ee\u5f55\u4e0b\u7684rats.m3u8\u6587\u4ef6<\/span>\r\nhttp:<span class=\"hljs-comment\">\/\/ip:5866\/Player\/rats.m3u8<\/span><\/code><\/pre>\n<p>\u8fd9\u91cc\u5982\u679c\u4f60\u662f<code>vps<\/code>\u7684\u8bdd\uff0c\u5c31\u4e0d\u5efa\u8bae\u5f3a\u5236\u8f6c\u7801\uff0c\u53ea\u5207\u7247\u5c31\u884c\u4e86\uff0c\u4e0d\u7136\u957f\u65f6\u95f4\u5360\u7528<code>cpu<\/code>\u7684\u8bdd\uff0c\u670d\u52a1\u5668\u53ef\u80fd\u4f1a\u88ab<code>ban<\/code>\uff0c\u57fa\u672c\u4e0a\u5927\u591a\u6570<code>mp4<\/code>\u90fd\u53ef\u4ee5\u76f4\u63a5\u5207\u7247\u3002<\/p>\n<p>\u4f86\u6e90:https:\/\/www.moerats.com\/archives\/1024\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf4\u660e\uff1a\u4e00\u822c\u6211\u4eec\u89c2\u770b\u81ea\u5df1\u4e0b\u8f7d\u7684\u7535\u5f71\u65f6&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/48174"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=48174"}],"version-history":[{"count":1,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/48174\/revisions"}],"predecessor-version":[{"id":48208,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/48174\/revisions\/48208"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=48174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=48174"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=48174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}