{"id":302,"date":"2015-05-27T17:14:35","date_gmt":"2015-05-27T09:14:35","guid":{"rendered":"http:\/\/gnonstop.linkpc.net\/~gordon\/?page_id=302"},"modified":"2024-03-27T16:40:37","modified_gmt":"2024-03-27T08:40:37","slug":"ffmpeg-%e5%b8%b8%e7%94%a8%e5%8f%83%e6%95%b8","status":"publish","type":"page","link":"https:\/\/guerilla.ddns.net\/wp\/?page_id=302","title":{"rendered":"ffmpeg \u5e38\u7528\u53c3\u6578"},"content":{"rendered":"<p>ffmpeg \u5b98\u7db2: <a href=\"http:\/\/ffmpeg.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/ffmpeg.org\/<\/a><\/p>\n<h2>ffmpeg \u5e38\u7528\u8f49\u6a94\u53c3\u6578<\/h2>\n<pre><span style=\"color: black;\">-i<\/span> \u00a0\u8f38\u5165\u6a94\u6848\u540d\u7a31 (\u5982\u679c\u540d\u7a31\u5167\u6709\u7a7a\u683c\uff0c\u8981\u7528\u96d9\u5f15\u865f \" \u62ec\u8d77\u4f86)\r\n\r\n<span style=\"color: black;\">-vcodec<\/span>  \u6307\u5b9a\u5f71\u50cf\u7684\u7de8\u78bc\u683c\u5f0f, libxvid \u662f\u4e00\u822c\u6240\u8aaa\u7684 xvid\r\n<span style=\"color: black;\">-codec:v<\/span> \u540c\u4e0a\r\n<span style=\"color: black;\">-c:v<\/span> \u540c\u4e0a\r\n\r\n<span style=\"color: black;\">-acodec<\/span> \u6307\u5b9a\u8072\u97f3\u7684\u7de8\u78bc\u683c\u5f0f, libmp3lame \u5c31\u662f\u5e38\u7528\u7684 mp3 \u683c\u5f0f\r\n<span style=\"color: black;\">-codec:a<\/span> \u540c\u4e0a\r\n<span style=\"color: black;\">-c:a<\/span> \u540c\u4e0a\r\n\r\n<span style=\"color: black;\">-target<\/span> \u6307\u5b9a\u8f38\u51fa\u985e\u578b\r\n  \u6307\u5b9a\u76ee\u6a19\u6a94\u6848\u985e\u578b:\r\n    vcd, svcd, dvd, dv, dv50\r\n  \u800c\u985e\u578b\u53ef\u5e36\u4ee5\u4e0b\u9019\u4e9b\u524d\u8f1f\uff0c\u4f86\u4f7f\u7528\u76f8\u5c0d\u61c9\u7684\u6a19\u6e96:\r\n    ntsc-, pal-, film-\r\n  \u4f7f\u7528 -target \u9078\u9805\u7684\u8a71, \u5176\u4ed6\u9078\u9805 (\u7de8\u78bc\u5668\u3001\u4f4d\u5143\u7387\u3001\u7de9\u885d) \u5c07\u88ab\u81ea\u52d5\u8a2d\u5b9a\u70ba\u7b26\u5408\u6307\u5b9a\u7684\u985e\u578b\r\n\r\n<span style=\"color: black;\">-ss<\/span> \u958b\u59cb\u6642\u9593, \u683c\u5f0f\u70ba hh:mm:ss[.xxx]\r\n\r\n<span style=\"color: black;\">-t<\/span> \u6301\u7e8c\u6642\u9593, \u683c\u5f0f\u70ba hh:mm:ss[.xxx]\r\n\r\n<span style=\"color: black;\">-to<\/span> \u505c\u6b62\u6642\u9593, \u683c\u5f0f\u70ba hh:mm:ss[.xxx]\r\n\r\n<span style=\"color: black;\">-coders<\/span> \u5217\u51fa\u53ef\u7528\u7684\u7de8\u3001\u89e3\u78bc\u5668\r\n\r\n<span style=\"color: black;\">-encoders<\/span> \u5217\u51fa\u53ef\u7528\u7684\u7de8\u78bc\u5668\r\nDisplay options specific to, and information about, a particular encoder:\r\nffmpeg -h encoder=mpeg4\r\n\r\n<span style=\"color: black;\">-decoders<\/span> \u5217\u51fa\u6240\u6709\u7684\u89e3\u78bc\u5668\r\nDisplay options specific to, and information about, a particular decoder:\r\nffmpeg -h decoder=aac\r\n\r\n<\/pre>\n<h2>\u7bc4\u4f8b<\/h2>\n<h3>\u2713 \u5f71\u50cf\u6a94\u6848\u8f49\u63db\u6210 mpg (MPEG-2) \u683c\u5f0f<\/h3>\n<pre>ffmpeg -i input.avi -c:a copy -c:v mpeg2video -qscale:v <span style=\"color: black;\">2<\/span> output.mpg<\/pre>\n<p>-qscale:v <span style=\"color: black;\">2<\/span> \u6578\u5b57\u5f9e 1~31, \u6578\u5b57\u6108\u5927\u58d3\u7e2e\u6108\u5927 (\u54c1\u8cea\u6108\u5dee)<\/p>\n<h3>\u2713 \u5f71\u50cf\u6a94\u6848\u8f49\u63db\u6210 mp4 \u683c\u5f0f<\/h3>\n<p>\u2460 \u6307\u5b9a quality<\/p>\n<pre>ffmpeg -i input.mpg -c:a copy -c:v libx264 -crf <span style=\"color: black;\">18<\/span> -ss 00:03:20 -to 00:36:44 -f mp4 output1.mp4<\/pre>\n<p>-crf <span style=\"color: black;\">18<\/span> \u6578\u5b57\u5f9e 0~51, \u4e00\u822c\u4f7f\u7528\u4ecb\u65bc 19~26 (\u9810\u8a2d\u503c 23), \u6578\u5b57\u6108\u5927\u58d3\u7e2e\u6108\u5927 (\u54c1\u8cea\u6108\u5dee), \u6a94\u6848\u6108\u5c0f<\/p>\n<p>\u2461 \u6307\u5b9a H.264 profile<\/p>\n<pre>ffmpeg -i input.mp4 -c:v libx264 -profile:v <span style=\"color: black;\">baseline<\/span> output.mp4<\/pre>\n<p>-profile:v \u5f8c\u9762\u63a5\u8457\u7684\u53ef\u4ee5\u662f baseline, main \u6216\u662f high. \u5982\u679c\u5f71\u50cf\u662f\u8981\u7d66\u820a\u624b\u6a5f\u64ad\u653e\u7684, \u5c31\u7528 baseline; \u96fb\u8996\u54c1\u8cea\u5247\u7528 main; \u9ad8\u756b\u8cea\u5247\u7528 high.<\/p>\n<p>\u2462 \u6307\u5b9a x264 encoding preset<\/p>\n<pre>ffmpeg -i input.mp4 -c:v libx264 -preset <span style=\"color: black;\">slow<\/span> output.mp4<\/pre>\n<p>-preset \u5f8c\u9762\u53ef\u4ee5\u63a5 ultrafast, superfast, veryfast, faster, fast, medium (\u9810\u8a2d\u503c), slow \u6216\u662f veryslow.<\/p>\n<h3>\u2713 \u5f71\u50cf\u6a94\u6848\u8f49\u63db\u6210 avi \u683c\u5f0f<\/h3>\n<pre>ffmpeg -i input.flv -c:v libxvid -c:a libmp3lame -ar 22050 -f avi output.avi<\/pre>\n<p>-c:v \u6307\u5b9a\u5f71\u50cf\u7684\u7de8\u78bc\u683c\u5f0f, libxvid \u6307\u7684\u662f\u4e00\u822c\u6240\u8aaa\u7684 xvid<br \/>\n-c:a \u6307\u5b9a\u8072\u97f3\u7684\u7de8\u78bc\u683c\u5f0f, libmp3lame \u5c31\u662f\u5e38\u7528\u7684 mp3 \u683c\u5f0f<br \/>\n-ar \u6307\u5b9a\u8072\u97f3\u7684\u53d6\u6a23\u983b\u7387, \u4e00\u822c\u9810\u8a2d\u662f 44100<br \/>\n-f \u5f37\u8feb\u8f38\u51fa\u7684\u5f71\u50cf\u683c\u5f0f<\/p>\n<h3>\u2713 \u5f71\u50cf\u6a94\u6848\u8f49\u63db\u6210 3gp \u683c\u5f0f<\/h3>\n<pre>ffmpeg -i input.avi -s qcif -c:v h263 -c:a libfaac -ac 1 -ar 8000 -r 25 -ab 32 outpit.3gp<\/pre>\n<p>-s \u756b\u9762\u7684\u89e3\u6790\u5ea6. qcif \u6307\u7684\u662f 176&#215;144, \u76f4\u63a5\u8f38\u5165\u9577\u548c\u5bec\u4e5f\u53ef\u4ee5, \u683c\u5f0f\u662f wxh<br \/>\n-c:a \u6307\u5b9a\u8072\u97f3\u7684\u7de8\u78bc\u683c\u5f0f, libfaac \u5c31\u662f\u6307 aac \u683c\u5f0f<br \/>\n-ac \u8a2d\u5b9a\u8072\u97f3\u7684\u8072\u9053\u6578, 1 \u6307\u7684\u662f\u55ae\u8072\u9053<br \/>\n-ar \u6307\u5b9a\u8072\u97f3\u7684\u53d6\u6a23\u983b\u7387<br \/>\n-r \u8a2d\u5b9afps<br \/>\n-ab \u6307\u5b9a\u8072\u97f3\u7684 bitrate<\/p>\n<h3>\u2713 \u5f71\u50cf\u6a94\u6848\u8f49\u63db\u6210 flv \u683c\u5f0f<\/h3>\n<pre>ffmpeg -i input.mpg -ab 56 -ar 22050 -b 500 -r 15 output.flv<\/pre>\n<p>-ab \u6307\u5b9a\u8072\u97f3\u7684 bitrate<br \/>\n-ar \u6307\u5b9a\u8072\u97f3\u7684\u53d6\u6a23\u983b\u7387<br \/>\n-b \u6307\u5b9a\u5f71\u50cf\u7684 bitrate<\/p>\n<pre>ffmpeg -i input.avi -ar 22050 -qscale 1 output.flv<\/pre>\n<p>\u9019\u4e00\u884c\u5f97\u5230\u7684 flv \u54c1\u8cea\u8f03\u9ad8<\/p>\n<pre>ffmpeg -i input.avi -sameq -f flv output.flv<\/pre>\n<p>\u9019\u4e00\u884c\u6703\u5f97\u5230\u6700\u9ad8\u54c1\u8cea\u7684 flv, \u4f46\u662f\u6a94\u6848\u6703\u5f88\u5927!<br \/>\n\u6240\u4ee5, \u8981\u7528 -ar \u548c -ab \u4f86\u8abf\u6574\u8072\u97f3\u8f38\u51fa; -qscale, -b (bitrate) \u548c -s (size) \u4f86\u8abf\u6574\u5f71\u50cf\u54c1\u8cea.<\/p>\n<h3>\u2713 \u5f71\u50cf\u6a94\u6848\u8f49\u63db\u6210 NTSC DVD-Video \u683c\u5f0f<\/h3>\n<pre>ffmpeg -i input.mkv -target ntsc-dvd output.mpg<\/pre>\n<h3>\u2713 \u8072\u97f3\u6a94\u6848\u8f49\u6210 mp3<\/h3>\n<pre>ffmpeg -i input.wav -c:a libmp3lame -ar 44100 -ab 128k output.mp3<\/pre>\n<p>-ar \u6307\u5b9a\u8072\u97f3\u7684\u53d6\u6a23\u983b\u7387<br \/>\n-ab \u6307\u5b9a\u8072\u97f3\u7684 bitrate<br \/>\n-c:a \u6307\u5b9a\u8072\u97f3\u7684\u7de8\u78bc\u683c\u5f0f, libmp3lame \u5c31\u662f mp3, \u5982\u679c\u8f38\u51fa\u7684\u6a94\u6848\u526f\u6a94\u540d\u6709\u6307\u5b9a mp3 \u7684\u8a71, \u5176\u5be6\u9019\u88e1\u7701\u7565\u6c92\u95dc\u4fc2.<br \/>\n\u82e5\u539f\u672c\u7684\u8072\u97f3\u6a94\u97f3\u91cf\u592a\u5c0f, \u53ef\u4ee5\u518d\u52a0\u4e00\u500b -vol 200 \u7684\u53c3\u6578, \u6703\u8b93\u8f38\u51fa\u7684 mp3 \u97f3\u91cf\u8b8a\u6210 200%, \u5c31\u5169\u500d\u5927\u8072. 200 \u662f\u767e\u5206\u6bd4, \u53ef\u4ee5\u96a8\u610f\u8abf\u6574<\/p>\n<p>\u53c3\u8003\u8cc7\u6599:<br \/>\n<em>\u25cf <a href=\"http:\/\/superuser.com\/questions\/490683\/cheat-sheets-and-presets-settings-that-actually-work-with-ffmpeg-1-0\" target=\"_blank\" rel=\"noopener noreferrer\">Cheat sheets and presets-settings that actually work with FFmpeg 1.0?<\/a><\/em><br \/>\n<em>\u25cf <a href=\"https:\/\/www.mobile01.com\/topicdetail.php?f=510&#038;t=3734550\" target=\"_blank\" rel=\"noopener noreferrer\">FFmpeg &#8211; \u6cdb\u7528\u5f71\u97f3\u8f49\u63db\u5de5\u5177<\/a><\/em><br \/>\n<em>\u25cf <a href=\"http:\/\/www.kilobitspersecond.com\/2007\/05\/24\/ffmpeg-quality-comparison\/\" target=\"_blank\" rel=\"noopener noreferrer\">FFmpeg Quality Comparison<\/a><\/em><br \/>\n<em>\u25cf <a href=\"http:\/\/superuser.com\/questions\/835871\/how-to-make-an-mpeg2-video-file-with-the-highest-quality-possible-using-ffmpeg\" target=\"_blank\" rel=\"noopener noreferrer\">How to make an MPEG2 video file with the highest quality possible using FFMPEG?<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ffmpeg \u5b98\u7db2: http:\/\/ffmpeg.org\/ ffmpeg \u5e38\u7528\u8f49\u6a94\u53c3\u6578 -i \u00a0\u8f38\u5165\u6a94\u6848\u540d\u7a31  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"class_list":["post-302","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/pages\/302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=302"}],"version-history":[{"count":14,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/pages\/302\/revisions"}],"predecessor-version":[{"id":2807,"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=\/wp\/v2\/pages\/302\/revisions\/2807"}],"wp:attachment":[{"href":"https:\/\/guerilla.ddns.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}