﻿{"id":599,"date":"2020-11-22T03:44:11","date_gmt":"2020-11-21T19:44:11","guid":{"rendered":"https:\/\/byy3.com\/?p=599"},"modified":"2021-02-08T19:01:40","modified_gmt":"2021-02-08T11:01:40","slug":"windows%e5%ae%89%e8%a3%85ffmpeg%e5%bc%80%e6%ba%90%e8%a7%86%e9%a2%91%e5%b7%a5%e5%85%b7%e7%8e%af%e5%a2%83%e9%85%8d%e7%bd%ae%e3%80%81%e7%94%a8%e6%b3%95","status":"publish","type":"post","link":"https:\/\/byy3.com\/?p=599","title":{"rendered":"windows\u5b89\u88c5ffmpeg\u5f00\u6e90\u89c6\u9891\u5de5\u5177\u73af\u5883\u914d\u7f6e\u3001\u7528\u6cd5"},"content":{"rendered":"<p><a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/www.ffmpeg.org\/\" target=\"_blank\" rel=\"noopener noreferrer\" rel=\"nofollow\" >FFmpeg<\/a> \u662f\u89c6\u9891\u5904\u7406\u6700\u5e38\u7528\u7684\u5f00\u6e90\u8f6f\u4ef6\u3002\u6b64\u5de5\u5177\u73a9\u6cd5\u5f88\u591a\uff0c\u53ef\u8de8\u5e73\u53f0\uff0c\u53ef\u4ee5\u7ed3\u5408\u7f16\u7a0bpython\u8bed\u8a00\u5904\u7406\u590d\u6742\u4efb\u52a1\u3002<\/p>\n<p>FFmpeg \u672c\u8eab\u662f\u4e00\u4e2a\u5e9e\u5927\u7684\u9879\u76ee\uff0c\u5305\u542b\u8bb8\u591a\u7ec4\u4ef6\u548c\u5e93\u6587\u4ef6\uff0c\u6700\u5e38\u7528\u7684\u662f\u5b83\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u672c\u6587\u4ecb\u7ecd FFmpeg \u547d\u4ee4\u884c\u5982\u4f55\u5904\u7406\u89c6\u9891\uff0c\u6bd4\u684c\u9762\u89c6\u9891\u5904\u7406\u8f6f\u4ef6\u66f4\u7b80\u6d01\u9ad8\u6548\u3002<\/p>\n<p>\u5982\u679c\u4f60\u8fd8\u6ca1\u5b89\u88c5\uff0c\u53ef\u4ee5\u6839\u636e<a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/www.ffmpeg.org\/download.html\" target=\"_blank\" rel=\"noopener noreferrer\" rel=\"nofollow\" >\u5b98\u65b9\u6587\u6863<\/a>\u00a0\u5148\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n<h2>\u4e00\u3001\u6982\u5ff5<\/h2>\n<p>\u4ecb\u7ecd FFmpeg \u7528\u6cd5\u4e4b\u524d\uff0c\u9700\u8981\u4e86\u89e3\u4e00\u4e9b\u89c6\u9891\u5904\u7406\u7684\u57fa\u672c\u6982\u5ff5\u3002<\/p>\n<h3>1.1 \u5bb9\u5668<\/h3>\n<p>\u89c6\u9891\u6587\u4ef6\u672c\u8eab\u5176\u5b9e\u662f\u4e00\u4e2a\u5bb9\u5668\uff08container\uff09\uff0c\u91cc\u9762\u5305\u62ec\u4e86\u89c6\u9891\u548c\u97f3\u9891\uff0c\u4e5f\u53ef\u80fd\u6709\u5b57\u5e55\u7b49\u5176\u4ed6\u5185\u5bb9\u3002<\/p>\n<p>\u5e38\u89c1\u7684\u5bb9\u5668\u683c\u5f0f\u6709\u4ee5\u4e0b\u51e0\u79cd\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u89c6\u9891\u6587\u4ef6\u7684\u540e\u7f00\u540d\u53cd\u6620\u4e86\u5b83\u7684\u5bb9\u5668\u683c\u5f0f\u3002<\/p>\n<blockquote>\n<ul>\n<li>MP4<\/li>\n<li>MKV<\/li>\n<li>WebM<\/li>\n<li>AVI<\/li>\n<\/ul>\n<\/blockquote>\n<p>\u4e0b\u9762\u7684\u547d\u4ee4\u67e5\u770b FFmpeg \u652f\u6301\u7684\u5bb9\u5668\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -formats\n<\/code><\/pre>\n<\/blockquote>\n<h3>1.2 \u7f16\u7801\u683c\u5f0f<\/h3>\n<p>\u89c6\u9891\u548c\u97f3\u9891\u90fd\u9700\u8981\u7ecf\u8fc7\u7f16\u7801\uff0c\u624d\u80fd\u4fdd\u5b58\u6210\u6587\u4ef6\u3002\u4e0d\u540c\u7684\u7f16\u7801\u683c\u5f0f\uff08CODEC\uff09\uff0c\u6709\u4e0d\u540c\u7684\u538b\u7f29\u7387\uff0c\u4f1a\u5bfc\u81f4\u6587\u4ef6\u5927\u5c0f\u548c\u6e05\u6670\u5ea6\u7684\u5dee\u5f02\u3002<\/p>\n<p>\u5e38\u7528\u7684\u89c6\u9891\u7f16\u7801\u683c\u5f0f\u5982\u4e0b\u3002<\/p>\n<blockquote>\n<ul>\n<li>H.262<\/li>\n<li>H.264<\/li>\n<li>H.265<\/li>\n<\/ul>\n<\/blockquote>\n<p>\u4e0a\u9762\u7684\u7f16\u7801\u683c\u5f0f\u90fd\u662f\u6709\u7248\u6743\u7684\uff0c\u4f46\u662f\u53ef\u4ee5\u514d\u8d39\u4f7f\u7528\u3002\u6b64\u5916\uff0c\u8fd8\u6709\u51e0\u79cd\u65e0\u7248\u6743\u7684\u89c6\u9891\u7f16\u7801\u683c\u5f0f\u3002<\/p>\n<blockquote>\n<ul>\n<li>VP8<\/li>\n<li>VP9<\/li>\n<li>AV1<\/li>\n<\/ul>\n<\/blockquote>\n<p>\u5e38\u7528\u7684\u97f3\u9891\u7f16\u7801\u683c\u5f0f\u5982\u4e0b\u3002<\/p>\n<blockquote>\n<ul>\n<li>MP3<\/li>\n<li>AAC<\/li>\n<\/ul>\n<\/blockquote>\n<p>\u4e0a\u9762\u6240\u6709\u8fd9\u4e9b\u90fd\u662f\u6709\u635f\u7684\u7f16\u7801\u683c\u5f0f\uff0c\u7f16\u7801\u540e\u4f1a\u635f\u5931\u4e00\u4e9b\u7ec6\u8282\uff0c\u4ee5\u6362\u53d6\u538b\u7f29\u540e\u8f83\u5c0f\u7684\u6587\u4ef6\u4f53\u79ef\u3002\u65e0\u635f\u7684\u7f16\u7801\u683c\u5f0f\u538b\u7f29\u51fa\u6765\u7684\u6587\u4ef6\u4f53\u79ef\u8f83\u5927\uff0c\u8fd9\u91cc\u5c31\u4e0d\u4ecb\u7ecd\u4e86\u3002<\/p>\n<p>\u4e0b\u9762\u7684\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b FFmpeg \u652f\u6301\u7684\u7f16\u7801\u683c\u5f0f\uff0c\u89c6\u9891\u7f16\u7801\u548c\u97f3\u9891\u7f16\u7801\u90fd\u5728\u5185\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -codecs\n<\/code><\/pre>\n<\/blockquote>\n<h3>1.3 \u7f16\u7801\u5668<\/h3>\n<p>\u7f16\u7801\u5668\uff08encoders\uff09\u662f\u5b9e\u73b0\u67d0\u79cd\u7f16\u7801\u683c\u5f0f\u7684\u5e93\u6587\u4ef6\u3002\u53ea\u6709\u5b89\u88c5\u4e86\u67d0\u79cd\u683c\u5f0f\u7684\u7f16\u7801\u5668\uff0c\u624d\u80fd\u5b9e\u73b0\u8be5\u683c\u5f0f\u89c6\u9891\/\u97f3\u9891\u7684\u7f16\u7801\u548c\u89e3\u7801\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b FFmpeg \u5185\u7f6e\u7684\u89c6\u9891\u7f16\u7801\u5668\u3002<\/p>\n<blockquote>\n<ul>\n<li>libx264\uff1a\u6700\u6d41\u884c\u7684\u5f00\u6e90 H.264 \u7f16\u7801\u5668<\/li>\n<li>NVENC\uff1a\u57fa\u4e8e NVIDIA GPU \u7684 H.264 \u7f16\u7801\u5668<\/li>\n<li>libx265\uff1a\u5f00\u6e90\u7684 HEVC \u7f16\u7801\u5668<\/li>\n<li>libvpx\uff1a\u8c37\u6b4c\u7684 VP8 \u548c VP9 \u7f16\u7801\u5668<\/li>\n<li>libaom\uff1aAV1 \u7f16\u7801\u5668<\/li>\n<\/ul>\n<\/blockquote>\n<p>\u97f3\u9891\u7f16\u7801\u5668\u5982\u4e0b\u3002<\/p>\n<blockquote>\n<ul>\n<li>libfdk-aac<\/li>\n<li>aac<\/li>\n<\/ul>\n<\/blockquote>\n<p>\u4e0b\u9762\u7684\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b FFmpeg \u5df2\u5b89\u88c5\u7684\u7f16\u7801\u5668\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -encoders\n<\/code><\/pre>\n<\/blockquote>\n<p>&nbsp;<\/p>\n<p>\u7f51\u7ad9\u5df2\u7ecf\u66f4\u65b0\uff01\uff01\uff01<\/p>\n<p><a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/www.gyan.dev\/ffmpeg\/builds\/\" rel=\"nofollow\" ><a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/www.gyan.dev\/ffmpeg\/builds\/\" rel=\"nofollow\" >https:\/\/www.gyan.dev\/ffmpeg\/builds\/<\/a><\/a><\/p>\n<div>\u627e\u5230<\/div>\n<div id=\"git-section\" class=\"article-section\">git<\/div>\n<p id=\"git-links\" class=\"code-header\">Links\u00a0 \u00a0 \u70b9\u51fb\u4e0b\u9762\u94fe\u63a5\u4e0b\u8f7d<\/p>\n<p><code><a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/www.gyan.dev\/ffmpeg\/builds\/ffmpeg-git-full.7z\" rel=\"nofollow\" ><a href=\"https:\/\/byy3.com\/go\/?url=https:\/\/www.gyan.dev\/ffmpeg\/builds\/ffmpeg-git-full.7z\" rel=\"nofollow\" >https:\/\/www.gyan.dev\/ffmpeg\/builds\/ffmpeg-git-full.7z<\/a><\/a><br \/>\n<strong>SHA256:<\/strong>\u00a011593ce8bd4bc832e6bf261af717493edeed1be7cbd829a3a6b92cd48ea9cacc<\/code><\/p>\n<p>2.\u89e3\u538b\u5230\u6307\u5b9a\u76ee\u5f55\uff08\u76ee\u5f55\u53ef\u66f4\u6539\uff0c\u5982\u89e3\u538bD\u76d8\u6839\u76ee\u5f55ffmpeg\u6587\u4ef6\u5939\uff1a\u73af\u5883\u53d8\u91cf\u4e3aF:\\ffmpeg\\bin\uff09<\/p>\n<p>\u7136\u540e\u5c06bin\u6587\u4ef6\u76ee\u5f55\u6dfb\u52a0\u5230path\u8def\u5f84\uff08\u7535\u8111-\u5c5e\u6027-\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e-\u73af\u5883\u53d8\u91cf-path-\u65b0\u5efa\uff09<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.jbzj.com\/file_images\/article\/201909\/2019920143400811.png?2019820143420\" title=\"windows\u5b89\u88c5ffmpeg\u5f00\u6e90\u89c6\u9891\u5de5\u5177\u73af\u5883\u914d\u7f6e\u3001\u7528\u6cd5\u63d2\u56fe\" alt=\"windows\u5b89\u88c5ffmpeg\u5f00\u6e90\u89c6\u9891\u5de5\u5177\u73af\u5883\u914d\u7f6e\u3001\u7528\u6cd5\u63d2\u56fe\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-600\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112119302711.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"541\" height=\"570\" title=\"windows\u5b89\u88c5ffmpeg\u5f00\u6e90\u89c6\u9891\u5de5\u5177\u73af\u5883\u914d\u7f6e\u3001\u7528\u6cd5\u63d2\u56fe1\" alt=\"windows\u5b89\u88c5ffmpeg\u5f00\u6e90\u89c6\u9891\u5de5\u5177\u73af\u5883\u914d\u7f6e\u3001\u7528\u6cd5\u63d2\u56fe1\" \/><\/p>\n<p>\u547d\u4ee4\u884c\uff08windows+r \u8f93\u5165cmd\uff09\u8f93\u5165\uff1affmpeg -version\u663e\u793a\u4ee5\u4e0b\u754c\u9762\u8868\u793a\u5b89\u88c5\u6210\u529f\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.jbzj.com\/file_images\/article\/201909\/2019920143400812.png?2019820143425\" title=\"windows\u5b89\u88c5ffmpeg\u5f00\u6e90\u89c6\u9891\u5de5\u5177\u73af\u5883\u914d\u7f6e\u3001\u7528\u6cd5\u63d2\u56fe2\" alt=\"windows\u5b89\u88c5ffmpeg\u5f00\u6e90\u89c6\u9891\u5de5\u5177\u73af\u5883\u914d\u7f6e\u3001\u7528\u6cd5\u63d2\u56fe2\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-601\" data-original=\"https:\/\/byy3.com\/wp-content\/uploads\/2020\/11\/2020112119305036.png\" src=\"https:\/\/byy3.com\/wp-content\/themes\/MNews%20V2.4\/images\/post-loading.gif\" width=\"993\" height=\"519\" title=\"windows\u5b89\u88c5ffmpeg\u5f00\u6e90\u89c6\u9891\u5de5\u5177\u73af\u5883\u914d\u7f6e\u3001\u7528\u6cd5\u63d2\u56fe3\" alt=\"windows\u5b89\u88c5ffmpeg\u5f00\u6e90\u89c6\u9891\u5de5\u5177\u73af\u5883\u914d\u7f6e\u3001\u7528\u6cd5\u63d2\u56fe3\" \/><\/p>\n<p><strong>\u4e8c\u3001ffmpeg\u7b80\u5355\u4f7f\u7528\u4ecb\u7ecd<\/strong><\/p>\n<p>1.\u89c6\u9891\u683c\u5f0f\u8f6c\u6362\uff1a<code>ffmpeg -i num.mp4 -codec copy num2.avi<\/code><\/p>\n<p>\u5c06num.mp4\u590d\u5236\u5e76\u8f6c\u6362\u4e3anum2.avi<\/p>\n<p>\u6ce8\uff1a-i\u540e\u8868\u793a\u8981\u8fdb\u884c\u64cd\u4f5c\u7684\u6587\u4ef6<\/p>\n<p>2.gif\u5236\u4f5c\uff1a<code>ffmpeg -i num.mp4 -vframes 20 -y -f gif num3.gif<\/code><\/p>\n<p>\u5c06num.mp4\u7684\u524d20\u5e27\u5236\u4f5c\u4e3agif\u5e76\u547d\u540d\u4e3anum3<\/p>\n<p>3.\u89c6\u9891\u622a\u53d6\uff1a<code>ffmpeg -i num.mp4 -ss 0 -t 3 -codec copy cut1.mp4<\/code><\/p>\n<p>-ss\u540e\u6570\u5b57\u8868\u793a\u622a\u53d6\u65f6\u523b\uff0c-t\u540e\u6570\u5b57\u8868\u793a\u622a\u53d6\u65f6\u957f<\/p>\n<p>\u622a\u53d6\u89c6\u9891\u67d0\u4e00\u65f6\u523b\u4e3a\u56fe\u7247\uff1a<code>ffmpeg -i num.mp4 -y -f image2 -ss 2 -t 0.001 -s 400x300 pic.jpg<\/code><\/p>\n<p>\u5c062s\u65f6\u523b\u622a\u53d6\u4e3a400x300\u5927\u5c0f\u7684\u540d\u4e3apic.jpg\u7684\u56fe\u7247\uff08-ss\u540e\u7684\u6570\u5b57\u4e3a\u622a\u53d6\u65f6\u523b\uff09<\/p>\n<p>4.\u6bcf\u79d2\u622a\u53d6\u4e00\u5f20\u56fe\u7247\uff1a<code>ffmpeg -i num.mp4 -r 1 image%d.jpg<\/code><\/p>\n<p>\u5c06\u89c6\u9891num.mp4\u8fdb\u884c\u6bcf\u79d2\u622a\u53d6\u4e00\u5f20\u56fe\u7247\uff0c\u5e76\u547d\u540d\u4e3aimagei.jpg\uff08i=1\uff0c2\uff0c3...\uff09<\/p>\n<p>\u6ce8\uff1a-r\u540e\u7684\u6570\u5b57\u8868\u793a\u6bcf\u9694\u591a\u4e45\u622a\u53d6\u4e00\u5f20<\/p>\n<p>&nbsp;<\/p>\n<h2>\u4e8c\u3001FFmpeg \u7684\u4f7f\u7528\u683c\u5f0f<\/h2>\n<p>FFmpeg \u7684\u547d\u4ee4\u884c\u53c2\u6570\u975e\u5e38\u591a\uff0c\u53ef\u4ee5\u5206\u6210\u4e94\u4e2a\u90e8\u5206\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg {1} {2} -i {3} {4} {5}\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0a\u9762\u547d\u4ee4\u4e2d\uff0c\u4e94\u4e2a\u90e8\u5206\u7684\u53c2\u6570\u4f9d\u6b21\u5982\u4e0b\u3002<\/p>\n<blockquote>\n<ol start=\"1\">\n<li>\u5168\u5c40\u53c2\u6570<\/li>\n<li>\u8f93\u5165\u6587\u4ef6\u53c2\u6570<\/li>\n<li>\u8f93\u5165\u6587\u4ef6<\/li>\n<li>\u8f93\u51fa\u6587\u4ef6\u53c2\u6570<\/li>\n<li>\u8f93\u51fa\u6587\u4ef6<\/li>\n<\/ol>\n<\/blockquote>\n<p>\u53c2\u6570\u592a\u591a\u7684\u65f6\u5019\uff0c\u4e3a\u4e86\u4fbf\u4e8e\u67e5\u770b\uff0cffmpeg \u547d\u4ee4\u53ef\u4ee5\u5199\u6210\u591a\u884c\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg \\\n[\u5168\u5c40\u53c2\u6570] \\\n[\u8f93\u5165\u6587\u4ef6\u53c2\u6570] \\\n-i [\u8f93\u5165\u6587\u4ef6] \\\n[\u8f93\u51fa\u6587\u4ef6\u53c2\u6570] \\\n[\u8f93\u51fa\u6587\u4ef6]\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg \\\n-y \\ # \u5168\u5c40\u53c2\u6570\n-c:a libfdk_aac -c:v libx264 \\ # \u8f93\u5165\u6587\u4ef6\u53c2\u6570\n-i input.mp4 \\ # \u8f93\u5165\u6587\u4ef6\n-c:v libvpx-vp9 -c:a libvorbis \\ # \u8f93\u51fa\u6587\u4ef6\u53c2\u6570\noutput.webm # \u8f93\u51fa\u6587\u4ef6\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0a\u9762\u7684\u547d\u4ee4\u5c06 mp4 \u6587\u4ef6\u8f6c\u6210 webm \u6587\u4ef6\uff0c\u8fd9\u4e24\u4e2a\u90fd\u662f\u5bb9\u5668\u683c\u5f0f\u3002\u8f93\u5165\u7684 mp4 \u6587\u4ef6\u7684\u97f3\u9891\u7f16\u7801\u683c\u5f0f\u662f aac\uff0c\u89c6\u9891\u7f16\u7801\u683c\u5f0f\u662f H.264\uff1b\u8f93\u51fa\u7684 webm \u6587\u4ef6\u7684\u89c6\u9891\u7f16\u7801\u683c\u5f0f\u662f VP9\uff0c\u97f3\u9891\u683c\u5f0f\u662f Vorbis\u3002<\/p>\n<p>\u5982\u679c\u4e0d\u6307\u660e\u7f16\u7801\u683c\u5f0f\uff0cFFmpeg \u4f1a\u81ea\u5df1\u5224\u65ad\u8f93\u5165\u6587\u4ef6\u7684\u7f16\u7801\u3002\u56e0\u6b64\uff0c\u4e0a\u9762\u7684\u547d\u4ee4\u53ef\u4ee5\u7b80\u5355\u5199\u6210\u4e0b\u9762\u7684\u6837\u5b50\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -i input.avi output.mp4\n<\/code><\/pre>\n<\/blockquote>\n<h2>\u4e09\u3001\u5e38\u7528\u547d\u4ee4\u884c\u53c2\u6570<\/h2>\n<p>FFmpeg \u5e38\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u5982\u4e0b\u3002<\/p>\n<blockquote>\n<ul>\n<li><code>-c<\/code>\uff1a\u6307\u5b9a\u7f16\u7801\u5668<\/li>\n<li><code>-c copy<\/code>\uff1a\u76f4\u63a5\u590d\u5236\uff0c\u4e0d\u7ecf\u8fc7\u91cd\u65b0\u7f16\u7801\uff08\u8fd9\u6837\u6bd4\u8f83\u5feb\uff09<\/li>\n<li><code>-c:v<\/code>\uff1a\u6307\u5b9a\u89c6\u9891\u7f16\u7801\u5668<\/li>\n<li><code>-c:a<\/code>\uff1a\u6307\u5b9a\u97f3\u9891\u7f16\u7801\u5668<\/li>\n<li><code>-i<\/code>\uff1a\u6307\u5b9a\u8f93\u5165\u6587\u4ef6<\/li>\n<li><code>-an<\/code>\uff1a\u53bb\u9664\u97f3\u9891\u6d41<\/li>\n<li><code>-vn<\/code>\uff1a \u53bb\u9664\u89c6\u9891\u6d41<\/li>\n<li><code>-preset<\/code>\uff1a\u6307\u5b9a\u8f93\u51fa\u7684\u89c6\u9891\u8d28\u91cf\uff0c\u4f1a\u5f71\u54cd\u6587\u4ef6\u7684\u751f\u6210\u901f\u5ea6\uff0c\u6709\u4ee5\u4e0b\u51e0\u4e2a\u53ef\u7528\u7684\u503c ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow\u3002<\/li>\n<li><code>-y<\/code>\uff1a\u4e0d\u7ecf\u8fc7\u786e\u8ba4\uff0c\u8f93\u51fa\u65f6\u76f4\u63a5\u8986\u76d6\u540c\u540d\u6587\u4ef6\u3002<\/li>\n<\/ul>\n<\/blockquote>\n<h2>\u56db\u3001\u5e38\u89c1\u7528\u6cd5<\/h2>\n<p>\u4e0b\u9762\u4ecb\u7ecd FFmpeg \u51e0\u79cd\u5e38\u89c1\u7528\u6cd5\u3002<\/p>\n<h3>4.1 \u67e5\u770b\u6587\u4ef6\u4fe1\u606f<\/h3>\n<p>\u67e5\u770b\u89c6\u9891\u6587\u4ef6\u7684\u5143\u4fe1\u606f\uff0c\u6bd4\u5982\u7f16\u7801\u683c\u5f0f\u548c\u6bd4\u7279\u7387\uff0c\u53ef\u4ee5\u53ea\u4f7f\u7528<code>-i<\/code>\u53c2\u6570\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -i input.mp4\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0a\u9762\u547d\u4ee4\u4f1a\u8f93\u51fa\u5f88\u591a\u5197\u4f59\u4fe1\u606f\uff0c\u52a0\u4e0a<code>-hide_banner<\/code>\u53c2\u6570\uff0c\u53ef\u4ee5\u53ea\u663e\u793a\u5143\u4fe1\u606f\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -i input.mp4 -hide_banner\n<\/code><\/pre>\n<\/blockquote>\n<h3>4.2 \u8f6c\u6362\u7f16\u7801\u683c\u5f0f<\/h3>\n<p>\u8f6c\u6362\u7f16\u7801\u683c\u5f0f\uff08transcoding\uff09\u6307\u7684\u662f\uff0c \u5c06\u89c6\u9891\u6587\u4ef6\u4ece\u4e00\u79cd\u7f16\u7801\u8f6c\u6210\u53e6\u4e00\u79cd\u7f16\u7801\u3002\u6bd4\u5982\u8f6c\u6210 H.264 \u7f16\u7801\uff0c\u4e00\u822c\u4f7f\u7528\u7f16\u7801\u5668<code>libx264<\/code>\uff0c\u6240\u4ee5\u53ea\u9700\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u7684\u89c6\u9891\u7f16\u7801\u5668\u5373\u53ef\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -i [input.file] -c:v libx264 output.mp4\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0b\u9762\u662f\u8f6c\u6210 H.265 \u7f16\u7801\u7684\u5199\u6cd5\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -i [input.file] -c:v libx265 output.mp4\n<\/code><\/pre>\n<\/blockquote>\n<h3>4.3 \u8f6c\u6362\u5bb9\u5668\u683c\u5f0f<\/h3>\n<p>\u8f6c\u6362\u5bb9\u5668\u683c\u5f0f\uff08transmuxing\uff09\u6307\u7684\u662f\uff0c\u5c06\u89c6\u9891\u6587\u4ef6\u4ece\u4e00\u79cd\u5bb9\u5668\u8f6c\u5230\u53e6\u4e00\u79cd\u5bb9\u5668\u3002\u4e0b\u9762\u662f mp4 \u8f6c webm \u7684\u5199\u6cd5\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -i input.mp4 -c copy output.webm\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0a\u9762\u4f8b\u5b50\u4e2d\uff0c\u53ea\u662f\u8f6c\u4e00\u4e0b\u5bb9\u5668\uff0c\u5185\u90e8\u7684\u7f16\u7801\u683c\u5f0f\u4e0d\u53d8\uff0c\u6240\u4ee5\u4f7f\u7528<code>-c copy<\/code>\u6307\u5b9a\u76f4\u63a5\u62f7\u8d1d\uff0c\u4e0d\u7ecf\u8fc7\u8f6c\u7801\uff0c\u8fd9\u6837\u6bd4\u8f83\u5feb\u3002<\/p>\n<h3>4.4 \u8c03\u6574\u7801\u7387<\/h3>\n<p>\u8c03\u6574\u7801\u7387\uff08transrating\uff09\u6307\u7684\u662f\uff0c\u6539\u53d8\u7f16\u7801\u7684\u6bd4\u7279\u7387\uff0c\u4e00\u822c\u7528\u6765\u5c06\u89c6\u9891\u6587\u4ef6\u7684\u4f53\u79ef\u53d8\u5c0f\u3002\u4e0b\u9762\u7684\u4f8b\u5b50\u6307\u5b9a\u7801\u7387\u6700\u5c0f\u4e3a964K\uff0c\u6700\u5927\u4e3a3856K\uff0c\u7f13\u51b2\u533a\u5927\u5c0f\u4e3a 2000K\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg \\\n-i input.mp4 \\\n-minrate 964K -maxrate 3856K -bufsize 2000K \\\noutput.mp4\n<\/code><\/pre>\n<\/blockquote>\n<h3>4.5 \u6539\u53d8\u5206\u8fa8\u7387\uff08transsizing\uff09<\/h3>\n<p>\u4e0b\u9762\u662f\u6539\u53d8\u89c6\u9891\u5206\u8fa8\u7387\uff08transsizing\uff09\u7684\u4f8b\u5b50\uff0c\u4ece 1080p \u8f6c\u4e3a 480p \u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg \\\n-i input.mp4 \\\n-vf scale=480:-1 \\\noutput.mp4\n<\/code><\/pre>\n<\/blockquote>\n<h3>4.6 \u63d0\u53d6\u97f3\u9891<\/h3>\n<p>\u6709\u65f6\uff0c\u9700\u8981\u4ece\u89c6\u9891\u91cc\u9762\u63d0\u53d6\u97f3\u9891\uff08demuxing\uff09\uff0c\u53ef\u4ee5\u50cf\u4e0b\u9762\u8fd9\u6837\u5199\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg \\\n-i input.mp4 \\\n-vn -c:a copy \\\noutput.aac\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0a\u9762\u4f8b\u5b50\u4e2d\uff0c<code>-vn<\/code>\u8868\u793a\u53bb\u6389\u89c6\u9891\uff0c<code>-c:a copy<\/code>\u8868\u793a\u4e0d\u6539\u53d8\u97f3\u9891\u7f16\u7801\uff0c\u76f4\u63a5\u62f7\u8d1d\u3002<\/p>\n<h3>4.7 \u6dfb\u52a0\u97f3\u8f68<\/h3>\n<p>\u6dfb\u52a0\u97f3\u8f68\uff08muxing\uff09\u6307\u7684\u662f\uff0c\u5c06\u5916\u90e8\u97f3\u9891\u52a0\u5165\u89c6\u9891\uff0c\u6bd4\u5982\u6dfb\u52a0\u80cc\u666f\u97f3\u4e50\u6216\u65c1\u767d\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg \\\n-i input.aac -i input.mp4 \\\noutput.mp4\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0a\u9762\u4f8b\u5b50\u4e2d\uff0c\u6709\u97f3\u9891\u548c\u89c6\u9891\u4e24\u4e2a\u8f93\u5165\u6587\u4ef6\uff0cFFmpeg \u4f1a\u5c06\u5b83\u4eec\u5408\u6210\u4e3a\u4e00\u4e2a\u6587\u4ef6\u3002<\/p>\n<h3>4.8 \u622a\u56fe<\/h3>\n<p>\u4e0b\u9762\u7684\u4f8b\u5b50\u662f\u4ece\u6307\u5b9a\u65f6\u95f4\u5f00\u59cb\uff0c\u8fde\u7eed\u5bf91\u79d2\u949f\u7684\u89c6\u9891\u8fdb\u884c\u622a\u56fe\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg \\\n-y \\\n-i input.mp4 \\\n-ss 00:01:24 -t 00:00:01 \\\noutput_%3d.jpg\n<\/code><\/pre>\n<\/blockquote>\n<p>\u5982\u679c\u53ea\u9700\u8981\u622a\u4e00\u5f20\u56fe\uff0c\u53ef\u4ee5\u6307\u5b9a\u53ea\u622a\u53d6\u4e00\u5e27\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg \\\n-ss 01:23:45 \\\n-i input \\\n-vframes 1 -q:v 2 \\\noutput.jpg\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0a\u9762\u4f8b\u5b50\u4e2d\uff0c<code>-vframes 1<\/code>\u6307\u5b9a\u53ea\u622a\u53d6\u4e00\u5e27\uff0c<code>-q:v 2<\/code>\u8868\u793a\u8f93\u51fa\u7684\u56fe\u7247\u8d28\u91cf\uff0c\u4e00\u822c\u662f1\u52305\u4e4b\u95f4\uff081 \u4e3a\u8d28\u91cf\u6700\u9ad8\uff09\u3002<\/p>\n<h3>4.9 \u88c1\u526a<\/h3>\n<p>\u88c1\u526a\uff08cutting\uff09\u6307\u7684\u662f\uff0c\u622a\u53d6\u539f\u59cb\u89c6\u9891\u91cc\u9762\u7684\u4e00\u4e2a\u7247\u6bb5\uff0c\u8f93\u51fa\u4e3a\u4e00\u4e2a\u65b0\u89c6\u9891\u3002\u53ef\u4ee5\u6307\u5b9a\u5f00\u59cb\u65f6\u95f4\uff08start\uff09\u548c\u6301\u7eed\u65f6\u95f4\uff08duration\uff09\uff0c\u4e5f\u53ef\u4ee5\u6307\u5b9a\u7ed3\u675f\u65f6\u95f4\uff08end\uff09\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -ss [start] -i [input] -t [duration] -c copy [output]\n$ ffmpeg -ss [start] -i [input] -to [end] -c copy [output]\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0b\u9762\u662f\u5b9e\u9645\u7684\u4f8b\u5b50\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg -ss 00:01:50 -i [input] -t 10.5 -c copy [output]\n$ ffmpeg -ss 2.5 -i [input] -to 10 -c copy [output]\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0a\u9762\u4f8b\u5b50\u4e2d\uff0c<code>-c copy<\/code>\u8868\u793a\u4e0d\u6539\u53d8\u97f3\u9891\u548c\u89c6\u9891\u7684\u7f16\u7801\u683c\u5f0f\uff0c\u76f4\u63a5\u62f7\u8d1d\uff0c\u8fd9\u6837\u4f1a\u5feb\u5f88\u591a\u3002<\/p>\n<h3>4.10 \u4e3a\u97f3\u9891\u6dfb\u52a0\u5c01\u9762<\/h3>\n<p>\u6709\u4e9b\u89c6\u9891\u7f51\u7ad9\u53ea\u5141\u8bb8\u4e0a\u4f20\u89c6\u9891\u6587\u4ef6\u3002\u5982\u679c\u8981\u4e0a\u4f20\u97f3\u9891\u6587\u4ef6\uff0c\u5fc5\u987b\u4e3a\u97f3\u9891\u6dfb\u52a0\u5c01\u9762\uff0c\u5c06\u5176\u8f6c\u4e3a\u89c6\u9891\uff0c\u7136\u540e\u4e0a\u4f20\u3002<\/p>\n<p>\u4e0b\u9762\u547d\u4ee4\u53ef\u4ee5\u5c06\u97f3\u9891\u6587\u4ef6\uff0c\u8f6c\u4e3a\u5e26\u5c01\u9762\u7684\u89c6\u9891\u6587\u4ef6\u3002<\/p>\n<blockquote>\n<pre><code class=\"language-bash\">\n$ ffmpeg \\\n-loop 1 \\\n-i cover.jpg -i input.mp3 \\\n-c:v libx264 -c:a aac -b:a 192k -shortest \\\noutput.mp4\n<\/code><\/pre>\n<\/blockquote>\n<p>\u4e0a\u9762\u547d\u4ee4\u4e2d\uff0c\u6709\u4e24\u4e2a\u8f93\u5165\u6587\u4ef6\uff0c\u4e00\u4e2a\u662f\u5c01\u9762\u56fe\u7247<code>cover.jpg<\/code>\uff0c\u53e6\u4e00\u4e2a\u662f\u97f3\u9891\u6587\u4ef6<code>input.mp3<\/code>\u3002<code>-loop 1<\/code>\u53c2\u6570\u8868\u793a\u56fe\u7247\u65e0\u9650\u5faa\u73af\uff0c<code>-shortest<\/code>\u53c2\u6570\u8868\u793a\u97f3\u9891\u6587\u4ef6\u7ed3\u675f\uff0c\u8f93\u51fa\u89c6\u9891\u5c31\u7ed3\u675f\u3002<\/p>\n<p>\u5b83\u529f\u80fd\u5f3a\u5927\uff0c\u7528\u9014\u5e7f\u6cdb\uff0c\u5927\u91cf\u7528\u4e8e\u89c6\u9891\u7f51\u7ad9\u548c\u5546\u4e1a\u8f6f\u4ef6\uff08\u6bd4\u5982 Youtube \u548c iTunes\uff09\uff0c\u4e5f\u662f\u8bb8\u591a\u97f3\u9891\u548c\u89c6\u9891\u683c\u5f0f\u7684\u6807\u51c6\u7f16\u7801\/\u89e3\u7801\u5b9e\u73b0\u3002<\/p>\n<p>\u66f4\u591a\u7528\u6cd5\u5f85\u53d1\u6398\u540e \u66f4\u65b0\uff01\uff01\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u5b66\u4e60\u6709\u6240\u5e2e\u52a9\uff0c\u4e5f\u5e0c\u671b\u5927\u5bb6\u591a\u591a\u652f\u6301\u6cd3\u6e90\u89c6\u91ce\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>FFmpeg \u662f\u89c6\u9891\u5904\u7406\u6700\u5e38\u7528\u7684\u5f00\u6e90\u8f6f\u4ef6\u3002\u6b64\u5de5\u5177\u73a9\u6cd5\u5f88\u591a\uff0c\u53ef\u8de8\u5e73\u53f0\uff0c\u53ef\u4ee5\u7ed3\u5408\u7f16\u7a0bpython\u8bed\u8a00\u5904\u7406\u590d\u6742\u4efb\u52a1\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20,21],"tags":[86,87,91,89,88,90,471,352],"class_list":["post-599","post","type-post","status-publish","format-standard","hentry","category-python","category-script","tag-ffmpeg","tag-ffmpeg-winddows","tag-js-bat","tag-python"],"_links":{"self":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=599"}],"version-history":[{"count":0,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/599\/revisions"}],"wp:attachment":[{"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}