ffmpeg -i {输入文件路径} -vf{drawtext} {输出文件路径}
针对视频模糊,加上 -b:v {输出视频码率};右键属性,可查看离线视频源码率;
针对离线视频文件加上时间水印,时间跳变不正常,加上-re;
整体就是,ffmpeg -i {输入文件路径} -vf{drawtext } -c:a copy -b:v 3000K {输出文件路径},参考下方案列
public static void addTimestampWatermark(String inputPath, String outputPath) {
String[] cmd = {
"-re",
"-i", inputPath,
"-vf", "drawtext=fontfile=/storage/emulated/0/arial.ttf:text='%{localtime}':fontcolor=white:fontsize=24:x=10:y=10",
"-c:a", "copy",
"-b:v", " 3000K",
outputPath
};