ffmpeg的一些用法,不定期更新
1.宽度占一半,贴图
ffmpeg.exe -i .\7200.mp4 -i .\640.png -filter_complex "[1]scale=360:-2[a],[0][a]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -y out7200.mp4
2.FFmpeg drawtext添加文字和阴影样式
drawtext=fontcolor=white:fontsize=40:fontfile=msyh.ttf:text='Hello World':x=w*0.4:y=h*0.6:shadowx=5:shadowy=5:alpha=0.5
3.缩放图片保持长宽比,且防止libx264报比例不能被2整除的错误
[1]scale=640:-2[a]
原理如下:If one and only one of the values is -n with n >= 1, the scale filter will use a value that maintains the aspect ratio of the input image, calculated from the other specified dimension. After that it will, however, make sure that the calculated dimension is divisible by n and adjust the value if necessary —来自FFmpeg.org
4.H.264 profile
H.264有四种画质级别,分别是baseline, extended, main, high:
1、Baseline Profile:基本画质。支持I/P 帧,只支持无交错(Progressive)和CAVLC;
2、Extended profile:进阶画质。支持I/P/B/SP/SI 帧,只支持无交错(Progressive)和CAVLC;(用的少)
3、Main pro