{"id":1334,"date":"2020-01-21T22:56:00","date_gmt":"2020-01-21T14:56:00","guid":{"rendered":"https:\/\/www.yumefx.com\/?p=1334"},"modified":"2021-03-03T17:36:16","modified_gmt":"2021-03-03T09:36:16","slug":"ffmpeg%e8%bf%9b%e8%a1%8c%e8%a7%86%e9%a2%91%e8%bd%ac%e7%a0%81","status":"publish","type":"post","link":"https:\/\/www.yumefx.com\/?p=1334","title":{"rendered":"FFmpeg\u8fdb\u884c\u89c6\u9891\u8f6c\u7801"},"content":{"rendered":"\n<h1 style=\"text-align: center;\">\u4ecb\u7ecd<\/h1>\n<p>FFmpeg \u662f\u4e00\u4e2a\u5f00\u6e90\u591a\u5a92\u4f53\u7f16\u89e3\u7801\u5668\u5e93\uff0c\u5e76\u63d0\u4f9b\u4e86\u547d\u4ee4\u884c\u524d\u7aef\uff0c\u5176\u4e00\u5927\u7528\u9014\u5c31\u662f\u8fdb\u884c\u97f3\u9891\u6216\u89c6\u9891\u7684\u7f16\u7801\u53ca\u683c\u5f0f\u8f6c\u6362\u3002\u8bb8\u591a\u8f6f\u4ef6\u90fd\u4f7f\u7528\u4e86 FFmpeg \u6765\u8fdb\u884c\u97f3\u9891\u548c\u89c6\u9891\u7684\u7f16\u89e3\u7801\uff0c\u4f8b\u5982MPlayer\u3002<\/p>\n<p><span style=\"font-size: inherit;\">FFmpeg \u4f5c\u4e3a\u4e00\u4e2a\u9075\u5faa GNU \u5bbd\u901a\u7528\u516c\u5171\u8bb8\u53ef\u8bc1\uff08\u7b80\u79f0 LGPL\uff09\u7684\u8f6f\u4ef6\uff0c\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u83b7\u53d6\u5b83\u7684\u4ee3\u7801\u5e76\u653e\u5165\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\uff0c\u4f46\u662f\u6709\u4e00\u4e2a\u9650\u5236\uff0c\u90a3\u5c31\u662f\u8fd9\u6837\u7684\u7a0b\u5e8f\u5fc5\u987b\u4e5f\u91c7\u7528 LGPL \uff0c\u4e5f\u610f\u5473\u7740\u5fc5\u987b\u5f00\u653e\u6e90\u4ee3\u7801\u3002<\/span><\/p>\n<p><span style=\"font-size: inherit;\">\u4f46\u662f\u4e00\u4e9b\u8f6f\u4ef6\u5e76\u6ca1\u6709\u8fd9\u4e48\u505a\uff0c\u4f8b\u5982<\/span><span style=\"font-size: inherit;\">\u66b4\u98ce\u5f71\u97f3\u3001QQ \u5f71\u97f3\u3001\u683c\u5f0f\u5de5\u5382\u7b49\u7b49\u3002<\/span><\/p>\n<p>\u5e02\u9762\u4e0a\u80fd\u89c1\u5230\u7684\u5927\u591a\u6570\u8f6c\u7801\u8f6f\u4ef6\u90fd\u662f\u62ff\u7740 FFmpeg \u7684\u6838\u5fc3\uff0c\u5957\u4e86\u4e00\u5c42\u81ea\u5df1\u7684\u76ae\u800c\u5df2\u3002<\/p>\n<p>\u90a3\u4e3a\u4f55\u4e0d\u7528\u6700\u7eaf\u6b63\u7684 FFmpeg \u5462\uff01\u4e0d\u4f46\u6709\u7740\u6700\u5927\u7684\u5b9a\u5236\u6027\uff0c\u8fd8\u6709\u7740\u6700\u8f7b\u91cf\u7684\u524d\u7aef\u3002\u547d\u4ee4\u884c\u7684\u64cd\u4f5c\u754c\u9762\uff0c\u4e5f\u80fd\u591f\u5199\u5165\u811a\u672c\u4e2d\uff0c\u9ad8\u6548\u7684\u5b8c\u6210\u6279\u91cf\u4efb\u52a1\u3002<\/p>\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">\u5b89\u88c5<\/h1>\n<h3><strong>CentOS<\/strong><\/h3>\n\n\n\n<pre>\n<span>yum install ffmpeg <\/span>\n<\/pre>\n\n\n\n<h3>\u00a0<\/h3>\n<h3><strong>Ubuntu<\/strong><\/h3>\n\n\n\n<pre>\n<span>apt-get install ffmpeg<\/span>\n<\/pre>\n\n\n\n<h3>\u00a0<\/h3>\n<h3><strong>MacOS<\/strong><\/h3>\n\n\n\n<pre>\n<span>#\u5b89\u88c5HomeBrew\uff0c\u5df2\u7ecf\u5b89\u88c5\u7684\u53ef\u4ee5\u8df3\u8fc7<\/span>\n<span>ruby -e &quot;$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)&quot; <\/span>\n<span>#\u901a\u8fc7HomeBrew\u5b89\u88c5FFmpeg<\/span>\n<span>brew install ffmpeg <\/span>\n<\/pre>\n\n\n\n<h3>\u00a0<\/h3>\n<h3><strong>Windows<\/strong><\/h3>\n<p>\u4e0b\u8f7d\u5730\u5740\uff1a<a href=\"http:\/\/ffmpeg.zeranoe.com\/builds\/\">http:\/\/ffmpeg.zeranoe.com\/builds\/<\/a>\uff0c\u4e0b\u8f7d\u5b8c\u6210\u540e\u89e3\u538b\u8fd0\u884cff-prompt.bat\u3002<\/p>\n<p>\u89e3\u538b\u51fa\u6765\u7684bin\u6587\u4ef6\u5939\u91cc\u9762\u7684\u4e09\u4e2aexe\u6587\u4ef6\u5c31\u662f\u63a5\u4e0b\u6765\u8981\u7528\u5230\u7684FFmpeg\u4e86\u3002<\/p>\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">\u5a92\u4f53\u6587\u4ef6\u7684\u7ed3\u6784<\/h1>\n<p>\u4e00\u4e2a\u5a92\u4f53\u6587\u4ef6\u5e76\u4e0d\u50cf\u8bb8\u591a\u4eba\u60f3\u8c61\u7684\u90a3\u6837\uff0c\u662f\u5c06\u5a92\u4f53\u5185\u5bb9\u7f16\u7801\u8d77\u6765\u76f4\u63a5\u4f5c\u4e3a\u6587\u4ef6\u7684\u3002\u5b9e\u9645\u4e0a\uff0c\u5b83\u901a\u5e38\u662f\u7531\u591a\u4e2a\u4e0d\u540c\u79cd\u7c7b\u7684\u5a92\u4f53\u6d41\uff08 Stream \uff09\u7ec4\u6210\uff0c\u518d\u4ee5\u7279\u5b9a\u7684\u5c01\u88c5\u683c\u5f0f\u5c01\u88c5\u8d77\u6765\u7684\u3002<\/p>\n<p>\u6bd4\u8f83\u5e38\u89c1\u7684\u5a92\u4f53\u6d41\u5c31\u662f\u89c6\u9891\u6d41\u8ddf\u97f3\u9891\u6d41\u4e86\uff0c\u987e\u540d\u601d\u4e49\uff0c\u89c6\u9891\u6d41\u5b58\u50a8\u7684\u5c31\u662f\u89c6\u9891\u4fe1\u606f\uff0c\u97f3\u9891\u6d41\u5b58\u50a8\u7684\u5c31\u662f\u97f3\u9891\u4fe1\u606f\u3002\u4e00\u4e2a\u89c6\u9891\u6d41\u6216\u8005\u97f3\u9891\u6d41\u7684\u5185\u5bb9\uff0c\u5c31\u662f\u4ee5\u7279\u5b9a\u7684\u7f16\u7801\u683c\u5f0f\u6240\u5b58\u50a8\u7684\u89c6\u9891\u6216\u97f3\u9891\u4fe1\u606f\u3002<\/p>\n<p><strong>\u4e00\u4e2a\u6587\u4ef6\u7684\u91cc\u9762\u7684\u5a92\u4f53\u6d41\u6240\u91c7\u7528\u7684\u7f16\u7801\u683c\u5f0f\u8ddf\u8fd9\u4e2a\u6587\u4ef6\u7684\u540e\u7f00\u540d\u5e76\u6ca1\u6709\u5b8c\u5168\u7684\u5fc5\u7136\u8054\u7cfb\u3002<\/strong><\/p>\n<p>\u4e0d\u540c\u7684\u7f16\u7801\u683c\u8bd5\u7684\u7f16\u7801\u6548\u7387\u4ee5\u53ca\u529f\u80fd\u4e0d\u540c\uff0c\u8981\u67e5\u770b\u4e00\u4e2a\u7f16\u7801\u683c\u5f0f\u7684\u8be6\u7ec6\u4fe1\u606f\u548c\u53c2\u6570\uff0c\u8fd0\u884c ffmpeg -help encoder=\u7f16\u7801\u683c\u5f0f \u3002<\/p>\n<p>\u6587\u4ef6\u7684\u540e\u7f00\u540d\u901a\u5e38\u4ee3\u8868\u8fd9\u4e2a\u6587\u4ef6\u7684\u5c01\u88c5\u683c\u5f0f\uff0c\u7528\u6765\u5c06\u97f3\u9891\u6d41\u548c\u89c6\u9891\u6d41\u5305\u88f9\u8d77\u6765\uff0c\u540c\u65f6\u8fd8\u53ef\u4ee5\u6dfb\u52a0\u4e00\u4e9b\u5b57\u5e55\u3001\u9644\u4ef6\u7b49\u3002\u5c01\u88c5\u683c\u5f0f\u4e5f\u6709\u5f88\u591a\u79cd\uff0c\u8fd0\u884c ffmpeg -formats \u5c31\u53ef\u4ee5\u770b\u5230\u3002<\/p>\n<p>\u4e0d\u540c\u7684\u5c01\u88c5\u683c\u5f0f\u4e0d\u4e00\u5b9a\u80fd\u591f\u88c5\u4e0b\u540c\u6837\u7684\u4e1c\u897f\u3002\u6709\u7684\u5c01\u88c5\u683c\u5f0f\u53ef\u4ee5\u88c5\u4e0b\u89c6\u9891\u6d41\u548c\u97f3\u9891\u6d41\uff0c\u6709\u7684\u53ea\u80fd\u88c5\u4e0b\u97f3\u9891\u6d41\uff0c\u6709\u7684\u53ea\u80fd\u88c5\u4e0b\u89c6\u9891\u6d41\u3002\u6709\u7684\u80fd\u585e\u8fdb\u5f88\u591a\u4e1c\u897f\uff0c\u6709\u7684\u53ea\u80fd\u653e\u7279\u5b9a\u7684\u51e0\u4e2a\u5a92\u4f53\u6d41\u3002\u8981\u67e5\u770b\u4e00\u4e2a\u5c01\u88c5\u683c\u5f0f\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8fd0\u884c ffmpeg -help muxer=\u5c01\u88c5\u683c\u5f0f \u3002<\/p>\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">\u8f6c\u7801<\/h1>\n\n\n\n<pre>\n<span>ffmpeg -i input.avi output.mp4<span>\n<\/pre>\n\n\n\n<p>\u4e0a\u9762\u8fd9\u884c\u5c31\u662f\u6700\u7b80\u5355\u7684\u8f6c\u7801\u547d\u4ee4\u3002\u00a0<\/p>\n<p>-i \u9009\u9879\u8868\u793a\u6307\u5b9a\u8f93\u5165\u6587\u4ef6\u3002<\/p>\n<h3>\u00a0<\/h3>\n<h3><strong>\u6307\u5b9a\u7f16\u7801\u5668<\/strong><\/h3>\n<p>FFmpeg \u4f1a\u81ea\u52a8\u5224\u65ad\u8f93\u5165\u6587\u4ef6\u7684\u5c01\u88c5\u683c\u5f0f\u4ee5\u53ca\u7f16\u7801\uff0c\u5e76\u4e14\u6839\u636e\u8f93\u51fa\u6587\u4ef6\u7684\u540e\u7f00\u540d\u6765\u5224\u65ad\u5176\u5c01\u88c5\u683c\u5f0f\u3002\u540c\u65f6\uff0c FFmpeg \u4e5f\u4f1a\u6839\u636e\u8be5\u79cd\u5c01\u88c5\u683c\u5f0f\u7684\u9ed8\u8ba4\u7f16\u7801\u6765\u51b3\u5b9a\u8f93\u51fa\u6587\u4ef6\u7684\u7f16\u7801\u3002<\/p>\n<p>\u800c\u901a\u8fc7\u4f7f\u7528 -vcodec \u9009\u9879\uff0c\u53ef\u4ee5\u6307\u5b9a\u89c6\u9891\u7f16\u7801\u5668\u3002\u5982\u679c\u6307\u5b9a copy \u5c06\u4e0d\u4f1a\u91cd\u65b0\u7f16\u7801\uff0c\u800c\u662f\u76f4\u63a5\u628a\u539f\u6765\u7684\u5a92\u4f53\u6d41\u62f7\u8d1d\u8fc7\u53bb\u3002<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i Tor_Animation_en.mp4 -vcodec hevc tor.mkv <\/span>\n<\/pre>\n\n\n\n<p>-acodec \u9009\u9879\uff0c\u662f\u7528\u6765\u6307\u5b9a\u97f3\u9891\u7f16\u7801\u7684\u3002\u6240\u4ee5\u5982\u679c\u6211\u60f3\u8981\u4ee5 Matroska \u4f5c\u4e3a\u5c01\u88c5\u683c\u5f0f\uff0c HEVC \u4f5c\u4e3a\u89c6\u9891\u7f16\u7801\uff0c Opus \u4f5c\u4e3a\u97f3\u9891\u7f16\u7801\uff0c\u4f7f\u7528\u7684\u547d\u4ee4\u4f1a\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i input.mp4 -vcodec hevc -acodec opus output.mkv<\/span>\n<\/pre>\n\n\n\n<p>\u5982\u679c\u6211\u60f3\u8981\u76f4\u63a5\u62f7\u8d1d\u5a92\u4f53\u6d41\u5230\u8f93\u51fa\u6587\u4ef6\u4e2d\u800c\u4e0d\u91cd\u65b0\u8fdb\u884c\u7f16\u7801\uff08\u4e5f\u5c31\u662f\u53ea\u8f6c\u6362\u4e00\u4e0b\u5c01\u88c5\u683c\u5f0f\uff09\uff0c\u5728\u7f16\u7801\u5668\u7684\u4f4d\u7f6e\u4e0a\u5199 copy \u3002<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i Tor_Animation_en.mp4 -vcodec copy -acodec copy tor.mkv<\/span>\n<\/pre>\n\n\n\n<p>\u56e0\u4e3a\u8fd9\u6837\u4e0d\u8fdb\u884c\u7f16\u7801\uff0c\u6240\u4ee5\u901a\u5e38\u4f1a\u5f88\u5feb\u3002<\/p>\n<p>&nbsp;-vcodec \u53ef\u4ee5\u7f29\u5199\u4e3a -c:v \uff0c -acodec \u53ef\u4ee5\u7f29\u5199\u4e3a -c:a \u3002<\/p>\n<p>AAC \u662f\u4e00\u79cd\u88ab\u5341\u5206\u5e7f\u6cdb\u4f7f\u7528\u7684\u97f3\u9891\u7f16\u7801\uff0c\u4e5f\u662f MP4 \u5c01\u88c5\u683c\u5f0f\u7684\u9ed8\u8ba4\u97f3\u9891\u7f16\u7801\u3002 \u5c06\u89c6\u9891\u8f6c\u6362\u4e3a Matroska \u5c01\u88c5\u683c\u5f0f\uff0c HEVC \u89c6\u9891\u7f16\u7801\uff0c AAC \u97f3\u9891\u7f16\u7801\uff0c\u547d\u4ee4\u5982\u4e0b<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i Tor_Animation_en.mp4 -c:v hevc -c:a aac -strict -2 tor.mkv<\/span>\n<\/pre>\n\n\n\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">\u5176\u4ed6\u529f\u80fd<\/h1>\n<h3><strong>\u5e38\u7528\u97f3\u9891\u9009\u9879<\/strong><\/h3>\n<h5><strong>-ar<\/strong><\/h5>\n<p>\u00a0-ar \u9009\u9879\u540e\u9762\u8fd8\u8981\u8ddf\u4e00\u4e2arate \u53c2\u6570\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u97f3\u9891\u7684\u91c7\u6837\u7387\uff0c\u4ee5 Hz \u4e3a\u5355\u4f4d\u3002\u901a\u5e38\u6765\u8bf4\uff0c\u91c7\u6837\u7387\u8d8a\u5927\uff0c\u97f3\u8d28\u8d8a\u597d\u3002<\/p>\n<p>\u7535\u8bdd\u7684\u91c7\u6837\u7387\u901a\u5e38\u662f 8000 Hz \uff0c\u666e\u901a\u7684\u5f55\u97f3\u7b14\u901a\u5e38\u662f 32000 Hz \uff0c\u4e00\u822c\u7684 MP3 \u97f3\u4e50\u662f 44100 Hz \uff0c\u7a0d\u9ad8\u54c1\u8d28\u7684\u97f3\u4e50\u662f 48000 Hz \uff0c\u518d\u9ad8\u7684\u91c7\u6837\u7387\u6211\u4eec\u5e73\u5e38\u5c31\u4e0d\u5bb9\u6613\u63a5\u89e6\u5230\u4e86\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5c06\u97f3\u9891\u6587\u4ef6 input.mp3 \u8f6c\u6362\u4e3a Ogg \u5c01\u88c5\u683c\u5f0f\uff0c Vorbis \u7f16\u7801\uff0c\u5e76\u4e14\u6307\u5b9a\u97f3\u9891\u91c7\u6837\u7387\u4e3a 32000 Hz \u7684\u4f8b\u5b50\uff1a<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i input.mp3 -c:a libvorbis -ar 32000 output.ogg <\/span>\n<\/pre>\n\n\n\n<p>\u6ce8\u610f\uff1a \u5728 FFmpeg \u4e2d\u4f7f\u7528 Vorbis \u7f16\u7801\u65f6\uff0c\u7f16\u7801\u5668\u5e94\u6307\u5b9a\u4e3a libvorbis \u800c\u4e0d\u662f vorbis \uff0c\u8fd9\u662f\u4e24\u4e2a\u4e0d\u540c\u7684\u7f16\u7801\u5668\uff0c\u800c\u540e\u8005\u8fd8\u5904\u4e8e\u4e0d\u5b8c\u5584\u7684\u72b6\u6001\u3002<\/p>\n<p>\u6570\u5b57 32000 \u53ef\u4ee5\u7b80\u5199\u4e3a 32k \uff0c\u56e0\u4e3a &#8220;k&#8221; \u5c31\u76f8\u5f53\u4e0e\u201c\u5343\u201d\u3002<\/p>\n<h5>\u00a0<\/h5>\n<h5><strong>-an<\/strong><\/h5>\n<p>\u8fd9\u4e2a\u5c31\u662f\u5728\u8fdb\u884c\u89c6\u9891\u8f6c\u7801\u7684\u65f6\u5019\uff0c\u5c06\u97f3\u9891\u7ed9\u53bb\u9664\uff0c\u8fd9\u6837\u5c31\u4f1a\u5f97\u5230\u4e00\u4e2a\u6ca1\u6709\u58f0\u97f3\u7684\u89c6\u9891\u3002<\/p>\n<h5>\u00a0<\/h5>\n<h5><strong>-vol<\/strong><\/h5>\n<p>\u8fd9\u4e2a\u9009\u9879\u6709\u4e00\u4e2a\u53c2\u6570\uff0c\u7528\u6765\u6307\u5b9a\u76f8\u5bf9\u4e0e\u539f\u6765\u7684\u6587\u4ef6\u7684\u97f3\u91cf\u5927\u5c0f\u3002<\/p>\n<p>\u6ce8\u610f\uff0c\u6807\u51c6\u7684\u97f3\u91cf\u5e76\u4e0d\u662f 100 \uff0c\u800c\u662f<strong> 256<\/strong> \uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a\u4e86 -vol 256 \u5c31\u662f\u539f\u6765\u7684\u97f3\u91cf\u4e0d\u53d8\uff08\u8ddf\u6ca1\u6307\u5b9a\u4e00\u6837\uff09\u3002<\/p>\n<p>\u4e0b\u9762\u7684\u4f8b\u5b50\u662f\u5c06\u97f3\u91cf\u51cf\u5c0f\u4e3a\u539f\u6765\u7684\u4e00\u534a\uff1a<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i input.mp3 -c:a libvorbis -vol 128 output.ogg <\/span>\n<\/pre>\n\n\n\n<h3>\u00a0<\/h3>\n<h3>\u5e38\u7528\u89c6\u9891\u9009\u9879<\/h3>\n<h5><strong>-r<\/strong><\/h5>\n<p>-r \u9009\u9879\u53ef\u4ee5\u6307\u5b9a\u89c6\u9891\u7684\u5e27\u7387\uff0c\u5176\u53c2\u6570\u7684\u5355\u4f4d\u662f Hz \uff0c\u4e5f\u5c31\u662f\u5e73\u5e38\u6240\u8bf4\u7684\u201c\u5e27\u6bcf\u79d2\u201d\uff08 FPS \uff09\u3002\u6bd4\u5982 -r 24 \u5373\u4ee3\u8868\u8f93\u51fa\u89c6\u9891\u7684\u5e27\u7387\u4e3a\u6bcf\u79d2 24 \u5e27\u3002<\/p>\n<h5>\u00a0<\/h5>\n<h5><strong>-s<\/strong><\/h5>\n<p>\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u6307\u5b9a\u89c6\u9891\u7684\u5c3a\u5bf8\uff0c\u4ee5\u50cf\u7d20\u4e3a\u5355\u4f4d\u3002\u8fd9\u4e2a\u9009\u9879\u7684\u53c2\u6570\u7531 \u5bbd\u5ea6x\u9ad8\u5ea6 \u7684\u683c\u5f0f\u586b\u5199\u3002\u6bd4\u5982\u5982\u679c\u8981\u628a\u89c6\u9891\u8f6c\u4e3a 720P \uff08\u4e5f\u5c31\u662f\u5bbd\u5ea6 1280 \u50cf\u7d20\uff0c\u9ad8\u5ea6 720 \u50cf\u7d20\uff09\uff0c\u5c31\u5199\u4e0a -s 1280&#215;720 \u3002<\/p>\n<p>\u4e0b\u9762\u7684\u4f8b\u5b50\u4f1a\u5c06\u8f93\u51fa\u6587\u4ef6\u89c6\u9891\u7684\u5e27\u7387\u6307\u5b9a\u4e3a 15 \u5e27\u6bcf\u79d2\uff0c\u753b\u9762\u5c3a\u5bf8 1280&#215;720 \uff1a<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i input.mp4 -r 15 -s 1280x720 output.mkv <\/span>\n<\/pre>\n\n\n\n<h5>\u00a0<\/h5>\n<h5>-vn<\/h5>\n<p>\u4e0e -an \u9009\u9879\u4e00\u6837\uff0c\u5728\u547d\u4ee4\u4e2d\u52a0\u5165\u4e86\u8fd9\u4e2a\u9009\u9879\u4e4b\u540e\uff0c\u89c6\u9891\u5185\u5bb9\u4fbf\u4f1a\u88ab\u53bb\u9664\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u53ea\u628a\u97f3\u9891\u5265\u79bb\u51fa\u6765\u3002<\/p>\n<h3>\u00a0<\/h3>\n<h3>\u5176\u4ed6\u5e38\u7528\u9009\u9879<\/h3>\n<h5><strong>-c<\/strong><\/h5>\n<p>-c \u9009\u9879\u7528\u6765\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u7684\u7f16\u7801\uff0c\u4f46\u8ddf -c:v \u548c -c:a \u4e0d\u540c\u7684\u662f\uff0c\u5b83\u6307\u5b9a\u7684\u662f\u5168\u90e8\u5a92\u4f53\u6d41\u7684\u7f16\u7801\u800c\u4e0d\u662f\u5355\u72ec\u4e00\u4e2a\u89c6\u9891\u6d41\u6216\u97f3\u9891\u6d41\u3002\u5728\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u8fd9\u662f\u884c\u4e0d\u901a\u7684\uff0c\u56e0\u4e3a\u89c6\u9891\u7f16\u7801\u548c\u97f3\u9891\u7f16\u7801\u662f\u4e24\u79cd\u4e0d\u540c\u7684\u4e1c\u897f\uff0c\u600e\u4e48\u80fd\u662f\u540c\u4e00\u4e2a\u5462?<\/p>\n<p>\u4f17\u6240\u5468\u77e5\uff0c\u5927\u90e8\u5206\u89c6\u9891\u6216\u97f3\u9891\u7f16\u7801\u90fd\u662f\u6709\u635f\u538b\u7f29\uff0c\u91cd\u65b0\u8fdb\u884c\u4e00\u6b21\u7f16\u7801\u4e0d\u4f46\u8d39\u65f6\u8d39\u529b\uff0c\u8fd8\u4f1a\u4ea7\u751f\u65e0\u6cd5\u633d\u56de\u7684\u753b\u8d28\/\u97f3\u8d28\u635f\u5931\uff0c\u635f\u5931\u4e00\u4e24\u6b21\u901a\u5e38\u662f\u4eba\u7c7b\u5f88\u96be\u5224\u522b\u7684\uff0c\u4f46\u662f\u6b21\u6570\u591a\u4e86\u5dee\u522b\u5c31\u5927\u4e86\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u8981\u5c3d\u91cf\u907f\u514d\u91cd\u65b0\u7f16\u7801\uff0c\u80fd\u7528 copy \u4f5c\u4e3a\u201c\u7f16\u7801\u5668\u201d\u7684\u65f6\u5019\u5c31\u5c3d\u91cf\u4f7f\u7528\u5b83\u3002<\/p>\n<p>\u8ba9\u89c6\u9891\u4e0d\u91cd\u65b0\u7f16\u7801\u7684\u65f6\u5019\u4f7f\u7528 -c:v copy \uff0c\u8ba9\u97f3\u9891\u4e0d\u91cd\u65b0\u7f16\u7801\u7684\u65f6\u5019\u4f7f\u7528 -c:a copy \u3002\u90a3\u4e48\u5728\u4e24\u4e2a\u90fd\u8981\u4e0d\u91cd\u65b0\u7f16\u7801\u7684\u65f6\u5019\uff0c\u5c31\u4e0d\u7528\u628a\u8fd9\u4e24\u6761\u9009\u9879\u90fd\u5199\u4e0a\u53bb\u4e86\uff0c\u53ea\u8981 -c copy \u5c31\u8db3\u591f\u3002<\/p>\n<p>\u4f8b\u5982\u5c06\u89c6\u9891\u5c3a\u5bf8\u8f6c\u6362\u4e3a `1280&#215;720` \uff0c\u5176\u4ed6\u4e0d\u53d8\u3002<\/p>\n<p>\u56e0\u4e3a\u89c6\u9891\u7684\u5c3a\u5bf8\u53d8\u4e86\uff0c\u6240\u4ee5\u89c6\u9891\u4e0d\u5f97\u4e0d\u91cd\u65b0\u7f16\u7801\uff0c\u4f46\u97f3\u9891\u4e0d\u7528\u3002<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i input.mp4 -c:v h264 -c:a copy -s 1280x720 output.mp4 <\/span>\n<\/pre>\n\n\n\n<p>\u4ec5\u4ec5\u5c06 MP4 \u5c01\u88c5\u683c\u5f0f\u8f6c\u6362\u4e3a Matroska \u5c01\u88c5\u683c\u5f0f\u3002<\/p>\n<p>\u53ea\u662f\u5c01\u88c5\u683c\u5f0f\u53d8\u4e86\uff0c\u89c6\u9891\u548c\u97f3\u9891\u90fd\u4e0d\u9700\u8981\u91cd\u65b0\u7f16\u7801\u3002<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i input.mp4 -c copy output.mkv <\/span>\n<\/pre>\n\n\n\n<h5>\u00a0<\/h5>\n<h5>-t<\/h5>\n<p>\u8fd9\u4e2a\u9009\u9879\u7528\u6765\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u7684\u6301\u7eed\u65f6\u95f4\uff0c\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff0c\u6bd4\u5982\u60f3\u622a\u53d6 full.mp4 \u8fd9\u4e2a\u89c6\u9891\u7684\u524d 30 \u79d2\u5e76\u4fdd\u5b58\u4e3a segment.mp4 \uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i full.mp4 -c copy -t 30 segment.mp4<\/span>\n<\/pre>\n\n\n\n<p>\u6ce8\u610f\uff1a \u6240\u4ee5\u4e0d\u9700\u8981\u8fdb\u884c\u91cd\u65b0\u7f16\u7801\uff0c\u56e0\u4e3a\u91cd\u65b0\u8f6c\u7801\u635f\u5931\u8d28\u91cf\u4ee5\u53ca\u5f71\u54cd\u622a\u53d6\u901f\u5ea6\uff0c\u80fd\u4e0d\u91cd\u65b0\u7f16\u7801\u5c31\u5c3d\u91cf\u4e0d\u8981\u91cd\u65b0\u7f16\u7801\u3002<\/p>\n<p>\u8fd9\u4e2a\u9009\u9879\u7684\u53c2\u6570\u4ee5\u79d2\u4e3a\u5355\u4f4d\uff0c5:00 \u53ef\u4ee5\u8868\u793a 5 \u5206\u949f\uff0c 1:23:45 \u53ef\u4ee5\u8868\u793a 1 \u5c0f\u65f6 23 \u5206\u949f 45 \u79d2\u3002\u4e5f\u53ef\u4ee5\u5199\u5c0f\u6570\u70b9\uff0c\u6bd4\u5982 10.0268 \u6216\u8005 1:23:45.678 \u3002<\/p>\n<h5>\u00a0<\/h5>\n<h5>-ss<\/h5>\n<p>\u8fd9\u4e2a\u9009\u9879\u7528\u6765\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u76f8\u5bf9\u4e8e\u8f93\u5165\u6587\u4ef6\u7684\u5f00\u59cb\u65f6\u95f4\uff0c\u6bd4\u5982\u6211\u60f3\u628a full.mp4 \u8fd9\u4e2a\u89c6\u9891\u7684\u524d 30 \u79d2\u526a\u6389\u5e76\u628a\u5269\u4e0b\u7684\u4fdd\u5b58\u4e3a segment.mp4 \uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i full.mp4 -c copy -ss 30 segment.mp4<\/span>\n<\/pre>\n\n\n\n<p>-ss \u9009\u9879\u4e5f\u53ef\u4ee5\u8ddf -t \u9009\u9879\u914d\u5408\u4f7f\u7528\u4ee5\u622a\u53d6\u5a92\u4f53\u6587\u4ef6\u7684\u4e00\u90e8\u5206\uff0c\u6bd4\u5982\u5982\u679c\u6211\u60f3\u622a\u53d6 full.mp4 \u7684 12 \u5206 25 \u79d2\u81f3 20 \u5206 27 \u79d2\uff0c\u4fdd\u5b58\u4e3a segment.mp4 \uff0c\u4f7f\u7528\u8fd9\u6761\u547d\u4ee4\u3002<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i full.mp4 -c copy -ss 12:25 -t 8:02 segment.mp4<\/span>\n<\/pre>\n\n\n\n<h5>\u00a0<\/h5>\n<h5>-metadata<\/h5>\n<p>\u8fd9\u4e2a\u9009\u9879\u6240\u66f4\u6539\u7684\u662f\u8f93\u51fa\u6587\u4ef6\u7684\u5143\u6570\u636e\uff0c\u6bd4\u5982\u4e00\u9996\u6b4c\u7684\u6807\u9898\u3001\u827a\u672f\u5bb6\u3001\u4e13\u8f91\u3002\u6bd4\u5982 -metadata title=&#8221;\u6211\u662f\u6807\u9898&#8221; \u5c31\u4f1a\u628a\u8f93\u51fa\u6587\u4ef6\u7684\u6807\u9898\u5143\u6570\u636e\u6539\u4e3a \u6211\u662f\u6807\u9898 \u3002<\/p>\n<p>\u53ef\u4ee5\u591a\u6b21\u6307\u5b9a\u4ee5\u66f4\u6539\u591a\u4e2a\u5143\u6570\u636e\uff0c\u4f8b\u5982\u628a `no metadata.mp3` \u7684\u6807\u9898\u6539\u6210 `\u4e00\u9996\u6b4c` \uff0c\u827a\u672f\u5bb6\u6539\u6210 `\u4e00\u4f4d\u827a\u672f\u5bb6` \uff0c\u4e13\u8f91\u6539\u6210 `\u4e00\u5f20\u4e13\u8f91` \uff0c\u7136\u540e\u4fdd\u5b58\u4e3a `with metadata.mp3` \uff1a<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i &quot;no metadata.mp3&quot; -c copy -metadata title=&quot;\u4e00\u9996\u6b4c&quot; -metadata artist=&quot;\u4e00\u4f4d\u827a\u672f\u5bb6&quot; -metadata album=&quot;\u4e00\u5f20\u4e13\u8f91&quot; &quot;with metadata.mp3&quot;<\/span>\n<\/pre>\n\n\n\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">\u5b57\u5e55<\/h1>\n<h3>\u4f5c\u4e3a\u5b57\u5e55\u6d41<\/h3>\n<p>\u5982\u5a92\u4f53\u6587\u4ef6\u7684\u7ed3\u6784\u4e2d\u6240\u8bf4\uff0c\u5a92\u4f53\u6587\u4ef6\u662f\u7531\u591a\u4e2a\u5a92\u4f53\u6d41\u7ec4\u6210\u7684\uff0c\u6211\u4eec\u5df2\u7ecf\u5bf9\u89c6\u9891\u6d41\u548c\u97f3\u9891\u6d41\u5f88\u719f\u6089\u4e86\uff0c\u4f46\u5728\u8fd9\u4e00\u8282\uff0c\u6211\u4eec\u5c06\u8ba4\u8bc6\u53e6\u4e00\u79cd\u5a92\u4f53\u6d41\u2014\u2014\u5b57\u5e55\u6d41\u3002\u5b57\u5e55\u6d41\u72ec\u7acb\u4e8e\u89c6\u9891\u6d41\uff0c\u6240\u4ee5\u5b83\u53ef\u4ee5\u968f\u65f6\u5f00\u5173\uff0c\u5c31\u50cf\u58f0\u97f3\u53ef\u4ee5\u88ab\u9759\u97f3\u4e00\u6837\uff0c\u4e5f\u53ef\u4ee5\u6709\u591a\u4e2a\u8fdb\u884c\u5207\u6362\uff0c\u4f8b\u5982\u6709\u591a\u56fd\u8bed\u8a00\u5b57\u5e55\u7684\u7535\u5f71\u8d44\u6e90\u3002<\/p>\n<p>\u5b57\u5e55\u6d41\u8ddf\u5176\u4ed6\u5a92\u4f53\u6d41\u4e00\u6837\uff0c\u6709\u5404\u79cd\u7f16\u7801\uff0c\u5e38\u89c1\u7684\u7f16\u7801\u6709 SubRip \uff08\u4f5c\u4e3a\u72ec\u7acb\u6587\u4ef6\u65f6\u540e\u7f00\u540d\u4e3a .srt \uff09\u548c ASS \uff08\u4f5c\u4e3a\u72ec\u7acb\u6587\u4ef6\u65f6\u540e\u7f00\u540d\u4e3a .ass \uff09\u3002<\/p>\n<p>\u5b57\u5e55\u6587\u4ef6\u5176\u5b9e\u4e5f\u80fd\u591f\u7b97\u662f\u5a92\u4f53\u6587\u4ef6\uff0c\u53ea\u4e0d\u8fc7\u5b83\u4e0d\u5305\u542b\u89c6\u9891\u6d41\u548c\u97f3\u9891\u6d41\uff0c\u800c\u662f\u53ea\u5305\u542b\u4e86\u5b57\u5e55\u6d41\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u5982\u679c\u6211\u628a\u53ea\u6709\u89c6\u9891\u6d41\u548c\u97f3\u9891\u6d41\u7684\u5a92\u4f53\u6587\u4ef6 Tor_Animation_en.mp4 \u4e0e\u53ea\u6709\u5b57\u5e55\u6d41\u7684\u5a92\u4f53\u6587\u4ef6 Tor_animation.zh-CN.srt \u5408\u5e76\u5230\u4e00\u8d77\uff0c\u5c31\u4f1a\u5f97\u5230\u4e00\u4e2a\u6709\u89c6\u9891\u6d41\u3001\u97f3\u9891\u6d41\u548c\u5b57\u5e55\u6d41\u7684\u5a92\u4f53\u6587\u4ef6\u4e86\u3002<\/p>\n<p>\u5728 FFmpeg \u4e2d\uff0c\u8fd9\u6837\u505a\u5f88\u7b80\u5355\uff0c\u53ea\u8981\u628a\u8981\u5408\u5e76\u7684\u4e24\u4e2a\u6587\u4ef6\u90fd\u4f5c\u4e3a\u8f93\u5165\u6587\u4ef6\u5c31\u53ef\u4ee5\u4e86\uff0c\u4e5f\u5c31\u662f\u5728 ffmpeg \u540e\u9762\u5199\u4e0a -i Tor_Animation_en.mp4 -i Tor_animation.zh-CN.srt \u3002 FFmpeg \u4f1a\u5c06\u4e24\u4e2a\u8f93\u5165\u6587\u4ef6\u4e2d\u7684\u5a92\u4f53\u6d41\u653e\u90fd\u5230\u5176\u8f93\u51fa\u6587\u4ef6\u4e2d\u53bb\u3002<\/p>\n<p>\u4f46\u662f\u5e76\u4e0d\u662f\u6240\u6709\u7684\u5c01\u88c5\u683c\u5f0f\u90fd\u652f\u6301\u5b57\u5e55\u6d41\uff0c\u6bd4\u5982\u5e38\u89c1\u7684 MP4 \u683c\u5f0f\u5c31\u4e0d\u652f\u6301\u3002\u8981\u67e5\u770b\u4e00\u4e2a\u5c01\u88c5\u683c\u5f0f\u662f\u5426\u652f\u6301\u5b57\u5e55\u6d41\uff0c\u8bf7\u8fd0\u884c ffmpeg -help muxer=\u5c01\u88c5\u683c\u5f0f \uff0c\u5982\u679c\u8f93\u51fa\u4e2d\u6709 Default subtitle codec: \u8fd9\u6837\u4e00\u884c\uff0c\u5373\u4ee3\u8868\u6b64\u5c01\u88c5\u683c\u5f0f\u652f\u6301\u5b57\u5e55\u6d41\u3002<\/p>\n<p>\u5982\u679c\u8f93\u51fa\u6587\u4ef6\u7684\u5c01\u88c5\u683c\u5f0f\u4e0d\u652f\u6301\u5b57\u5e55\u6d41\uff0c FFmpeg \u4f1a\u5ffd\u7565\u6389\u5b83\u6216\u8005\u62a5\u9519\u3002<\/p>\n<p>\u56e0\u4e3a\u5b57\u5e55\u6d41\u4e5f\u662f\u5a92\u4f53\u6d41\uff0c\u4e5f\u6709\u5404\u79cd\u7f16\u7801\uff0c\u6240\u4ee5\uff0c\u6211\u4eec\u4e5f\u53ef\u4ee5\u901a\u8fc7 -scodec \u6216 -c:s \u9009\u9879\u6765\u6307\u5b9a\u5b57\u5e55\u6d41\u7684\u7f16\u7801\u3002\u8fd9\u4e2a\u4f8b\u5b50\u53ef\u4ee5\u8ba9 FFmpeg \u590d\u5236\u89c6\u9891\u6d41\u548c\u97f3\u9891\u6d41\uff08\u4e0d\u7528\u91cd\u65b0\u7f16\u7801\uff0c\u52a0\u5feb\u4e86\u5904\u7406\u901f\u5ea6\uff09\uff0c\u800c\u5c06\u5b57\u5e55\u6d41\u8f6c\u6362\u4e3a ass \u7f16\u7801\uff1a<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i Tor_Animation_en.mp4 -i Tor_animation.zh-CN.srt -c:v copy -c:a copy -c:s ass Tor_Animation_subtitled.mkv<\/span>\n<\/pre>\n\n\n\n<p>\u540c\u6837\u7684\uff0c -c \u9009\u9879\u9664\u4e86\u4f1a\u5f71\u54cd\u5230\u89c6\u9891\u6d41\u548c\u97f3\u9891\u6d41\u4ee5\u5916\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5230\u5b57\u5e55\u6d41\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u6307\u5b9a -c copy \u4e5f\u4f1a\u8ba9 FFmpeg \u4e0d\u5bf9\u5b57\u5e55\u6d41\u8fdb\u884c\u91cd\u65b0\u7f16\u7801\u3002<\/p>\n<p>\u751a\u81f3\u53ef\u4ee5\u5c06\u5b57\u5e55\u6587\u4ef6\u4f5c\u4e3a\u5355\u72ec\u7684\u8f93\u5165\u6587\u4ef6\uff01\u4e5f\u5c31\u662f\u5bf9\u5b57\u5e55\u6587\u4ef6\u8fdb\u884c\u8f6c\u7801\uff0c\u6bd4\u5982 ffmpeg -i Tor_animation.zh-CN.srt Tor_animation.zh-CN.ass \u5c31\u4f1a\u5c06 SubRip \u5b57\u5e55\u8f6c\u6362\u4e3a ASS \u5b57\u5e55\u3002\uff08\u56e0\u4e3a ASS \u5c01\u88c5\u683c\u5f0f\u7684\u9ed8\u8ba4\u5b57\u5e55\u7f16\u7801\u5c31\u662f ass \uff0c\u6240\u4ee5\u8fd9\u6761\u547d\u4ee4\u4e2d\u4e0d\u7528\u5199 -c:s ass \uff09<\/p>\n<h3>\u00a0<\/h3>\n<h3>\u7f16\u5165\u89c6\u9891\u6d41<\/h3>\n<p>\u867d\u7136\u5b57\u5e55\u6d41\u662f\u4e00\u4e2a\u5f88\u65b9\u4fbf\u7684\u4e1c\u897f\uff0c\u4f46\u662f\u7531\u4e8e\u4e00\u4e9b\u5dee\u7684\u64ad\u653e\u5668\u4e0d\u652f\u6301\u5b57\u5e55\u6d41\uff0c\u5b57\u5e55\u6d41\u4e5f\u7684\u663e\u793a\u4e5f\u53d6\u51b3\u4e8e\u64ad\u653e\u5668\u6240\u4f7f\u7528\u7684\u5b57\u4f53\uff0c\u6240\u4ee5\u5728\u5f88\u591a\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u5c06\u5b57\u5e55\u653e\u5230\u89c6\u9891\u5185\u5bb9\u4e2d\uff0c\u800c\u4e0d\u662f\u72ec\u7acb\u4e8e\u89c6\u9891\u6d41\u7684\u5b57\u5e55\u6d41\u3002<\/p>\n<p>\u6ce8\u610f\uff1a \u56e0\u4e3a\u8fd9\u6837\u505a\u4f1a\u6539\u5199\u89c6\u9891\u6d41\uff0c\u6240\u4ee5\u539f\u672c\u89c6\u9891\u4e2d\u88ab\u5b57\u5e55\u8986\u76d6\u7684\u5730\u65b9\u5c31\u65e0\u6cd5\u518d\u88ab\u663e\u793a\u51fa\u6765\u4e86\u3002<\/p>\n<h5>\u00a0<\/h5>\n<h5><strong>-vf<\/strong>\u00a0<\/h5>\n<p>\u8fd9\u4e2a\u9009\u9879\u88ab\u7528\u6765\u7ed9\u89c6\u9891\u6dfb\u52a0\u6ee4\u955c\uff0c\u5c31\u50cf\u56fe\u50cf\u5904\u7406\u8f6f\u4ef6\u7684\u6ee4\u955c\u4e00\u6837\uff0c\u6709\u98a0\u5012\u3001\u653e\u5927\u3001\u6539\u53d8\u989c\u8272\u3001\u6a21\u7cca\u4e4b\u7c7b\u7684\u4e1c\u897f\u3002\u7528 ffmpeg -filters \u53ef\u4ee5\u67e5\u770b FFmpeg \u652f\u6301\u7684\u6ee4\u955c\u3002<\/p>\n<p>\u6211\u4eec\u8981\u5728\u89c6\u9891\u6d41\u4e0a\u9762\u52a0\u4e0a\u5b57\u5e55\uff0c\u5c31\u5f97\u4f7f\u7528\u4e00\u4e2a\u53eb\u505a subtitles \u7684\u6ee4\u955c\uff0c\u8981\u4f7f\u7528\u8fd9\u4e2a\u6ee4\u955c\uff0c\u5728\u547d\u4ee4\u4e2d\u5199\u4e0a -vf subtitles=\u5b57\u5e55\u6587\u4ef6\u540d \u3002<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i Tor_Animation_en.mp4 -vf subtitles=Tor_animation.zh-CN.srt -c:a copy Tor_Animation_subtitled.mp4<\/span>\n<\/pre>\n\n\n\n<p>\u56e0\u4e3a\u8fd9\u4e2a\u64cd\u4f5c\u6539\u5199\u4e86\u89c6\u9891\u6d41\uff0c\u6240\u4ee5\u89c6\u9891\u6d41\u5fc5\u987b\u5f97\u91cd\u65b0\u7f16\u7801\u3002<\/p>\n<p>\u5728\u4e0a\u9762\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6ca1\u6709\u4f7f\u7528 -c:v \u9009\u9879\uff0c FFmpeg \u5219\u4f1a\u4f7f\u7528 MP4 \u5c01\u88c5\u683c\u5f0f\u7684\u9ed8\u8ba4\u89c6\u9891\u7f16\u7801 h264 \u3002<\/p>\n<p>\u5982\u679c\u4e0e\u6b64\u540c\u65f6\uff0c\u4f7f\u7528\u4e86 -ss \u9009\u9879\uff0c\u88ab\u6e32\u67d3\u7684\u5b57\u5e55\u4e0d\u4f1a\u542c\u4ece -ss \u9009\u9879\uff0c\u800c\u662f\u4f9d\u7136\u4ece\u6700\u5f00\u59cb\u6e32\u67d3\uff0c\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c<a href=\"https:\/\/trac.ffmpeg.org\/ticket\/2067\">\u8fd9\u4e2a\u9875\u9762<\/a>\u4f9b\u4e86\u4e00\u4e9b\u65b9\u6848\u3002<\/p>\n<p>\u6ce8\u610f\uff1a \u5982\u679c\u4f60\u4f7f\u7528\u7684\u662fWindows\u7cfb\u7edf \uff0c FFmpeg \u4f1a\u5728\u5199\u89c6\u9891\u6d41\u7684\u65f6\u5019\u65e0\u6cd5\u627e\u5230\u5b57\u4f53\uff0c\u800c\u5bfc\u81f4\u8f93\u51fa\u6587\u4ef6\u4e2d\u6ca1\u6709\u4efb\u4f55\u5b57\u5e55\uff0c\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/wiki.fiveyellowmice.com\/wiki\/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8_FFmpeg_%E8%BF%9B%E8%A1%8C%E8%A7%86%E9%A2%91%E8%BD%AC%E7%A0%81:%E5%AD%97%E5%B9%95\/%E5%9C%A8_Microsoft_Windows_%E4%B8%8B%E4%BD%BF%E7%94%A8_FFmpeg_%E5%B0%86%E5%AD%97%E5%B9%95%E7%BC%96%E5%85%A5%E8%A7%86%E9%A2%91%E6%B5%81%E6%97%B6%E7%9A%84%E9%A2%9D%E5%A4%96%E8%AF%B4%E6%98%8E\">\u5728 Microsoft Windows \u4e0b\u4f7f\u7528 FFmpeg \u5c06\u5b57\u5e55\u7f16\u5165\u89c6\u9891\u6d41\u65f6\u7684\u989d\u5916\u8bf4\u660e<\/a>\u3002<\/p>\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">\u5e38\u89c1\u7f16\u7801\u5668<\/h1>\n<p>FFmpeg \u652f\u6301\u5f88\u591a\u79cd\u5a92\u4f53\u7f16\u7801\u5668\uff0c\u8fd9\u4e9b\u5a92\u4f53\u7f16\u7801\u5668\u5f53\u7136\u90fd\u4e0d\u4f1a\u662f\u5343\u7bc7\u4e00\u5f8b\u7684\uff0c\u6709\u4e9b\u7f16\u7801\u5668\u6709\u7740\u5341\u5206\u4e30\u5bcc\u7684\u9009\u9879\uff0c\u8fd9\u4e9b\u9009\u9879\u53ef\u4ee5\u8ba9\u4f60\u8c03\u6574\u7f16\u7801\u65f6\u7684\u538b\u7f29\u6bd4\u3001\u5237\u65b0\u7387\u3001\u8272\u57df\u7b49\u7b49\u3002\u4f60\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8c03\u6574\u4e00\u4e9b\u53c2\u6570\u6765\u8ba9\u8f6c\u7801\u5feb\u4e00\u4e9b\uff0c\u6216\u8005\u4f53\u79ef\u66f4\u5c0f\u3002<\/p>\n<h3>\u00a0<\/h3>\n<h3>H264 \u548c HEVC<\/h3>\n<p>\u6beb\u65e0\u7591\u95ee\uff0c H264 \u662f\u76ee\u524d\u6700\u6d41\u884c\u7684\u89c6\u9891\u7f16\u7801\u4e86\uff0c\u73b0\u5728\u6211\u4eec\u5728\u7f51\u4e0a\u89c1\u5230\u7684\u51e0\u4e4e\u6240\u6709\u89c6\u9891\u90fd\u662f\u4f7f\u7528 H264 \u8fdb\u884c\u89c6\u9891\u7f16\u7801\u7684\uff0c\u4e0d\u7ba1\u5b83\u7684\u5c01\u88c5\u683c\u5f0f\u662f MP4 \u3001 Matroska \u8fd8\u662f FLV \u3002<\/p>\n<p>\u800c\u5b83\u4e3a\u4ec0\u4e48\u4f1a\u53d8\u5f97\u5982\u6b64\u6d41\u884c\u5462\uff1f\u9664\u4e86\u8f83\u9ad8\u7684\u6548\u7387\uff0c\u4e30\u5bcc\u7684\u7f16\u7801\u5668\u9009\u9879\u4e5f\u662f\u5b83\u7684\u4f18\u70b9\u4e4b\u4e00\u3002<\/p>\n<p>HEVC \u662f H264 \u7684\u540e\u7ee7\u7248\u672c\uff0c\u53c8\u79f0 H265 \uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u66f4\u9ad8\u7684\u538b\u7f29\u6bd4\uff0c\u4e0d\u8fc7\u76ee\u524d\u6709\u8bb8\u591a\u5dee\u7684\u64ad\u653e\u5668\u4e0d\u652f\u6301\u8fd9\u79cd\u7f16\u7801\uff0c\u6240\u4ee5\u8bf7\u5c0f\u5fc3\u4f7f\u7528\u3002<\/p>\n<h3>\u00a0<\/h3>\n<h3><strong>\u6052\u6d41\u91cf\u7cfb\u6570 (CRF)<\/strong><\/h3>\n<p>\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u8ba9\u7f16\u7801\u5668\u5c3d\u91cf\u4fdd\u6301\u4e00\u5b9a\u7684\u753b\u9762\u8d28\u91cf\uff0c\u800c\u6587\u4ef6\u7684\u5927\u5c0f\u5c31\u4e0d\u662f\u90a3\u4e48\u91cd\u8981\u4e86\uff0c\u8fd9\u79cd\u65b9\u5f0f\u4e3a\u5355\u901a\u9053\u7684\u65b9\u5f0f\u63d0\u4f9b\u4e86\u6700\u5927\u7684\u538b\u7f29\u6bd4\u3002\u6bcf\u4e00\u5e27\u90fd\u4f1a\u5f97\u5230\u80fd\u4fdd\u8bc1\u5176\u8d28\u91cf\u7b49\u7ea7\u7684\u6bd4\u7279\u7387\u3002\u5b83\u7684\u574f\u5904\u662f\u4f60\u65e0\u6cd5\u786e\u8ba4\u6700\u7ec8\u4f1a\u5f97\u5230\u7684\u5177\u4f53\u6587\u4ef6\u5927\u5c0f\u6216\u4fdd\u8bc1\u5b83\u4e0d\u8d85\u8fc7\u4e00\u5b9a\u7684\u5c3a\u5bf8\u3002<\/p>\n<p>\u9996\u5148\u4f60\u9700\u8981\u9009\u62e9\u4e00\u4e2a CRF \u503c\uff0c\u8fd9\u4e2a\u503c\u5728 0 \u81f3 51 \u4e4b\u95f4\u3002 0 \u5c31\u4ee3\u8868\u65e0\u635f\uff0c 23 \u662f\u9ed8\u8ba4\u7684\uff0c 51 \u5c31\u662f\u6700\u5dee\u7684\u753b\u8d28\u4e86\u3002\u6570\u5b57\u8d8a\u5c0f\u753b\u8d28\u8d8a\u9ad8\uff0c\u4e0d\u8fc7\u901a\u5e38\u6211\u4eec\u9009 18 \u81f3 28 \u4e4b\u95f4\u5c31\u53ef\u4ee5\u4e86\uff0c\u5c31\u5f53\u4f5c 18 \u662f\u201c\u8fd1\u4e4e\u65e0\u635f\u201d\u5427\uff0c\u5982\u679c\u8f93\u5165\u6587\u4ef6\u4e0d\u662f\u65e0\u635f\u7684\u8bdd\uff0c\u901a\u5e38 18 \u5c31\u8ddf\u539f\u6765\u662f\u51e0\u4e4e\u6ca1\u533a\u522b\u7684\u4e86\u3002<\/p>\n<p>CRF \u503c\u662f\u500d\u6570\uff0c\u4e5f\u5c31\u662f\u8bf4\u628a CRF \u589e\u5927 6 \u7684\u8bdd\uff0c\u6587\u4ef6\u5c31\u4f1a\u53d8\u6210\u539f\u6765\u7684\u51e0\u4e4e\u4e00\u534a\u5927\u5c0f\uff0c\u51cf\u5c0f 6 \u7684\u8bdd\u5c31\u4f1a\u53d8\u6210\u4e24\u500d\u3002\u901a\u5e38\u9009\u62e9 CRF \u503c\u7684\u65b9\u5f0f\u662f\uff1a\u9009\u62e9\u4e00\u4e2a\u6700\u5927\u7684\u80fd\u63d0\u4f9b\u770b\u8d77\u6765\u8fd8\u53ef\u4ee5\u7684\u503c\uff0c\u5982\u679c\u51fa\u6765\u7684\u6548\u679c\u8fd8\u4e0d\u9519\uff0c\u5c31\u518d\u589e\u5927\u4e00\u4e9b\u8bd5\u8bd5\uff0c\u5982\u679c\u770b\u8d77\u6765\u753b\u8d28\u592a\u5dee\u4e86\u5c31\u51cf\u5c0f\u770b\u770b\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u4f60\u8981\u9009\u62e9\u4e00\u4e2a\u9884\u8bbe\uff0c\u9884\u8bbe\u4f1a\u5f71\u54cd\u7f16\u7801\u7684\u901f\u5ea6\u548c\u538b\u7f29\u6bd4\u3002<\/p>\n<p>\u6162\u7684\u9884\u8bbe\u4f1a\u7ed9\u51fa\u4e00\u4e2a\u8f83\u597d\u7684\u538b\u7f29\u6bd4\uff08\u538b\u7f29\u6bd4\u5c31\u662f\u753b\u9762\u8d28\u91cf\u76f8\u5bf9\u4e8e\u6587\u4ef6\u5927\u5c0f\u7684\u6bd4\u4f8b\uff09\uff0c\u4e5f\u5c31\u662f\u8bf4\u5728\u6587\u4ef6\u5927\u5c0f\u4e00\u6837\u7684\u60c5\u51b5\u4e0b\uff0c\u8d8a\u6162\u7684\u9884\u8bbe\u753b\u8d28\u8d8a\u597d\uff0c\u6216\u8005\u8bf4\u5728\u753b\u8d28\u4e00\u6837\u7684\u60c5\u51b5\u4e0b\uff0c\u8d8a\u6162\u7684\u9884\u8bbe\u6587\u4ef6\u66f4\u5c0f\u3002<\/p>\n<p>\u901a\u5e38\u9009\u5b9a\u9884\u8bbe\u7684\u65b9\u6cd5\u662f\u4f7f\u7528\u4f60\u80fd\u5fcd\u53d7\u7684\u6700\u6162\u7684\u9884\u8bbe\u3002\u76ee\u524d\u7684\u8fd9\u4e9b\u9884\u8bbe\u4ece\u5feb\u5230\u6162\u6392\u5217\u6709\uff1a ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo \u3002<\/p>\n<p>\u9ed8\u8ba4\u662f medium \uff0c placebo \u901a\u5e38\u6ca1\u6709\u7528\u6240\u4ee5\u8bf7\u65e0\u89c6\u5b83\u3002<\/p>\n<p>\u51b3\u5b9a\u597d\u4e86 CRF \u503c\u548c\u9884\u8bbe\u4e4b\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u4f7f\u7528 -crf \u9009\u9879\u6765\u6307\u5b9a CRF \u503c\uff0c -preset \u9009\u9879\u6765\u6307\u5b9a\u9884\u8bbe\u4e86\u3002\u4e0b\u9762\u7684\u4f8b\u5b50\u662f\u4f7f\u7528 22 \u4f5c\u4e3a CRF \u503c\uff0c slow \u4f5c\u4e3a\u9884\u8bbe\u6765\u8fdb\u884c\u8f6c\u7801\uff1a<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i input.mp4 -c:v h264 -crf 22 -preset slow -c:a copy output.mkv <\/span>\n<\/pre>\n\n\n\n<h3>\u00a0<\/h3>\n<h3>\u6307\u5b9a\u5e73\u5747\u6bd4\u7279\u7387<\/h3>\n<p>\u4f7f\u7528 -b:v \u9009\u9879\u53ef\u4ee5\u8ba9 FFmpeg \u4e3a H264 \u6216 HEVC \u7f16\u7801\u7684\u89c6\u9891\u6307\u5b9a\u4e00\u4e2a\u5e73\u5747\u7684\u6bd4\u7279\u7387\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u63a7\u5236\u6700\u7ec8\u7684\u6587\u4ef6\u5927\u5c0f\u4e86\u3002<\/p>\n<p>\u6bd4\u5982\u8981\u8ba9\u5e73\u5747\u6bd4\u7279\u7387\u4e3a 1000 KBit\/s \uff0c\u5c31\u5199\u4e0a -b:v 1000k \u3002<\/p>\n<p>\u4e0d\u8fc7\u8fd9\u4e2a\u9009\u9879\u4e0d\u80fd\u4e0e -crf \u9009\u9879\u540c\u65f6\u4f7f\u7528\uff0c\u56e0\u4e3a\u5b9e\u9645\u4e0a\u6307\u5b9a CRF \u503c\u5c31\u662f\u8ba9\u7f16\u7801\u5668\u81ea\u52a8\u8bc4\u5224\u51fa\u4e00\u4e2a\u5e73\u5747\u7684\u7801\u7387\u3002<\/p>\n<div class=\"mw-highlight mw-content-ltr\" dir=\"ltr\">\n<h3>\u00a0<\/h3>\n<h3>VP9<\/h3>\n<p>VP9 \u662f Google \u4e3a WebM \u683c\u5f0f\u6240\u5f00\u53d1\u51fa\u7684\u4e00\u79cd\u89c6\u9891\u7f16\u7801\uff0c\u4e13\u95e8\u4e3a\u5728\u7ebf\u4e32\u6d41\u89c6\u9891\u8bbe\u8ba1\u3002\u5168\u4e16\u754c\u6700\u5927\u7684\u89c6\u9891\u7f51\u7ad9 YouTube \u9ed8\u8ba4\u4f7f\u7528\u7684\u89c6\u9891\u7f16\u7801\u5c31\u662f VP9 \u3002\u540c\u6837\u7684\uff0c\u5b83\u4e5f\u62e5\u6709\u8bb8\u591a\u9009\u9879\u6765\u4f7f\u7f16\u7801\u53d8\u5f97\u66f4\u6709\u6548\u3002<\/p>\n<p>\u5e73\u5747\u6bd4\u7279\u7387<\/p>\n<p>\u4e0e H264 \u548c HEVC \u4e00\u6837\uff0c VP9 \u9ed8\u8ba4\u4f7f\u7528\u7684\u662f\u52a8\u6001\u6bd4\u7279\u7387\uff0c\u540c\u6837\u6211\u4eec\u4e5f\u53ef\u4ee5\u7528 -b:v \u9009\u9879\u6765\u6307\u5b9a\u5176\u5e73\u5747\u7684\u6bd4\u7279\u7387\uff0c\u6bd4\u5982\u6211\u60f3\u8ba9\u89c6\u9891\u7684\u5e73\u5747\u6bd4\u7279\u7387\u4e3a 1 MBit\/s \uff0c\u5c31\u4f7f\u7528\u8fd9\u6761\u547d\u4ee4\uff1a<\/p>\n<\/div>\n\n\n\n<pre>\n<span>ffmpeg -i input.mp4 -c:v vp9 -b:v 1m output.webm <\/span>\n<\/pre>\n\n\n\n<h3>\u00a0<\/h3>\n<h3>\u7a33\u5b9a\u753b\u8d28<\/h3>\n<p>VP9 \u7f16\u7801\u4e5f\u63d0\u4f9b\u4e86\u4e00\u79cd\u65b9\u5f0f\u8ba9\u89c6\u9891\u4fdd\u8bc1\u4e00\u5b9a\u753b\u8d28\uff0c\u4e0e H264 \u548c HEVC \u4e00\u6837\u4f7f\u7528\u7684\u662f -crf \u53c2\u6570\uff0c\u4e0d\u8fc7\u4e0e H264 \u548c HEVC \u4e0d\u540c\u7684\u662f\uff0c VP9 \u7684 CRF \u503c\u8303\u56f4\u662f 0-63 \u3002<\/p>\n<p>\u8fd8\u6709\u4e00\u70b9\u8981\u683c\u5916\u6ce8\u610f\uff0c\u8981\u8ba9 VP9 \u7f16\u7801\u5668\u4fdd\u6301\u7a33\u5b9a\u753b\u8d28\u7684\u65f6\u5019\uff0c\u5fc5\u987b\u6307\u5b9a -b:v 0 \uff0c\u4e0d\u8981\u5fd8\u4e86\u3002<\/p>\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u8981\u8ba9\u8f6c\u7801\u65f6\u4f7f\u7528 VP9 \u7f16\u7801\u5e76\u4ee5 10 \u4f5c\u4e3a CRF \u503c\uff0c\u4f7f\u7528\u8fd9\u6761\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i input.mp4 -c:v vp9 -crf 10 -b:v 0 output.webm <\/span>\n<\/pre>\n\n\n\n<h1>\u00a0<\/h1>\n<h1 style=\"text-align: center;\">\u5176\u4ed6\u529f\u80fd<\/h1>\n<h3>\u5408\u5e76\u4e24\u6bb5\u89c6\u9891<\/h3>\n<p>\u89c6\u9891\u80fd\u591f\u88ab\u5207\u5272\uff0c\u4e5f\u80fd\u591f\u88ab\u5408\u5e76\u3002\u8fd9\u91cc\u8bf4\u7684\u201c\u5408\u5e76\u201d\u5c31\u662f\u6307\u5c06\u89c6\u9891\u5934\u5c3e\u8fde\u63a5\u8d77\u6765\uff0c\u6bd4\u5982\u6211\u6709\u4e24\u6bb5\u89c6\u9891\uff0c\u4e00\u4e2a\u662f 10 \u79d2\uff0c\u53e6\u4e00\u4e2a 20 \u79d2\uff0c\u5408\u5e76\u8d77\u6765\u5c31\u662f 30 \u79d2\u3002<\/p>\n<p>\u8981\u5408\u5e76\u89c6\u9891\uff0c\u9996\u5148\u5f97\u521b\u5efa\u4e00\u4e2a\u6587\u672c\u6587\u4ef6\uff0c\u53eb\u4ec0\u4e48\u540d\u5b57\u90fd\u53ef\u4ee5\uff0c\u6211\u8fd9\u91cc\u4ee5 list.txt \u4e3a\u4f8b\u3002\u7528\u4efb\u610f\u4e00\u79cd\u4f60\u559c\u6b22\u7684\u6587\u672c\u7f16\u8f91\u5668\uff0c\u6309\u987a\u5e8f\u9010\u884c\u5199\u4e0a file\u00a0 &lt;file name&gt; \uff0c\u6bd4\u5982\u6211\u8981\u5c06 01.mp4 \u4e0e 02.mp4 \u5408\u5e76\u8d77\u6765\uff0c\u5c31\u5199\u4e0a\u8fd9\u4e9b\u5185\u5bb9\uff1a<\/p>\n<p>file 01.mp4<br \/>file 02.mp4<\/p>\n<p>\u4fdd\u5b58\u597d list.txt \u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e2d\u6267\u884c<code> ffmpeg -f concat -i list.txt -c copy \u8f93\u51fa\u6587\u4ef6\u540d<\/code> \u4e86\u3002\u5982\u679c\u4e00\u5207\u987a\u5229\uff0c\u6700\u540e\u7684\u8f93\u51fa\u6587\u4ef6\u5c31\u4f1a\u662f list.txt \u4e2d\u6240\u5199\u7684\u6587\u4ef6\u6309\u987a\u5e8f\u8fde\u63a5\u8d77\u6765\u7684\u6210\u679c\u3002<\/p>\n<p>\u8fd9\u6837\u505a\u6709\u4e00\u6761\u9650\u5236\uff0c\u90a3\u5c31\u662f\u88ab\u5408\u5e76\u7684\u89c6\u9891\u5fc5\u987b\u90fd\u662f\u4e00\u6837\u7f16\u7801\u3001\u4e00\u6837\u5c01\u88c5\u683c\u5f0f\u7684\uff0c\u5982\u679c\u4f60\u60f3\u5408\u5e76\u4e0d\u540c\u7f16\u7801\u7684\u89c6\u9891\uff0c\u6700\u597d\u5148\u8f6c\u6362\u6210\u7edf\u4e00\u7684\u7f16\u7801\u3002<\/p>\n<h3>\u00a0<\/h3>\n<h3>\u81ea\u5df1\u52a8\u624b\u5206\u914d\u5a92\u4f53\u6d41<\/h3>\n<p>\u6709\u65f6\u5019\u6211\u4eec\u8981\u9762\u5bf9\u590d\u6742\u7684\u5a92\u4f53\u6d41\u5206\u914d\uff0c\u6bd4\u5982\u6211\u6709\u4e24\u4e2a\u89c6\u9891\u6587\u4ef6\uff0c a.mp4 \u548c b.mp4 \uff0c\u6211\u60f3\u5c06 a.mp4 \u7684\u89c6\u9891\u6d41\u548c b.mp4 \u7684\u97f3\u9891\u6d41\u63d0\u53d6\u51fa\u6765\uff0c\u505a\u6210\u4e00\u4e2a\u65b0\u7684\u65b0\u89c6\u9891\u6587\u4ef6\uff0c\u8981\u600e\u4e48\u505a\u5462\uff1f<\/p>\n<p>\u6211\u53ef\u4ee5\u5148\u7528 <code>ffmpeg -i a.mp4 -c:v copy -an a_video.mp4<\/code> \u5c06 a.mp4 \u7684\u89c6\u9891\u6d41\u5355\u72ec\u63d0\u53d6\u5230\u4e00\u4e2a\u6587\u4ef6\u4e0a\uff0c\u53eb a_video.mp4 \u3002<\/p>\n<p>\u7136\u540e\u7528 <code>ffmpeg -i b.mp4 -c:a copy -vn b_audio.aac<\/code> \u5c06 b.mp4 \u7684\u97f3\u9891\u6d41\u5355\u72ec\u63d0\u53d6\u5230 b_audio.aac \u4e0a\u3002<\/p>\n<p>\u6700\u540e\u7528 <code>ffmpeg -i a_video.mp4 -i b_audio.aac -c copy final.mp4<\/code> \u5c06 a_video.mp4 \u548c b_audio.aac \u653e\u5230\u4e00\u8d77\u5f97\u5230\u6700\u540e\u7684\u6210\u679c final.mp4 \u3002<\/p>\n<p>\u53ef\u662f\u8fd9\u6837\u9700\u8981 3 \u4e2a\u6b65\u9aa4\uff0c\u8fd8\u4f1a\u4ea7\u751f\u4e34\u65f6\u6587\u4ef6\u3002\u5b9e\u9645\u4e0a\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528\u624b\u52a8\u5206\u914d\u5a92\u4f53\u6d41\u7684\u65b9\u5f0f\uff0c\u7528\u4e00\u6761\u547d\u4ee4\u5b8c\u6210\u3002<\/p>\n<p>\u8fd9\u65f6\u5c31\u8981\u7528\u5230 -map \u9009\u9879\u4e86\uff0c\u4e00\u65e6\u4f60\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c FFmpeg \u5c31\u4e0d\u4f1a\u81ea\u52a8\u4e3a\u4f60\u5c06\u8f93\u5165\u6587\u4ef6\u7684\u5a92\u4f53\u6d41\u5206\u914d\u5230\u8f93\u51fa\u6587\u4ef6\u4e0a\uff0c\u76f8\u5bf9\u7684\uff0c\u4f60\u53ef\u4ee5\u624b\u52a8\u5206\u914d\u3002<\/p>\n<p>-map \u9009\u9879\u7684\u53c2\u6570\u662f \u8f93\u5165\u6587\u4ef6\u7f16\u53f7:\u8fd9\u4e2a\u6587\u4ef6\u7684\u5a92\u4f53\u6d41\u7f16\u53f7 \uff0c\u6307\u5b9a\u4e00\u6b21\u5373\u4ee3\u8868\u8fd9\u4e2a\u5a92\u4f53\u6d41\u4f1a\u88ab\u5206\u914d\u5230\u8f93\u51fa\u6587\u4ef6\u4e2d\uff0c\u6bd4\u5982 -map 0:0 \u5c06\u4f1a\u6307\u5b9a 0 \u53f7\u8f93\u5165\u6587\u4ef6\u7684 0 \u53f7\u5a92\u4f53\u6d41\uff08\u6ce8\u610f\u7f16\u53f7\u662f\u4ee5 0 \u5f00\u59cb\u8ba1\u6570\uff01\uff09\u3002<\/p>\n<p>-map \u9009\u9879\u53ef\u4ee5\u6307\u5b9a\u591a\u6b21\uff0c\u4ece\u800c\u4f9d\u6b21\u6307\u5b9a\u8f93\u51fa\u7684\u5a92\u4f53\u6d41\u987a\u5e8f\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u7b2c\u4e00\u6b21 -map \u6307\u5b9a\u7684\u5a92\u4f53\u6d41\u5c06\u4f1a\u53d8\u6210\u8f93\u51fa\u6587\u4ef6\u7684 0 \u53f7\u5a92\u4f53\u6d41\uff0c\u7b2c\u4e8c\u6b21 -map \u5c31\u4f1a\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u7684 1 \u53f7\u5a92\u4f53\u6d41\uff0c\u4ee5\u6b64\u7c7b\u63a8\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u5982\u679c\u5199\u4e86 -map 0:0 -map 0:1 \uff0c\u90a3\u4e48 0 \u53f7\u8f93\u5165\u6587\u4ef6\u7684 0 \u53f7\u5a92\u4f53\u6d41\u5c31\u4f1a\u53d8\u6210\u8f93\u51fa\u6587\u4ef6\u7684 0 \u53f7\u5a92\u4f53\u6d41\uff0c 0 \u53f7\u8f93\u5165\u6587\u4ef6\u7684 1 \u53f7\u5a92\u4f53\u6d41\u5c31\u4f1a\u53d8\u6210\u8f93\u51fa\u6587\u4ef6\u7684 1 \u53f7\u5a92\u4f53\u6d41\u3002<\/p>\n<p>\u90a3\u4e48\u7528 -map \u8be5\u600e\u6837\u5b8c\u6210\u8fd9\u4e00\u8282\u5f00\u5934\u63d0\u5230\u7684\u4efb\u52a1\u5462\uff1f<\/p>\n<p>\u9996\u5148\u6211\u4eec\u9700\u8981\u77e5\u9053 a.mp4 \u548c b.mp4 \u7684\u5a92\u4f53\u6d41\u6709\u54ea\u4e9b\uff0c\u8fd9\u53ef\u4ee5\u901a\u8fc7 <code>ffmpeg -i a.mp4<\/code> \u6765\u5b8c\u6210\uff0c FFmpeg \u4f1a\u663e\u793a\u51fa\u8be5\u6587\u4ef6\u7684\u4fe1\u606f\u3002<\/p>\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u5230 Stream #0:0 \uff0c\u8fd9\u4ee3\u8868\u63a5\u4e0b\u6765\u5199\u7684\u662f\u7b2c 1 \u4e2a\u8f93\u5165\u6587\u4ef6\u7684\u7b2c 1 \u4e2a\u5a92\u4f53\u6d41\u7684\u4fe1\u606f\uff0c\u5b83\u544a\u8bc9\u6211\u4eec\u8fd9\u662f\u4e00\u4e2a\u89c6\u9891\u6d41\uff0c\u7528 H264 \u7f16\u7801\u3002\u5269\u4e0b\u7684\u5c31\u4e0d\u7528\u7ba1\u4e86\uff0c\u6211\u4eec\u53ea\u9700\u8981\u8bb0\u4f4f a.mp4 \u7684\u89c6\u9891\u6d41\u7684\u7f16\u53f7\u662f 0 \u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u540c\u6837\u7684\uff0c\u7528 ffmpeg -i b.mp4 \u67e5\u770b b.mp4 \u7684\u4fe1\u606f\uff0c\u5bfb\u627e\u5b83\u7684\u97f3\u9891\u6d41\u7684\u7f16\u53f7\u5e76\u8bb0\u4f4f\u5b83\uff0c\u6211\u8fd9\u91cc\u4ee5 1 \u4e3a\u4f8b\u3002<\/p>\n<p>\u90a3\u4e48\u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u5199\u6700\u540e\u7684\u547d\u4ee4\u4e86\uff0c\u5148\u6307\u5b9a\u4e24\u4e2a\u8f93\u5165\u6587\u4ef6\uff0c <code>ffmpeg -i a.mp4 -i b.mp4<\/code> \uff0c\u8fd9\u6837 a.mp4 \u5c31\u4f1a\u662f\u7b2c\u4e00\u4e2a\u8f93\u5165\u6587\u4ef6\uff08\u7f16\u53f7\u4e3a 0 \uff09\uff0c b.mp4 \u5c31\u4f1a\u662f\u7b2c 2 \u4e2a\u8f93\u5165\u6587\u4ef6\uff08\u7f16\u53f7\u4e3a 1 \uff09\u3002<\/p>\n<p>\u6211\u4eec\u5df2\u7ecf\u77e5\u9053 a.mp4 \u7684\u89c6\u9891\u6d41\u7684\u7f16\u53f7\u662f 0 \u4e86\uff0c\u90a3\u4e48\u5c31\u52a0\u4e0a -map 0:0 \uff0c\u8ba9 FFmpeg \u628a\u7b2c 1 \u4e2a\u8f93\u5165\u6587\u4ef6\u7684\u7b2c 1 \u4e2a\u5a92\u4f53\u6d41\u8f93\u51fa\uff0c\u4f5c\u4e3a\u8f93\u51fa\u6587\u4ef6\u7684\u7684\u7b2c 1 \u4e2a\u5a92\u4f53\u6d41\u3002 \u6211\u4eec\u4e5f\u77e5\u9053 b.mp4 \u7684\u97f3\u9891\u6d41\u7684\u7f16\u53f7\u662f 1 \uff0c\u5c31\u518d\u52a0\u4e0a -map 1:1 \u3002<\/p>\n<p>\u6ce8\u610f\uff1a \u522b\u5fd8\u4e86 -c copy \uff0c\u9664\u975e\u4f60\u60f3\u91cd\u65b0\u7f16\u7801\u3002<\/p>\n<p>\u6700\u540e\u5199\u4e0a\u8f93\u51fa\u6587\u4ef6\u7684\u540d\u5b57\uff0c\u6574\u6761\u547d\u4ee4\u5c31\u4f1a\u662f\u00a0<\/p>\n\n\n\n<pre>\n<span>ffmpeg -i a.mp4 -i b.mp4 -map 0:0 -map 1:1 -c copy final.mp4<\/span>\n<\/pre>\n\n\n\n<p><img loading=\"lazy\" class=\"size-full wp-image-1353 aligncenter\" src=\"http:\/\/www.yumefx.com\/wp-content\/uploads\/2020\/01\/ffmpeg1.png\" alt=\"\" width=\"401\" height=\"387\" \/><\/p>\n<p>FFmpeg\u8fd9\u91cc\u53ea\u662f\u7b80\u5355\u5165\u95e8\uff0c\u5b83\u7684\u5f3a\u5927\u529f\u80fd\u53ef\u4ee5\u67e5\u8be2<a href=\"https:\/\/ffmpeg.org\/documentation.html\">\u5b98\u65b9\u6587\u6863<\/a>\u3002<\/p>\n<p>\u672c\u6587\u8f6c\u8f7d\u81ea<a href=\"https:\/\/wiki.fiveyellowmice.com\/wiki\/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8_FFmpeg_%E8%BF%9B%E8%A1%8C%E8%A7%86%E9%A2%91%E8%BD%AC%E7%A0%81:%E9%A6%96%E9%A1%B5\">\u5982\u4f55\u4f7f\u7528 FFmpeg \u8fdb\u884c\u89c6\u9891\u8f6c\u7801<\/a>\u3002<\/p>\n<p>\u53e6\u5916\uff0cpython\u867d\u7136\u6709\u4e00\u4e2affmpy3\u7684\u7b2c\u4e09\u65b9\u5e93\u53ef\u4ee5\u8c03\u7528FFmpeg\uff0c\u4f46\u4ecd\u9700\u8981\u5b89\u88c5FFmpeg\u7684\u672c\u4f53\uff0c\u6240\u4ee5\u4f55\u4e0d\u76f4\u63a5\u7528subprocess\u8c03\u7528\u5462\uff1f<\/p>\n<p>\u00a0<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u6211\u4e0d\u60f3\u751f\u6d3b\u5728\u8ba4\u4e3a\u5584\u826f\u662f\u5f31\u70b9\u7684\u4e16\u754c\u91cc\u3002<\/p>\n<p style=\"text-align: right;\">\u2014\u2014\u57fa\u52aa\u00b7\u91cc\u7ef4\u65af<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ecb\u7ecd FFmpeg \u662f\u4e00\u4e2a\u5f00\u6e90\u591a\u5a92\u4f53\u7f16\u89e3\u7801\u5668\u5e93\uff0c\u5e76\u63d0\u4f9b\u4e86\u547d\u4ee4\u884c\u524d\u7aef\uff0c\u5176\u4e00\u5927\u7528\u9014\u5c31\u662f\u8fdb\u884c\u97f3\u9891\u6216\u89c6\u9891\u7684\u7f16\u7801\u53ca\u683c\u5f0f\u8f6c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1357,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17,4],"tags":[25,15,26],"_links":{"self":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/posts\/1334"}],"collection":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1334"}],"version-history":[{"count":0,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/posts\/1334\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=\/wp\/v2\/media\/1357"}],"wp:attachment":[{"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1334"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1334"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yumefx.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}