gpt4 book ai didi

ffmpeg - 如何使用FFmpeg android修剪带有seekbar的开始和结束位置的视频?

转载 作者:行者123 更新时间:2023-12-04 23:22:42 27 4
gpt4 key购买 nike

String[] cmd = new String[]{"-ss", startTrim + ".00", "-t", endTrim + ".00", "-noaccurate_seek", "-i", videoPath, "-codec", "复制", "-avoid_negative_ts", "1", outputAudioMux};

最佳答案

 private void trimVideo(ProgressDialog progressDialog) {

outputAudioMux = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath()
+ "/VidEffectsFilter" + "/" + new SimpleDateFormat("ddMMyyyy_HHmmss").format(new Date())
+ "filter_apply.mp4";

if (startTrim.equals("")) {
startTrim = "00:00:00";
}

if (endTrim.equals("")) {
endTrim = timeTrim(player.getDuration());
}

String[] cmd = new String[]{"-ss", startTrim + ".00", "-t", endTrim + ".00", "-noaccurate_seek", "-i", videoPath, "-codec", "copy", "-avoid_negative_ts", "1", outputAudioMux};


execFFmpegBinary1(cmd, progressDialog);
}





private void execFFmpegBinary1(final String[] command, ProgressDialog prpg) {

ProgressDialog progressDialog = prpg;

try {
ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
@Override
public void onFailure(String s) {
progressDialog.dismiss();
Toast.makeText(PlayerActivity.this, "Fail to generate video", Toast.LENGTH_SHORT).show();
Log.d(TAG, "FAILED with output : " + s);
}

@Override
public void onSuccess(String s) {
Log.d(TAG, "SUCCESS wgith output : " + s);


String finalPath = outputAudioMux;
videoPath = outputAudioMux;
Toast.makeText(PlayerActivity.this, "Storage Path =" + finalPath, Toast.LENGTH_SHORT).show();

Intent intent = new Intent(PlayerActivity.this, ShareVideoActivity.class);
intent.putExtra("pathGPU", finalPath);
startActivity(intent);
finish();
MediaScannerConnection.scanFile(PlayerActivity.this, new String[]{finalPath}, new String[]{"mp4"}, null);

}

@Override
public void onProgress(String s) {
Log.d(TAG, "Started gcommand : ffmpeg " + command);
progressDialog.setMessage("Please Wait video triming...");
}

@Override
public void onStart() {
Log.d(TAG, "Startedf command : ffmpeg " + command);

}

@Override
public void onFinish() {
Log.d(TAG, "Finished f command : ffmpeg " + command);
progressDialog.dismiss();
}
});
} catch (FFmpegCommandAlreadyRunningException e) {
// do nothing for now
}
}

关于ffmpeg - 如何使用FFmpeg android修剪带有seekbar的开始和结束位置的视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62165271/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com