视频水印:设置分辨率、码率提高画面质量

视频水印:设置分辨率、码率提高画面质量
pull/107/head
xufulong 5 years ago
parent 9868188b43
commit b08d782c99
  1. 4
      app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java
  2. 7
      app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java

@ -144,7 +144,9 @@ public class VideoHandleActivity extends BaseActivity {
//1、图片
String photo = PATH + File.separator + "launcher.png";
String photoMark = PATH + File.separator + "photoMark.mp4";
commandLine = FFmpegUtil.addWaterMark(srcFile, photo, photoMark);
String mResolution = "720x1280";
int bitRate = 1024;
commandLine = FFmpegUtil.addWaterMark(srcFile, photo, mResolution, bitRate, photoMark);
//2、文字
// String text = "Hello,FFmpeg";
// String textPath = PATH + File.separator + "text.jpg";

@ -162,9 +162,10 @@ public class FFmpegUtil {
* @param targetFile 目标文件
* @return 添加水印后的文件
*/
public static String[] addWaterMark(String srcFile, String waterMark, String targetFile){
String waterMarkCmd = "ffmpeg -i %s -i %s -filter_complex overlay=0:0 %s";
waterMarkCmd = String.format(waterMarkCmd, srcFile, waterMark, targetFile);
public static String[] addWaterMark(String srcFile, String waterMark, String resolution, int bitRate, String targetFile){
String mBitRate = String.valueOf(bitRate) + "k";
String waterMarkCmd = "ffmpeg -i %s -i %s -s %s -b:v %s -filter_complex overlay=0:0 %s";
waterMarkCmd = String.format(waterMarkCmd, srcFile, waterMark, resolution, mBitRate, targetFile);
return waterMarkCmd.split(" ");//以空格分割为字符串数组
}

Loading…
Cancel
Save