{"id":125347,"date":"2018-11-04T09:23:31","date_gmt":"2018-11-04T01:23:31","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=125347"},"modified":"2018-10-25T17:24:43","modified_gmt":"2018-10-25T09:24:43","slug":"ffmpeg-conversion-format","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ffmpeg-conversion-format.html","title":{"rendered":"\u4f7f\u7528 ffmpeg \u8f6c\u6362\u89c6\u9891\u683c\u5f0f"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nffmpeg \u662f *nix \u7cfb\u7edf\u4e0b\u6700\u6d41\u884c\u7684\u97f3\u89c6\u9891\u5904\u7406\u5e93\uff0c\u529f\u80fd\u5f3a\u5927\uff0c\u5e76\u4e14\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u7ec8\u7aef\u547d\u4ee4\uff0c\u5b9e\u662f\u65e5\u5e38\u89c6\u9891\u5904\u7406\u7684\u4e00\u5927\u5229\u5668\uff01<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u5b9e\u4f8b<\/strong><\/div>\n
flac \u683c\u5f0f\u8f6c mp3<\/strong><\/span><\/div>\n

\u97f3\u9891\u683c\u5f0f\u8f6c\u6362\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n

ffmpeg -i input.flac -acodec libmp3lame output.mp3<\/pre>\n

ffmpeg \u5c06\u4f1a\u4f7f\u7528 libmp3lame \u89e3\u7801\u5668\u5c06\u00a0input.flac\u00a0\u6587\u4ef6\u8f6c\u6362\u4e3a mp3 \u683c\u5f0f\u7684\u00a0output.mp3\u00a0\u6587\u4ef6\u3002<\/p>\n

\u6279\u91cf\u683c\u5f0f\u8f6c\u6362<\/strong><\/span><\/div>\n

\u60f3\u8981\u6279\u91cf\u8f6c\u6362 flac \u6587\u4ef6\u4e5f\u662f\u5f88\u5e38\u89c1\u7684\u9700\u6c42\uff0c\u6211\u4eec\u53ef\u4ee5\u7ed3\u5408 bash \u547d\u4ee4\u6765\u5b8c\u6210\uff1a<\/p>\n

find . -name \"*.flac\"<\/span> -exec bash -c 'ffmpeg -i \"{}\" -y \"${0\/.flac}.wav\"'<\/span> {} \\;\r\n<\/pre>\n
webm \u8f6c gif \u683c\u5f0f<\/strong><\/span><\/div>\n

webm \u662f Google \u63d0\u51fa\u7684\u591a\u5a92\u4f53\u6587\u4ef6\u683c\u5f0f\uff0c\u5305\u542b\u4e86 VP8 \u5f71\u7247\u8f68\u548c Ogg Vorbis \u97f3\u8f68\uff0c\u6309\u7167 BSD \u683c\u5f0f\u5f00\u6e90\u3002webm \u80fd\u591f\u63d0\u4f9b\u66f4\u9ad8\u8d28\u91cf\u7684\u5728\u7ebf\u89c6\u9891\uff0c\u4f46\u662f\u5176\u652f\u6301\u7a0b\u5ea6\u5e76\u4e0d\u5982\u5b58\u5728\u5df2\u4e45\u7684 mp4 \u548c\u52a8\u6001\u56fe\u7247\u683c\u5f0f gif\uff0c\u56e0\u6b64\u6709\u65f6\u5019\u4f1a\u6709\u5c06\u5176\u8f6c\u6362\u4e3a gif \u683c\u5f0f\u7684\u9700\u6c42\u3002\u6211\u4eec\u7528\u5230\u7684\u547d\u4ee4\u662f\uff1a<\/p>\n

ffmpeg -i input.webm -vf \"scale=400:-1,fps=10\" output.gif\r\n<\/pre>\n

\u5176\u4f5c\u7528\u662f\u5c06 input.webm \u683c\u5f0f\u7684\u89c6\u9891\u8f6c\u6362\u4e3a\u6a2a\u5411\u5bbd\u5ea6\u4e3a 400px\uff0c\u7eb5\u5411\u5bbd\u5ea6\u4fdd\u6301\u6bd4\u4f8b\u7684\u6bcf\u79d2 10 \u5e27\u7684 output.gif \u56fe\u7247\u3002<\/p>\n

\u5f53\u7136\uff0c\u4e5f\u53ef\u4ee5\u5c06 gif \u8f6c\u6362\u4e3a webm \u683c\u5f0f\uff1a<\/p>\n

ffmpeg -i output.gif -c:v libvpx -auto-alt-ref 0 input.webm\r\n<\/pre>\n

\u5982\u679c\u51fa\u73b0\u201cUnknown encoder libvpx\u201d\u7684\u95ee\u9898\uff0c\u9700\u8981\u91cd\u65b0\u5728\u91cd\u65b0\u7f16\u8bd1\u5b89\u88c5 ffmpeg \u4ee5\u652f\u6301 libvpx \u7f16\u7801\u5668\uff1a<\/p>\n

brew reinstall ffmpeg --with-libvpx<\/pre>\n

\u8f6c\u6362\u4e3a mp4 \u683c\u5f0f\uff1a<\/p>\n

ffmpeg -i input.webm -vf \"scale=trunc(iw\/2)*2:trunc(ih\/2)*2\" output.mp4\r\n<\/pre>\n

\u8fd9\u91cc vf \u53c2\u6570\u7684\u610f\u4e49\u662f\uff0c\u5c06\u89c6\u9891\u7684\u957f\u5bbd\u5f3a\u5236\u8f6c\u6362\u4e3a\u5076\u6570\uff0c\u5426\u5219\u53ef\u80fd\u9047\u5230\u201cwidth not divisible by 2\u201d\u7684\u95ee\u9898\u3002<\/p>\n

\u751f\u6210\u89c6\u9891\u7f29\u7565\u56fe<\/strong><\/div>\n
\u751f\u6210\u5c01\u9762<\/strong><\/span><\/div>\n

\u4f7f\u7528\u89c6\u9891\u7684\u7b2c\u4e00\u5e27\u4f5c\u4e3a\u5c01\u9762\uff1a<\/p>\n

ffmpeg -i your-video.mp4 -ss 00:00:00 -vframes 1 thumb.png\r\n<\/pre>\n
\u6bcf xx \u79d2\u751f\u6210\u4e00\u4e2a\u7f29\u7565\u56fe<\/strong><\/span><\/div>\n

\u6bcf\u5206\u949f\u4e00\u5f20\uff1a<\/p>\n

ffmpeg -i your-video.mp4 -vf fps=1\/60 your-video-%03d.png\r\n<\/pre>\n

\u518d\u5c06\u5176\u5408\u5e76\uff1a<\/p>\n

ffmpeg -i your-video-%03d.png -filter_complex scale=-1:-1,tile=99x1:margin=10:padding=4 output.png\r\n<\/pre>\n

\u8fd9\u91cc\u7684 tile \u957f\u5ea6\u8bbe\u5b9a\u4e3a 99\uff0c\u5e94\u5f53\u6539\u4e3a\u7f29\u7565\u56fe\u7684\u603b\u6570\u3002<\/p>\n

\u4e00\u6b65\u5230\u4f4d\uff1a<\/p>\n

ffmpeg -ss 00:00:00 -i your-video.mp4 -vf 'select=not(mod(n\\,24)),scale=-1:-1,tile=99*1'<\/span> out.png\r\n<\/pre>\n

\u610f\u601d\u662f\u4ece\u89c6\u9891\u7684 00:00:00 \u5904\u5f00\u59cb\uff0c\u6bcf 24 \u5e27\uff08\u4e00\u822c\u52a8\u6362\u90fd\u662f 24 \u5e27\u7684\uff09\u53d6\u4e00\u5f20\u56fe\u7247\uff0c\u957f\u5bbd\u4e0d\u8fdb\u884c\u538b\u7f29\uff0c\u6700\u540e\u5408\u6210\u5728 99*1 \u7684\u65b9\u683c\u4e2d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u97f3\u9891\u683c\u5f0f\u8f6c\u6362\u975e\u5e38\u7b80\u5355\uff1a ffmpeg -i input.flac -acodec libmp3lame out […]<\/p>\n","protected":false},"author":362,"featured_media":125353,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-125347","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/125347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=125347"}],"version-history":[{"count":12,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/125347\/revisions"}],"predecessor-version":[{"id":125522,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/125347\/revisions\/125522"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/125353"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=125347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=125347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=125347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}