目录结构
- 前言
- ffmpeg下载
- ffmpeg环境变量配置
- ffmpeg环境变量配置验证
- ffmpeg使用
- 举例说明
- .mp4 转 .wav
- .mp3 转 .wav
- .ogg 转 .wav
- 参考链接
前言
本文主要记录ffmpeg在Windows系统中的安装使用方法。
ffmpeg下载
FFmpeg官网下载
ffmpeg环境变量配置
解压后将“.\ffmpeg\bin”所在目录配置到环境变量中;win7注意要使用“;”。
ffmpeg环境变量配置验证
按win+R,输入cmd打开命令行窗口,输入命令“ffmpeg –version”;
$ ffmpeg -version
ffmpeg version 7.0-essentials_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 13.2.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 59. 8.100 / 59. 8.100
libavcodec 61. 3.100 / 61. 3.100
libavformat 61. 1.100 / 61. 1.100
libavdevice 61. 1.100 / 61. 1.100
libavfilter 10. 1.100 / 10. 1.100
libswscale 8. 1.100 / 8. 1.100
libswresample 5. 1.100 / 5. 1.100
libpostproc 58. 1.100 / 58. 1.100
ffmpeg使用
转换命令
ffmpeg -i 'Your audio file' -ar 16000 -ac 1 -c:a pcm_s16le xinwen.wav
举例说明
.mp4 转 .wav
$ ffmpeg -i 'C:\Users\Administrator\Desktop\CCC\ffmpeg\xinwen.mp4' -ar 16000 -ac 1 -c:a pcm_s16le xinwen.wav
ffmpeg version 7.0-essentials_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developersbuilt with gcc 13.2.0 (Rev5, Built by MSYS2 project)configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberbandlibavutil 59. 8.100 / 59. 8.100libavcodec 61. 3.100 / 61. 3.100libavformat 61. 1.100 / 61. 1.100libavdevice 61. 1.100 / 61. 1.100libavfilter 10. 1.100 / 10. 1.100libswscale 8. 1.100 / 8. 1.100libswresample 5. 1.100 / 5. 1.100libpostproc 58. 1.100 / 58. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\Administrator\Desktop\CCC\xinwen.mp4':Metadata:major_brand : isomminor_version : 512compatible_brands: isomiso2avc1mp41encoder : Lavf57.71.100Duration: 00:00:30.42, start: 0.000000, bitrate: 1451 kb/sStream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 1320 kb/s, 25 fps, 25 tbr, 12800 tbn (default)Metadata:handler_name : VideoHandlervendor_id : [0][0][0][0]Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)Metadata:handler_name : SoundHandlervendor_id : [0][0][0][0]
Stream mapping:Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'xinwen.wav':Metadata:major_brand : isomminor_version : 512compatible_brands: isomiso2avc1mp41ISFT : Lavf61.1.100Stream #0:0(und): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s (default)Metadata:handler_name : SoundHandlervendor_id : [0][0][0][0]encoder : Lavc61.3.100 pcm_s16le
[out#0/wav @ 00000000006082c0] video:0KiB audio:951KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.008012%
size= 951KiB time=00:00:30.42 bitrate= 256.0kbits/s speed= 393x
.mp3 转 .wav
$ ffmpeg -i 'C:\Users\Administrator\Desktop\CCC\ffmpeg\我想要.mp3' -ar 16000 -ac 1 -c:a pcm_s16le woxiangyao.wav
ffmpeg version 7.0-essentials_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developersbuilt with gcc 13.2.0 (Rev5, Built by MSYS2 project)configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberbandlibavutil 59. 8.100 / 59. 8.100libavcodec 61. 3.100 / 61. 3.100libavformat 61. 1.100 / 61. 1.100libavdevice 61. 1.100 / 61. 1.100libavfilter 10. 1.100 / 10. 1.100libswscale 8. 1.100 / 8. 1.100libswresample 5. 1.100 / 5. 1.100libpostproc 58. 1.100 / 58. 1.100
Input #0, mp3, from 'C:\Users\Administrator\Desktop\CCC\ffmpeg\我想要.mp3':Metadata:encoder : Lavf58.76.100Duration: 00:05:06.00, start: 0.023021, bitrate: 128 kb/sStream #0:0: Audio: mp3 (mp3float), 48000 Hz, stereo, fltp, 128 kb/sMetadata:encoder : Lavc58.13
Stream mapping:Stream #0:0 -> #0:0 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'woxiangyao.wav':Metadata:ISFT : Lavf61.1.100Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/sMetadata:encoder : Lavc61.3.100 pcm_s16le
[out#0/wav @ 00000000005a82c0] video:0KiB audio:9561KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.000797%
size= 9561KiB time=00:05:05.95 bitrate= 256.0kbits/s speed= 783x
.ogg 转 .wav
$ ffmpeg -i 'C:\Users\Administrator\Desktop\CCC\ffmpeg\天地龙鳞.ogg' -ar 16000 -ac 1 -c:a pcm_s16le tiandilongyin.wav
ffmpeg version 7.0-essentials_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developersbuilt with gcc 13.2.0 (Rev5, Built by MSYS2 project)configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberbandlibavutil 59. 8.100 / 59. 8.100libavcodec 61. 3.100 / 61. 3.100libavformat 61. 1.100 / 61. 1.100libavdevice 61. 1.100 / 61. 1.100libavfilter 10. 1.100 / 10. 1.100libswscale 8. 1.100 / 8. 1.100libswresample 5. 1.100 / 5. 1.100libpostproc 58. 1.100 / 58. 1.100
Input #0, ogg, from 'C:\Users\Administrator\Desktop\CCC\ffmpeg\天地龙鳞.ogg':Duration: 00:01:26.79, start: 0.000000, bitrate: 117 kb/sStream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp, 96 kb/sMetadata:TITLE : 天地龙鳞 (网友改编)ARTIST : 王力宏end : 1276023endserial : 383943840endgran : 3827567
Stream mapping:Stream #0:0 -> #0:0 (vorbis (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'tiandilongyin.wav':Metadata:ISFT : Lavf61.1.100Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/sMetadata:TITLE : 天地龙鳞 (网友改编)ARTIST : 王力宏end : 1276023endserial : 383943840endgran : 3827567encoder : Lavc61.3.100 pcm_s16le
[out#0/wav @ 00000000007c82c0] video:0KiB audio:2712KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.002808%
size= 2712KiB time=00:01:26.79 bitrate= 256.0kbits/s speed= 597x
参考链接
https://blog.csdn.net/qq_43522889/article/details/134352917