终端上直接输入ffmpeg
liguangdeMBP:Desktop lumi$ ffmpeg
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: ....
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
关于命令行的参数
[]:内的内容意思是:可写可不写
{}:那就必须要在{}内给出的选择里选一个。
<>:表示必选
ffmpeg信息查询部分的主要参数形式
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
查看当前电脑的可用设备
ffmpeg -devices
-devices show available devices
Devices:
D. = Demuxing supported
.E = Muxing supported
--
D avfoundation AVFoundation input device
D lavfi Libavfilter virtual input device
E sdl,sdl2 SDL2 output device
D x11grab X11 screen capture, using XCB
查看avfoundation支持的设备
ffmpeg -f avfoundation -list_devices true -i ''
[AVFoundation indev @ 0x7fe3c7704980] AVFoundation video devices:
[AVFoundation indev @ 0x7fe3c7704980] [0] FaceTime HD Camera
[AVFoundation indev @ 0x7fe3c7704980] [1] Capture screen 0
[AVFoundation indev @ 0x7fe3c7704980] AVFoundation audio devices:
[AVFoundation indev @ 0x7fe3c7704980] [0] Built-in Microphone
指定设备录音
ffmpeg -f avfoundation -i :0 out.wav
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.2_3 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, avfoundation, from ':0':
Duration: N/A, start: 120742.093946, bitrate: 2822 kb/s
Stream #0:0: Audio: pcm_f32le, 44100 Hz, stereo, flt, 2822 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_f32le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'out.wav':
Metadata:
ISFT : Lavf58.45.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Metadata:
encoder : Lavc58.91.100 pcm_s16le
size= 1884kB time=00:00:11.37 bitrate=1356.5kbits/s speed= 1x
video:0kB audio:1884kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.004043%
查看录音文件信息
ffprobe out.wav
Input #0, wav, from 'out.wav':
Metadata:
encoder : Lavf58.45.100
Duration: 00:00:10.94, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
ffplay播放录音文件
ffplay out.wav
Input #0, wav, from 'out.wav':
Metadata:
encoder : Lavf58.45.100
Duration: 00:00:10.94, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
录制的文件格式
采样格式 : pcm_s16le
采样率 : 44100
声道数 : 2 channels,
比特率 : 1411 kb/s
集成到Win系统中
win10系统ffmpeg命令初体验
网友评论