{"id":564605,"date":"2023-05-29T14:18:30","date_gmt":"2023-05-29T06:18:30","guid":{"rendered":"http:\/\/4563.org\/?p=564605"},"modified":"2023-05-29T14:18:30","modified_gmt":"2023-05-29T06:18:30","slug":"%e5%88%a9%e7%94%a8ffmpeg%e6%8e%a8%e6%b5%81b%e7%ab%99724%e7%9b%b4%e6%92%ad","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=564605","title":{"rendered":"\u5229\u7528ffmpeg\u63a8\u6d41b\u7ad97*24\u76f4\u64ad"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>minick<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>\u5229\u7528ffmpeg\u63a8\u6d41b\u7ad97*24\u76f4\u64ad<\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 minick \u4e8e 2023-5-28 20:42 \u7f16\u8f91 <\/p>\n<p> \u6628\u5929\u770b\u89c1\u8bba\u575b\u5927\u4f6c\u5199\u4e86\u4e2a\u7528kplayer\u63a8\u6d41\u7684\u6559\u7a0b\uff0c\u6211\u8fd0\u884c\u65f6\u76f4\u64ad\u4e00\u6bb5\u65f6\u95f4\u540e\u4f1a\u62a5\u9519<\/p>\n<p>  \u6240\u4ee5\u5728\u7f51\u4e0a\u627e\u4e86\u4e0b \u770b\u89c1\u7528ffmpeg\u597d\u50cf\u66f4\u597d<\/p>\n<p>  \u6211\u642d\u5efa\u7684\u6d4b\u8bd5\u76f4\u64ad\u95f4\uff1ahttp:\/\/live.bilibili.com\/2504721<\/p>\n<p>  github\u5730\u5740https:\/\/github.com\/x-dr\/bilive24h<\/p>\n<p>  https:\/\/s1.img.ink\/2023\/05\/28\/2b87b47917299.png<\/p>\n<p>  \u5b89\u88c5ffmpeg<\/p>\n<p>  wget https:\/\/johnvansickle.com\/ffmpeg\/releases\/ffmpeg-release-amd64-static.tar.xz<br \/>  tar -xJf ffmpeg-release-amd64-static.tar.xz<br \/>  cp -r ffmpeg-6.0-amd64-static \/usr\/local\/ffmpeg<\/p>\n<p>  \u5728~\/.bashrc\u6587\u4ef6\u6dfb\u52a0\u4e00\u884c<br \/>  export PATH=$PATH:\/usr\/local\/ffmpeg<br \/>  \u7136\u540e\u8fd0\u884c<br \/>  source .bashrc<\/p>\n<p>  \u63a8\u6d41\u811a\u672c<\/p>\n<p>  # \u989c\u8272\u9009\u62e9<br \/>  red=&#8217;\u000033[0;31m&#8217;<br \/>  green=&#8217;\u000033[0;32m&#8217;<br \/>  yellow=&#8217;\u000033[0;33m&#8217;<br \/>  font=&quot;\u000033[0m&quot;<\/p>\n<p>  stream_start(){<br \/>  # \u5b9a\u4e49\u63a8\u6d41\u5730\u5740\u548c\u63a8\u6d41\u7801<br \/>  echo -e &quot;${yellow} \u5f00\u59cb\u8bbe\u7f6e\u63a8\u6d41\uff0c\u4f7f\u7528\u9ed8\u8ba4\u9009\u9879\u76f4\u63a5\u56de\u8f66 ${font}&quot;<br \/>  echo -e &quot;${yellow} ps\uff1a\u63a8\u6d41\u5730\u5740\u662fb\u7ad9\u6211\u7684\u76f4\u64ad\uff0c\u670d\u52a1\u5668\u5730\u5740\u548c\u4e32\u6d41\u5bc6\u94a5\u8fde\u5728\u4e00\u8d77\u4e2d\u95f4\u65e0\u9700\u7a7a\u683c\u548c\u9017\u53f7 ${font}&quot;<br \/>  read -p &quot;\u203b \u8f93\u5165\u4f60\u7684\u670d\u52a1\u5668\u5730\u5740\u548c\u4e32\u6d41\u5bc6\u94a5(rtmp\u534f\u8bae): &quot; rtmp<\/p>\n<p>  # \u5224\u65ad\u7528\u6237\u8f93\u5165\u7684\u5730\u5740\u662f\u5426\u5408\u6cd5<br \/>  if [[ $rtmp =~ &quot;rtmp:\/\/&quot; ]];then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo -e &quot;${green} \u63a8\u6d41\u5730\u5740\u8f93\u5165\u6b63\u786e,\u7a0b\u5e8f\u5c06\u8fdb\u884c\u4e0b\u4e00\u6b65\u64cd\u4f5c. ${font}&quot;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;sleep 2<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;else<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo -e &quot;${red} \u4f60\u8f93\u5165\u7684\u5730\u5740\u4e0d\u5408\u6cd5,\u8bf7\u91cd\u65b0\u8fd0\u884c\u7a0b\u5e8f\u5e76\u8f93\u5165! ${font}&quot;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;exit 1<br \/>  fi<\/p>\n<p>  # \u5b9a\u4e49\u89c6\u9891\u5b58\u653e\u76ee\u5f55<br \/>  echo -e &quot;${yellow} \u811a\u672c\u4f1a\u63a8\u6d41\u6240\u8bbe\u7f6e\u76ee\u5f55\u4e0b\u7684\u6240\u6709\u89c6\u9891 ${font}&quot;<br \/>  read -p &quot;\u8f93\u5165\u4f60\u7684\u89c6\u9891\u5b58\u653e\u76ee\u5f55(\u5e76\u4e14\u8981\u7edd\u5bf9\u8def\u5f84,\u9ed8\u8ba4\/video): &quot; folder<br \/>  if [ ! $folder ];then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;folder=&quot;\/video&quot;<br \/>  fi<\/p>\n<p>  # \u5b9a\u4e49\u89c6\u9891\u548c\u97f3\u9891\u7801\u7387<br \/>  read -p &quot;\u8bf7\u8f93\u5165\u89c6\u9891\u63a8\u6d41\u7801\u7387(\u9ed8\u8ba44000k): &quot; bv<br \/>  read -p &quot;\u8bf7\u8f93\u5165\u97f3\u9891\u63a8\u6d41\u7801\u7387(\u9ed8\u8ba4192k): &quot; ba<br \/>  if [ ! $bv ];then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;bv=&quot;4000k&quot;<br \/>  fi<br \/>  if [ ! $ba ];then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;ba=&quot;192k&quot;<br \/>  fi<\/p>\n<p>  # \u5224\u65ad\u662f\u5426\u9700\u8981\u6dfb\u52a0\u6c34\u5370<br \/>  read -p &quot;\u662f\u5426\u9700\u8981\u4e3a\u89c6\u9891\u6dfb\u52a0\u6c34\u5370?\u6c34\u5370\u4f4d\u7f6e\u9ed8\u8ba4\u5728\u53f3\u4e0a\u65b9,\u9700\u8981\u8f83\u597dCPU\u652f\u6301. \u9ed8\u8ba4\u4e0d\u52a0,\u6dfb\u52a0\u8bf7\u8f93\u5165y:&quot; watermark<br \/>  if [ $watermark = &quot;y&quot; ];then<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;read -p &quot;\u8f93\u5165\u4f60\u7684\u6c34\u5370\u56fe\u7247\u5b58\u653e\u7edd\u5bf9\u8def\u5f84,\u4f8b\u5982\/opt\/image\/watermark.jpg (\u683c\u5f0f\u652f\u6301jpg\/png\/bmp):&quot; image<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo -e &quot;${yellow} \u6dfb\u52a0\u6c34\u5370\u5b8c\u6210,\u7a0b\u5e8f\u5c06\u5f00\u59cb\u63a8\u6d41. ${font}&quot;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;# \u5faa\u73af<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;while true<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;do<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; cd $folder<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; video=$(find .\/ -type f | shuf -n 1)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ffmpeg -re -i &quot;$video&quot; -i &quot;$image&quot; -filter_complex overlay=W-w-5:5 -preset ultrafast-g 25 -b:v ${bv} -c:a aac -b:a ${ba} -strict -2 -f flv ${rtmp}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;done<br \/>  else<br \/>  &nbsp; &nbsp; echo -e &quot;${yellow} \u4f60\u9009\u62e9\u4e0d\u6dfb\u52a0\u6c34\u5370,\u7a0b\u5e8f\u5c06\u5f00\u59cb\u63a8\u6d41. ${font}&quot;<br \/>  &nbsp; &nbsp; # \u5faa\u73af<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;while true<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;do<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; cd $folder<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; video=$(find .\/ -type f | shuf -n 1)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ffmpeg -re -i &quot;$video&quot; -preset ultrafast -vcodec libx264 -g 25 -b:v ${bv} -c:a aac -b:a ${ba} -strict -2 -f flv ${rtmp}<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;done<br \/>  fi<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;}<\/p>\n<p>  # \u505c\u6b62\u63a8\u6d41<br \/>  stream_stop(){<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;screen -S bilive -X quit<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;}<\/p>\n<p>  # \u5f00\u59cb\u83dc\u5355\u8bbe\u7f6e<br \/>  echo -e &quot;${yellow} FFmpeg\u65e0\u4eba\u503c\u5b88\u5faa\u73af\u63a8\u6d41 ${font}&quot;<br \/>  echo -e &quot;${red} \u8fd0\u884c\u63a8\u6d41\u65f6\u8bf7\u786e\u5b9a\u6b64\u811a\u672c\u76ee\u524d\u662f\u5728screen\u7a97\u53e3\u5185\u8fd0\u884c\u7684! ${font}&quot;<br \/>  echo -e &quot;${red} \u8fd0\u884c\u63a8\u6d41\u65f6\u82e5\u672a\u5728screen\u7a97\u53e3\u5185\u8bf7\u5148\u8fd0\u884cscreen -S bilive ${font}&quot;<br \/>  echo -e &quot;${green} 1.\u5f00\u59cb\u65e0\u4eba\u503c\u5b88\u5faa\u73af\u63a8\u6d41 ${font}&quot;<br \/>  echo -e &quot;${green} 2.\u505c\u6b62\u63a8\u6d41 ${font}&quot;<br \/>  start_menu(){<br \/>  &nbsp; &nbsp; read -p &quot;\u8bf7\u8f93\u5165\u6570\u5b57(1-2),\u9009\u62e9\u4f60\u8981\u8fdb\u884c\u7684\u64cd\u4f5c:&quot; num<br \/>  &nbsp; &nbsp; case &quot;$num&quot; in<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;1)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;stream_start<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;;;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;2)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;stream_stop<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;;;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;*)<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;echo -e &quot;${red} \u8bf7\u8f93\u5165\u6b63\u786e\u7684\u6570\u5b57 (1-2) ${font}&quot;<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;;;<br \/>  &nbsp; &nbsp; esac<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;}<\/p>\n<p>  # \u8fd0\u884c\u5f00\u59cb\u83dc\u5355<br \/>  start_menu  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>gzlock<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u697c\u4e3b\u8fd9\u4e2a\u9002\u5408linux cli\u7cfb\u7edf<br \/>  \u5982\u679c\u5728windows\u91cc\uff0c\u7528obs\u53ef\u4ee5\u5b9e\u73b0\u89c6\u9891\u6587\u4ef6\u5217\u8868\u8f6e\u64ad\uff0c\u66f4\u4e3a\u65b9\u4fbf\u7ba1\u7406\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>keaideo<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6765\u4e2a\u4e00\u952e\u811a\u672c\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>kimjames<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u53ef\u4ee5\u554a\u6548\u679c\u4e0d\u9519\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>igger<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u5927\u4f6cNB,\u867d\u7136\u7528\u4e0d\u4e0a,\u9876\u4e00\u4e2a.  \t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>gajiodgaj<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u4fee\u590d\u7248\u7535\u5f71\u5417\uff0c\u5206\u8fa8\u7387\u5f88\u9ad8\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u9e21\u573a\u65b0\u4eba<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u53ef\u4ee5\u63a8\u6d41\u5230\u6cb9\u7ba1\u5417\uff1f\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>1121744186<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6709\u76f8\u5173\u7684\u8f6f\u4ef6\u548c\u63d2\u4ef6\uff0c\u90a3\u4e9b\u64ad\u7535\u5f71\u7684\u5c31\u662f\u7528\u7684\u90a3\u4e2a\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>minick<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tgajiodgaj \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2023-5-28 20:48<br \/>  \u4fee\u590d\u7248\u7535\u5f71\u5417\uff0c\u5206\u8fa8\u7387\u5f88\u9ad8<\/p>\n<p> \u4e0d\u77e5\u9053\u7f51\u4e0a\u627e\u7684\u8d44\u6e90\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u767e\u76db\u767e\u5bb6\u4e50<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u76f4\u63a5\u6302\u683d\u7f51\u76d8\uff0c\u89c6\u9891\u4e0d\u7528\u4e0b\u8f7d\u5230\u670d\u52a1\u5668\u76f4\u63a5\u63a8\u6d41\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u884c\u5c38\u8d70\u8089<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u819c\u62dc\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>minick \u5927\u4f6c\u6709\u8bdd\u8bf4 : \u5229\u7528&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/564605"}],"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=564605"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/564605\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=564605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=564605"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=564605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}