|  | @@ -9,6 +9,7 @@ import com.cooleshow.base.data.api.DownloadApi;
 | 
	
		
			
				|  |  |  import com.cooleshow.base.data.net.RetrofitClientNoToken;
 | 
	
		
			
				|  |  |  import com.cooleshow.base.data.net.RetrofitFactory;
 | 
	
		
			
				|  |  |  import com.cooleshow.base.utils.FileUtils;
 | 
	
		
			
				|  |  | +import com.cooleshow.base.utils.LogUtils;
 | 
	
		
			
				|  |  |  import com.cooleshow.base.utils.Utils;
 | 
	
		
			
				|  |  |  import com.cooleshow.ffmpegcmd.FFmpegCmd;
 | 
	
		
			
				|  |  |  import com.cooleshow.ffmpegcmd.util.FFmpegUtil;
 | 
	
	
		
			
				|  | @@ -43,7 +44,7 @@ public class AccompanyHelper {
 | 
	
		
			
				|  |  |      public static final String videoMp3Path = BASE_PATH + File.separator + "videoBgm.mp3";
 | 
	
		
			
				|  |  |      public static final String mergeMp3Path = BASE_PATH + File.separator + "merge.mp3";
 | 
	
		
			
				|  |  |      public static final String onlyVideoPath = BASE_PATH + File.separator + "onlyVideoPath.mp4";
 | 
	
		
			
				|  |  | -    public static final String resultPathPath = BASE_PATH + File.separator + "result.mp4";
 | 
	
		
			
				|  |  | +    public static String resultPathPath = BASE_PATH + File.separator + "result.mp4";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      private AccompanyHelper() {
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -64,7 +65,7 @@ public class AccompanyHelper {
 | 
	
		
			
				|  |  |          Observable.create(new ObservableOnSubscribe<String>() {
 | 
	
		
			
				|  |  |              @Override
 | 
	
		
			
				|  |  |              public void subscribe(@NonNull ObservableEmitter<String> emitter) throws Throwable {
 | 
	
		
			
				|  |  | -                FileUtils.delete(accompanimentMp3Path);
 | 
	
		
			
				|  |  | +                deleteAllTempFile();
 | 
	
		
			
				|  |  |                  FileUtils.createOrExistsFile(accompanimentMp3Path);
 | 
	
		
			
				|  |  |                  File file = new File(accompanimentMp3Path);
 | 
	
		
			
				|  |  |                  downloadAccompany(url, file);
 | 
	
	
		
			
				|  | @@ -136,7 +137,6 @@ public class AccompanyHelper {
 | 
	
		
			
				|  |  |          Observable.create(new ObservableOnSubscribe<String>() {
 | 
	
		
			
				|  |  |              @Override
 | 
	
		
			
				|  |  |              public void subscribe(@NonNull ObservableEmitter<String> emitter) throws Throwable {
 | 
	
		
			
				|  |  | -                deleteAllTempFile();
 | 
	
		
			
				|  |  |                  Log.i(TAG, "转换开始");
 | 
	
		
			
				|  |  |                  int getVideoMp3Result = getVideoMp3_2(videoPath, videoMp3Path);
 | 
	
		
			
				|  |  |                  Log.i(TAG, "getVideoMp3 complete:" + getVideoMp3Result);
 | 
	
	
		
			
				|  | @@ -148,6 +148,7 @@ public class AccompanyHelper {
 | 
	
		
			
				|  |  |                  int getOnlyVideoResult = getOnlyVideo(videoPath, onlyVideoPath);
 | 
	
		
			
				|  |  |                  Log.i(TAG, "extractVideo complete:" + getOnlyVideoResult);
 | 
	
		
			
				|  |  |                  //merge音频和视频
 | 
	
		
			
				|  |  | +                resultPathPath = getLastResultPath();
 | 
	
		
			
				|  |  |                  int mergeResult = megreMp3AndMp4(onlyVideoPath, mergeMp3Path, resultPathPath);
 | 
	
		
			
				|  |  |                  Log.i(TAG, "mergeMp4 complete:" + mergeResult);
 | 
	
		
			
				|  |  |                  Log.i(TAG, "转换完成");
 | 
	
	
		
			
				|  | @@ -191,11 +192,20 @@ public class AccompanyHelper {
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    private String getLastResultPath() {
 | 
	
		
			
				|  |  | +        String timeStamp = String.valueOf(System.currentTimeMillis());
 | 
	
		
			
				|  |  | +        String lastPath = BASE_PATH + File.separator + "VIDEO_RESULT_" + timeStamp + ".mp4";
 | 
	
		
			
				|  |  | +        LogUtils.i(TAG,"lastPath:"+lastPath);
 | 
	
		
			
				|  |  | +        return lastPath;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      private void deleteAllTempFile() {
 | 
	
		
			
				|  |  | -        FileUtils.delete(videoMp3Path);
 | 
	
		
			
				|  |  | -        FileUtils.delete(mergeMp3Path);
 | 
	
		
			
				|  |  | -        FileUtils.delete(onlyVideoPath);
 | 
	
		
			
				|  |  | -        FileUtils.delete(resultPathPath);
 | 
	
		
			
				|  |  | +        boolean b = FileUtils.deleteAllInDir(BASE_PATH);
 | 
	
		
			
				|  |  | +        LogUtils.i(TAG, "deleteAllTempFile:" + b);
 | 
	
		
			
				|  |  | +//        FileUtils.delete(videoMp3Path);
 | 
	
		
			
				|  |  | +//        FileUtils.delete(mergeMp3Path);
 | 
	
		
			
				|  |  | +//        FileUtils.delete(onlyVideoPath);
 | 
	
		
			
				|  |  | +//        FileUtils.delete(resultPathPath);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public int getVideoMp3_2(String videoPath, String outPath) {
 |