◼ -i 设定输入流
◼ -f 设定输出格式(format)
◼ -ss 开始时间
◼ -t 时间长度
◼ -aframes 设置要输出的音频帧数
◼ -b:a 音频码率
◼ -ar 设定采样率
◼ -ac 设定声音的Channel数
◼ -acodec 设定声音编解码器,如果用copy表示原始编解码数据必须被拷贝。
◼ -an 不处理音频
◼ -af 音频过滤器
◼ -vframes 设置要输出的视频帧数
◼ -b 设定视频码率
◼ -b:v 视频码率
◼ -r 设定帧速率
◼ -s 设定画面的宽与高
◼ -vn 不处理视频
◼ -aspect aspect 设置横纵比 4:3 16:9 或 1.3333 1.7777
◼ -vcodec 设定视频编解码器,如果用copy表示原始编解码数据必须被拷贝。
◼ -vf 视频过滤器
D:\ffmpeg\test-av>ffmpeg -i test.mp4 -vframes 300 -b:v 300k -r 30 -s 640x480 -aspect 16:9 -vcodec libx264 out.h265
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181017
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:01:00.08, start: 0.000000, bitrate: 382 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240, 247 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0553e200] using SAR=4/3
[libx264 @ 0553e200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0553e200] profile High, level 3.0, 4:2:0, 8-bit
Output #0, hevc, to 'out.h265':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Stream #0:0(und): Video: h264 (libx264), yuv420p, 640x480 [SAR 4:3 DAR 16:9], q=-1--1, 300 kb/s, 30 fps, 30 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/300000 buffer size: 0 vbv_delay: -1
frame= 300 fps=0.0 q=-1.0 Lsize= 381kB time=00:00:09.93 bitrate= 314.5kbits/s dup=50 drop=0 speed=17.2x
video:381kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
[libx264 @ 0553e200] frame I:3 Avg QP:26.24 size: 12538
[libx264 @ 0553e200] frame P:92 Avg QP:27.14 size: 2826
[libx264 @ 0553e200] frame B:205 Avg QP:32.43 size: 453
[libx264 @ 0553e200] consecutive B-frames: 1.3% 14.7% 24.0% 60.0%
[libx264 @ 0553e200] mb I I16..4: 13.4% 81.4% 5.1%
[libx264 @ 0553e200] mb P I16..4: 0.9% 4.1% 0.3% P16..4: 43.1% 6.7% 2.3% 0.0% 0.0% skip:42.6%
[libx264 @ 0553e200] mb B I16..4: 0.0% 0.2% 0.0% B16..8: 23.3% 0.6% 0.1% direct: 0.3% skip:75.6% L0:43.8% L1:52.7% BI: 3.5%
[libx264 @ 0553e200] final ratefactor: 26.86
[libx264 @ 0553e200] 8x8 transform intra:79.6% inter:85.6%
[libx264 @ 0553e200] coded y,uvDC,uvAC intra: 62.5% 40.0% 5.8% inter: 5.0% 3.3% 0.0%
[libx264 @ 0553e200] i16 v,h,dc,p: 27% 29% 10% 34%
[libx264 @ 0553e200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 12% 14% 4% 5% 12% 4% 11% 5%
[libx264 @ 0553e200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 9% 12% 5% 6% 14% 4% 8% 3%
[libx264 @ 0553e200] i8c dc,h,v,p: 61% 14% 22% 3%
[libx264 @ 0553e200] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0553e200] ref P L0: 57.9% 18.1% 19.2% 4.7%
[libx264 @ 0553e200] ref B L0: 89.6% 9.1% 1.4%
[libx264 @ 0553e200] ref B L1: 97.3% 2.7%
[libx264 @ 0553e200] kb/s:312.42
2. ffmpeg -i test.mp4 -b:a 192k -ar 48000 -ac 2 -acodec libmp3lame -aframes 200 out.mp3
D:\ffmpeg\test-av>ffmpeg -i test.mp4 -b:a 192k -ar 48000 -ac 2 -acodec libmp3lame -aframes 200 out.mp3
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181017
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:01:00.08, start: 0.000000, bitrate: 382 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240, 247 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:1 -> #0:0 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to 'out.mp3':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
TSSE : Lavf58.20.100
Stream #0:0(und): Audio: mp3 (libmp3lame), 48000 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.35.100 libmp3lame
size= 113kB time=00:00:04.77 bitrate= 194.1kbits/s speed= 38x
video:0kB audio:112kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.628472%