{"id":313870,"date":"2024-05-20T23:16:57","date_gmt":"2024-05-20T15:16:57","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/313870.html"},"modified":"2024-05-20T23:17:03","modified_gmt":"2024-05-20T15:17:03","slug":"ffmpeg-%e7%9a%84%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4%e6%9c%89%e5%93%aa%e4%ba%9b","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/313870.html","title":{"rendered":"ffmpeg \u7684\u5e38\u7528\u547d\u4ee4\u6709\u54ea\u4e9b"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27033231\/bcde69cb-6bae-4c5e-964c-85a82a57e450.webp\" alt=\"ffmpeg \u7684\u5e38\u7528\u547d\u4ee4\u6709\u54ea\u4e9b\" \/><\/p>\n<p><p>FFmpeg\u662f\u4e00\u6b3e\u529f\u80fd\u5f3a\u5927\u3001\u9ad8\u5ea6\u7075\u6d3b\u7684\u5f00\u6e90\u591a\u5a92\u4f53\u6846\u67b6\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u89c6\u9891\u5904\u7406\u3001\u683c\u5f0f\u8f6c\u6362\u3001\u89c6\u9891\u5f55\u5236\u7b49\u9886\u57df\u3002<strong>\u5e38\u7528\u7684FFmpeg\u547d\u4ee4\u5305\u62ec\u89c6\u9891\u8f6c\u7801\u3001\u526a\u5207\u89c6\u9891\u3001\u5408\u5e76\u89c6\u9891\u3001\u63d0\u53d6\u97f3\u9891\u3001\u89c6\u9891\u622a\u56fe<\/strong>\u7b49\u3002\u5728\u8fd9\u4e9b\u5e94\u7528\u4e2d\uff0c<strong>\u89c6\u9891\u8f6c\u7801<\/strong>\u662f\u6700\u6838\u5fc3\u7684\u529f\u80fd\u4e4b\u4e00\uff0c\u4e0d\u4ec5\u53ef\u4ee5\u5b9e\u73b0\u4e0d\u540c\u683c\u5f0f\u4e4b\u95f4\u7684\u8f6c\u6362\uff0c\u8fd8\u80fd\u8c03\u6574\u89c6\u9891\u7684\u5404\u79cd\u53c2\u6570\uff0c\u4ee5\u6ee1\u8db3\u4e0d\u540c\u7684\u64ad\u653e\u9700\u6c42\u548c\u7f51\u7edc\u6761\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u89c6\u9891\u8f6c\u7801<\/h3>\n<\/p>\n<p><p>\u89c6\u9891\u8f6c\u7801\u662f\u5c06\u89c6\u9891\u6587\u4ef6\u4ece\u4e00\u79cd\u683c\u5f0f\u8f6c\u6362\u4e3a\u53e6\u4e00\u79cd\u683c\u5f0f\u7684\u8fc7\u7a0b\uff0c\u901a\u5e38\u6d89\u53ca\u5230\u7f16\u89e3\u7801\u5668\u7684\u53d8\u66f4\u3002FFmpeg\u901a\u8fc7\u7b80\u5355\u7684\u547d\u4ee4\u884c\u64cd\u4f5c\u5b9e\u73b0\u5f3a\u5927\u7684\u8f6c\u7801\u529f\u80fd\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u683c\u5f0f\u8f6c\u6362<\/strong>\uff1a\u4f7f\u7528<code>ffmpeg -i input.mp4 output.avi<\/code>\u547d\u4ee4\u53ef\u4ee5\u5c06MP4\u683c\u5f0f\u7684\u89c6\u9891\u8f6c\u6362\u4e3aAVI\u683c\u5f0f\u3002\u8fd9\u91cc\u7684<code>-i<\/code>\u6807\u5fd7\u6307\u5b9a\u8f93\u5165\u6587\u4ef6\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8c03\u6574\u5206\u8fa8\u7387<\/strong>\uff1a\u901a\u8fc7\u6dfb\u52a0<code>-s<\/code>\u53c2\u6570\uff0c\u4f8b\u5982<code>ffmpeg -i input.mp4 -s 640x480 output.mp4<\/code>\uff0c\u53ef\u4ee5\u6539\u53d8\u89c6\u9891\u7684\u5206\u8fa8\u7387\uff0c\u8fd9\u5728\u9700\u8981\u5c06\u89c6\u9891\u9002\u914d\u4e0d\u540c\u8bbe\u5907\u64ad\u653e\u65f6\u5f88\u6709\u7528\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>\u4e8c\u3001\u526a\u5207\u89c6\u9891<\/h3>\n<\/p>\n<p><p>\u526a\u5207\u89c6\u9891\u53ef\u4ee5\u79fb\u9664\u89c6\u9891\u7684\u4e0d\u60f3\u8981\u7684\u90e8\u5206\uff0cFFmpeg\u63d0\u4f9b\u4e86\u7075\u6d3b\u7684\u526a\u5207\u9009\u9879\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u6309\u65f6\u95f4\u526a\u5207<\/strong>\uff1a<code>ffmpeg -i input.mp4 -ss 00:00:10 -to 00:00:20 -c copy output.mp4<\/code>\uff0c\u8fd9\u6761\u547d\u4ee4\u4ece\u8f93\u5165\u7684\u89c6\u9891\u4e2d\u526a\u8f91\u51fa\u4ece\u7b2c10\u79d2\u5230\u7b2c20\u79d2\u7684\u90e8\u5206\u3002<code>-ss<\/code>\u6307\u5b9a\u5f00\u59cb\u65f6\u95f4\uff0c<code>-to<\/code>\u6307\u5b9a\u7ed3\u675f\u65f6\u95f4\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6309\u5e27\u526a\u5207<\/strong>\uff1a\u4f7f\u7528\u5e27\u6570\u4f5c\u4e3a\u526a\u8f91\u4f9d\u636e\u662f\u53e6\u4e00\u79cd\u9009\u62e9\uff0c\u80fd\u591f\u63d0\u4f9b\u66f4\u7cbe\u786e\u7684\u526a\u8f91\u63a7\u5236\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>\u4e09\u3001\u5408\u5e76\u89c6\u9891<\/h3>\n<\/p>\n<p><p>\u5408\u5e76\u89c6\u9891\u662f\u6307\u5c06\u591a\u4e2a\u89c6\u9891\u6587\u4ef6\u65e0\u7f1d\u62fc\u63a5\u4e3a\u4e00\u4e2a\u5355\u4e00\u6587\u4ef6\u7684\u8fc7\u7a0b\uff0cFFmpeg\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u7684\u547d\u4ee4\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u4f7f\u7528concat\u8fc7\u6ee4\u5668<\/strong>\uff1a\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u6240\u6709\u89c6\u9891\u6587\u4ef6\u540d\u79f0\u548c\u8def\u5f84\u7684\u6587\u672c\u6587\u4ef6\uff08filelist.txt\uff09\uff0c\u7136\u540e\u8fd0\u884c<code>ffmpeg -f concat -i filelist.txt -c copy output.mp4<\/code>\u6765\u5408\u5e76\u89c6\u9891\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u76f4\u63a5\u5408\u5e76\u76f8\u540c\u683c\u5f0f\u7684\u89c6\u9891<\/strong>\uff1a\u5bf9\u4e8e\u7f16\u7801\u76f8\u540c\u7684\u89c6\u9891\u6587\u4ef6\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u547d\u4ee4\u5408\u5e76\uff0c\u7b80\u5316\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>\u56db\u3001\u63d0\u53d6\u97f3\u9891<\/h3>\n<\/p>\n<p><p>\u4ece\u89c6\u9891\u6587\u4ef6\u4e2d\u63d0\u53d6\u97f3\u9891\u8f68\u9053\u662f\u4e00\u9879\u5e38\u89c1\u9700\u6c42\uff0cFFmpeg\u63d0\u4f9b\u4e86\u7b80\u5355\u7684\u547d\u4ee4\u6765\u5b9e\u73b0\u8fd9\u4e00\u70b9\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u63d0\u53d6\u97f3\u9891<\/strong>\uff1a<code>ffmpeg -i input.mp4 -vn -acodec copy output.aac<\/code>\uff0c\u8fd9\u6761\u547d\u4ee4\u4eceMP4\u89c6\u9891\u4e2d\u63d0\u53d6\u97f3\u9891\uff0c\u5e76\u5c06\u5176\u4fdd\u5b58\u4e3aAAC\u683c\u5f0f\u3002<code>-vn<\/code>\u662f\u7528\u6765\u6307\u793aFFmpeg\u5728\u5904\u7406\u4e2d\u5ffd\u7565\u89c6\u9891\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u8f6c\u6362\u97f3\u9891\u683c\u5f0f<\/strong>\uff1a\u540c\u6837\uff0c\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u5c06\u97f3\u9891\u4ece\u4e00\u79cd\u683c\u5f0f\u8f6c\u6362\u6210\u53e6\u4e00\u79cd\u683c\u5f0f\uff0c\u4f8b\u5982<code>ffmpeg -i input.aac -acodec mp3 output.mp3<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><h3>\u4e94\u3001\u89c6\u9891\u622a\u56fe<\/h3>\n<\/p>\n<p><p>\u89c6\u9891\u622a\u56fe\u662f\u6307\u4ece\u89c6\u9891\u4e2d\u6293\u53d6\u9759\u6b62\u753b\u9762\u7684\u8fc7\u7a0b\uff0c\u9002\u7528\u4e8e\u5236\u4f5c\u9884\u89c8\u56fe\u6216\u8fdb\u884c\u5185\u5bb9\u5206\u6790\u3002<\/p>\n<\/p>\n<ul>\n<li>\n<p><strong>\u622a\u53d6\u5355\u5e27\u56fe\u7247<\/strong>\uff1a<code>ffmpeg -i input.mp4 -ss 00:00:05 -vframes 1 output.jpg<\/code>\u53ef\u4ee5\u5728\u89c6\u9891\u7684\u7b2c5\u79d2\u5904\u622a\u53d6\u4e00\u5e27\u56fe\u7247\u4f5c\u4e3a\u8f93\u51fa\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u751f\u6210\u89c6\u9891\u9884\u89c8<\/strong>\uff1a\u751f\u6210\u4e00\u7cfb\u5217\u7684\u622a\u56fe\uff0c\u53ef\u4ee5\u7528\u6765\u521b\u5efa\u89c6\u9891\u7684\u9884\u89c8\u6216\u8005\u7f29\u7565\u56fe\u96c6\uff0c\u589e\u5f3a\u89c6\u9891\u5185\u5bb9\u7684\u5448\u73b0\u6548\u679c\u3002<\/p>\n<\/p>\n<\/li>\n<\/ul>\n<p><p>\u901a\u8fc7\u638c\u63e1\u8fd9\u4e9bFFmpeg\u7684\u5e38\u7528\u547d\u4ee4\uff0c\u7528\u6237\u53ef\u4ee5\u8f7b\u677e\u5904\u7406\u591a\u79cd\u591a\u5a92\u4f53\u4efb\u52a1\uff0c\u65e0\u8bba\u662f\u8fdb\u884c\u7b80\u5355\u7684\u683c\u5f0f\u8f6c\u6362\uff0c\u8fd8\u662f\u6267\u884c\u590d\u6742\u7684\u89c6\u9891\u7f16\u8f91\u5de5\u4f5c\uff0cFFmpeg\u90fd\u80fd\u63d0\u4f9b\u5f3a\u5927\u7684\u652f\u6301\u3002\u6df1\u5165\u4e86\u89e3\u548c\u719f\u7ec3\u5e94\u7528\u8fd9\u4e9b\u547d\u4ee4\uff0c\u5c06\u5927\u5927\u63d0\u5347\u89c6\u9891\u5904\u7406\u7684\u6548\u7387\u548c\u8d28\u91cf\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u8bf7\u95eeffmpeg\u6709\u54ea\u4e9b\u5e38\u7528\u547d\u4ee4\uff1f<\/strong><\/p>\n<p>ffmpeg\u662f\u4e00\u6b3e\u529f\u80fd\u5f3a\u5927\u7684\u591a\u5a92\u4f53\u5904\u7406\u5de5\u5177\uff0c\u4ee5\u4e0b\u662f\u51e0\u4e2a\u5e38\u7528\u7684\u547d\u4ee4\uff1a<\/p>\n<ul>\n<li><strong>\u8f6c\u7801\u547d\u4ee4<\/strong>\uff1a\u4f7f\u7528ffmpeg\u53ef\u4ee5\u5c06\u89c6\u9891\u6216\u97f3\u9891\u6587\u4ef6\u4ece\u4e00\u79cd\u683c\u5f0f\u8f6c\u6362\u4e3a\u53e6\u4e00\u79cd\u683c\u5f0f\u3002\u4f8b\u5982\uff0c<code>ffmpeg -i input.mp4 output.avi<\/code>\u53ef\u4ee5\u5c06MP4\u683c\u5f0f\u7684\u89c6\u9891\u8f6c\u6362\u4e3aAVI\u683c\u5f0f\u3002<\/li>\n<li><strong>\u526a\u5207\u547d\u4ee4<\/strong>\uff1affmpeg\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u5f00\u59cb\u65f6\u95f4\u548c\u6301\u7eed\u65f6\u95f4\u6765\u526a\u5207\u89c6\u9891\u6216\u97f3\u9891\u6587\u4ef6\u3002\u4f8b\u5982\uff0c<code>ffmpeg -i input.mp4 -ss 00:00:10 -t 00:00:20 output.mp4<\/code>\u53ef\u4ee5\u5c06\u8f93\u5165\u89c6\u9891\u4ece\u7b2c10\u79d2\u526a\u5207\u5230\u7b2c30\u79d2\u3002<\/li>\n<li><strong>\u63d0\u53d6\u97f3\u9891\u547d\u4ee4<\/strong>\uff1a\u4f7f\u7528ffmpeg\u53ef\u4ee5\u4ece\u89c6\u9891\u6587\u4ef6\u4e2d\u63d0\u53d6\u97f3\u9891\u3002\u4f8b\u5982\uff0c<code>ffmpeg -i input.mp4 -vn -acodec copy output.mp3<\/code>\u53ef\u4ee5\u5c06MP4\u6587\u4ef6\u8f6c\u6362\u4e3aMP3\u683c\u5f0f\u3002<\/li>\n<li><strong>\u6dfb\u52a0\u6c34\u5370\u547d\u4ee4<\/strong>\uff1affmpeg\u5141\u8bb8\u5728\u89c6\u9891\u4e0a\u6dfb\u52a0\u6c34\u5370\uff0c\u4ee5\u4fdd\u62a4\u7248\u6743\u6216\u63d0\u5347\u54c1\u724c\u5f62\u8c61\u3002\u4f8b\u5982\uff0c<code>ffmpeg -i input.mp4 -i logo.png -filter_complex &quot;overlay=10:10&quot; output.mp4<\/code>\u53ef\u4ee5\u5728\u89c6\u9891\u7684\u5de6\u4e0a\u89d2\u6dfb\u52a0\u4e00\u4e2a\u540d\u4e3alogo.png\u7684\u6c34\u5370\u3002<\/li>\n<li><strong>\u8c03\u6574\u89c6\u9891\u8d28\u91cf\u547d\u4ee4<\/strong>\uff1affmpeg\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574\u89c6\u9891\u7684\u7801\u7387\u3001\u5206\u8fa8\u7387\u3001\u5e27\u7387\u7b49\u53c2\u6570\u6765\u4f18\u5316\u89c6\u9891\u8d28\u91cf\u3002\u4f8b\u5982\uff0c<code>ffmpeg -i input.mp4 -c:v libx264 -b:v 1000k output.mp4<\/code>\u53ef\u4ee5\u5c06\u89c6\u9891\u7684\u6bd4\u7279\u7387\u8bbe\u7f6e\u4e3a1000kbps\uff0c\u4ece\u800c\u63d0\u9ad8\u89c6\u9891\u8d28\u91cf\u3002<\/li>\n<\/ul>\n<p><strong>2. \u5982\u4f55\u4f7f\u7528ffmpeg\u8fdb\u884c\u89c6\u9891\u683c\u5f0f\u8f6c\u6362\uff1f<\/strong><\/p>\n<p>\u4f7f\u7528ffmpeg\u8fdb\u884c\u89c6\u9891\u683c\u5f0f\u8f6c\u6362\u975e\u5e38\u7b80\u5355\u3002\u53ea\u9700\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>ffmpeg -i input.mp4 output.avi<\/code>\u5373\u53ef\u5c06MP4\u683c\u5f0f\u7684\u89c6\u9891\u8f6c\u6362\u4e3aAVI\u683c\u5f0f\u3002\u5176\u4e2d\uff0c<code>input.mp4<\/code>\u662f\u60a8\u8981\u8f6c\u6362\u7684\u539f\u59cb\u6587\u4ef6\u540d\uff0c<code>output.avi<\/code>\u5219\u662f\u60a8\u5e0c\u671b\u8f6c\u6362\u540e\u7684\u6587\u4ef6\u540d\u548c\u683c\u5f0f\u3002\u6839\u636e\u9700\u8981\uff0c\u60a8\u8fd8\u53ef\u4ee5\u4e3a\u8f6c\u6362\u8fc7\u7a0b\u8bbe\u7f6e\u5176\u4ed6\u53c2\u6570\uff0c\u5982\u8f93\u51fa\u7684\u5206\u8fa8\u7387\u3001\u5e27\u7387\u3001\u6bd4\u7279\u7387\u7b49\u3002<\/p>\n<p><strong>3. \u6211\u60f3\u8981\u5c06\u89c6\u9891\u526a\u5207\u6210\u4e00\u4e2a\u7279\u5b9a\u7684\u65f6\u95f4\u6bb5\uff0c\u8be5\u600e\u4e48\u529e\uff1f<\/strong><\/p>\n<p>\u4f7f\u7528ffmpeg\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06\u89c6\u9891\u526a\u5207\u6210\u7279\u5b9a\u7684\u65f6\u95f4\u6bb5\u3002\u4f8b\u5982\uff0c\u8981\u5c06\u89c6\u9891\u4ece\u7b2c10\u79d2\u5f00\u59cb\u526a\u5207\u5230\u7b2c30\u79d2\uff0c\u53ea\u9700\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<code>ffmpeg -i input.mp4 -ss 00:00:10 -t 00:00:20 output.mp4<\/code>\u3002\u5176\u4e2d\uff0c<code>-ss<\/code>\u53c2\u6570\u8868\u793a\u5f00\u59cb\u65f6\u95f4\uff0c<code>00:00:10<\/code>\u8868\u793a\u4ece\u7b2c10\u79d2\u5f00\u59cb\uff0c<code>-t<\/code>\u53c2\u6570\u8868\u793a\u6301\u7eed\u65f6\u95f4\uff0c<code>00:00:20<\/code>\u8868\u793a\u526a\u520720\u79d2\u3002\u6267\u884c\u547d\u4ee4\u540e\uff0c\u5c06\u751f\u6210\u4e00\u4e2a\u540d\u4e3aoutput.mp4\u7684\u526a\u5207\u89c6\u9891\u6587\u4ef6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"FFmpeg\u662f\u4e00\u6b3e\u529f\u80fd\u5f3a\u5927\u3001\u9ad8\u5ea6\u7075\u6d3b\u7684\u5f00\u6e90\u591a\u5a92\u4f53\u6846\u67b6\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u89c6\u9891\u5904\u7406\u3001\u683c\u5f0f\u8f6c\u6362\u3001\u89c6\u9891\u5f55\u5236\u7b49\u9886\u57df\u3002\u5e38\u7528\u7684FF [&hellip;]","protected":false},"author":3,"featured_media":313871,"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\/313870"}],"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=313870"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/313870\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/313871"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=313870"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=313870"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=313870"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}