【问题标题】:Android Error: FFMPEG No such file or directory errorAndroid 错误:FFMPEG 没有这样的文件或目录错误
【发布时间】:2021-03-16 21:55:29
【问题描述】:

我在这里完成了解决方案。 Android FFMpeg No such file or directory error 但它对我不起作用。

该文件存在于该位置,但我仍然收到此错误。

这里是代码sn-p

  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 android ffmpeg


    【解决方案1】:

    想通了。图书馆没有问题。我指的是错误的路径。

    【讨论】:

      猜你喜欢
      • 2013-08-08
      • 1970-01-01
      • 1970-01-01
      • 2021-10-31
      • 1970-01-01
      • 2021-12-05
      • 2020-03-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多