transform video with resolution

transform video with resolution
pull/112/head
xufulong 5 years ago
parent 6aa24ee520
commit c5149d2969
  1. 16
      app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java

@ -146,6 +146,22 @@ public class FFmpegUtil {
return transformVideoCmd.split(" ");
}
/**
* Using FFmpeg to transform video, include the resolution
*
* @param srcFile the source file
* @param width the width of video
* @param height the height of video
* @param targetFile target file
* @return file after transform
*/
public static String[] transformVideo(String srcFile, int width, int height, String targetFile) {
String scale = "-vf scale=" + width + ":" + height;
String transformVideoCmd = "ffmpeg -i %s -vcodec copy -acodec copy " + scale + " %s";
transformVideoCmd = String.format(transformVideoCmd, srcFile, targetFile);
return transformVideoCmd.split(" ");
}
/**
* 使用ffmpeg命令行进行视频剪切
*

Loading…
Cancel
Save