bravobit / FFmpeg-Android

FFMpeg/FFprobe compiled for Android
https://bravobit.nl/
MIT License
733 stars 172 forks source link

My exported music does not quality #145

Open mahdizareeii opened 4 years ago

mahdizareeii commented 4 years ago

Hello, my friend I mixing two music with this code,

//***

public void mix(Context context, String firstFile, String secondFile, String finalFile) {

    File finalAudio = new File(finalFile);
    String[] command = new String[]{
            "-i",
            firstFile,
            "-i",
            secondFile,
            "-shortest",
            "-filter_complex",
            "[0:a]volume=8.0[a0];[1:a]volume=1.0[a1];[a0][a1]amix=inputs=2:duration=shortest",
            finalAudio.getAbsolutePath()
    };

    FFmpeg fFmpeg = FFmpeg.getInstance(context);
    FFtask ffTask = fFmpeg.execute(command, new FFcommandExecuteResponseHandler() {
        @Override
        public void onSuccess(String message) {
            Toast.makeText(context, "success, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onProgress(String message) {
        }

        @Override
        public void onFailure(String message) {
            Toast.makeText(context, "failed", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onStart() {
            Toast.makeText(context, "mixing started", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onFinish() {
            Toast.makeText(context, "end", Toast.LENGTH_SHORT).show();
        }
    });
    ffTask.isProcessCompleted();
}

//*** and my first file and second file extensions are ''.m4a" and my final file extension is ".wav" but my exported music does not good quality

please help me thanks