gpt4 book ai didi

java - 安卓错误 : FFMPEG No such file or directory error

转载 作者:行者123 更新时间:2023-12-04 23:20:52 26 4
gpt4 key购买 nike

我在这里完成了解决方案。
Android FFMpeg No such file or directory error但这对我不起作用。
该文件存在于该位置,但我仍然收到此错误。
这是代码 fragment

  private void spliceSong(AudioObject audioObject) {
File folder = new File("/sdcard/roboscreen/TempAudio");
if (!folder.exists()) {
folder.mkdir();
}

String fileName = new File(audioObject.path).getName();
File dest = new File(folder, fileName);
Log.d(TAG, "Destination Filename is " + fileName);
if (!dest.exists()){
try {
dest.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}


String path = new File(audioObject.path).getPath();
Log.d(TAG, "File created " + dest.getAbsolutePath() + " " + audioObject.endDate + " " + audioObject.startDate);
String[] command = {"-ss", "2", "-i", "root/"+path, dest.toString()};

Log.d(TAG, "spliceSong: " + (this.context==null));
FFmpeg ffmpeg = FFmpeg.getInstance(this.context);
// // to execute "ffmpeg -version" command you just need to pass "-version"
try {
ffmpeg.loadBinary(new LoadBinaryResponseHandler(){
@Override
public void onSuccess() {
super.onSuccess();
Log.d(TAG, "onSuccess: bruhhhhh");
}
});
} catch (FFmpegNotSupportedException e) {
// Log.d(TAG, "Kaam Tamaam");
e.printStackTrace();
}

try {
ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {

@Override
public void onStart() {
Log.d(TAG, "Work Started done");
}

@Override
public void onProgress(String message) {
Log.d(TAG, "Doing some work");
}

@Override
public void onFailure(String message) {
Log.d(TAG, "Conversion failure " + message);
}

@Override
public void onSuccess(String message) {
Log.d(TAG, "Conversion Successful");
}

@Override
public void onFinish() {
Log.d(TAG, "Work Dome");
}

});
} catch (FFmpegCommandAlreadyRunningException e) {
Log.d(TAG, e.toString());
e.printStackTrace();
}
// Log.d(TAG, "spliced");

// return File
}

并且上下文来自不同的类
    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public ScreenRecorder(RoboTutor activity, Context context) throws Exception {
if (isInstantiated){
// raise Error and quit
throw new Exception("One instance already instantiated");
}
this.activity = activity;
this.context = context;
this.isInstantiated = true;
this.videoTimeStamp = new Date();
}


一个解决方案将不胜感激。
提前致谢。

最佳答案

弄清楚了。图书馆没有问题。我指的是错误的路径。

关于java - 安卓错误 : FFMPEG No such file or directory error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66655443/

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