build文件下引用VideoProcessor
implementation 'com.github.yellowcath:VideoProcessor:2.3.0'
写一个压缩视频的共用方法
public static void compressVideo2(Context context, String path, Handler.Callback callback) {
String compressPath = Constant.video_path + File.separator + "VID_" + System.currentTimeMillis() + ".mp4";
new Thread(() -> {
boolean success = true;
try {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(path);
int originWidth = Integer.parseInt(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
int originHeight =