iknow4x / Android-Video-Trimmer

The Android-Video-Trimmer project implements the selection of clips for long and short videos. It uses MediaMetadataRetriever to obtain video frames, and uses ffmpeg for video cropping and video compression.
Apache License 2.0
1.1k stars 264 forks source link

需要精确裁剪的拿走不谢 #24

Closed gyymz1993 closed 6 years ago

gyymz1993 commented 6 years ago

double startTime = (double)startMs / 10.0D / 10.0D / 10.0D; double induration = (double)(endMs - startMs) / 10.0D / 10.0D / 10.0D; String[] complexCommand = new String[]{"ffmpeg", "-ss", "" + startTime, "-y", "-i", inputFile, "-t", "" + induration, "-vcodec", "mpeg4", "-b:v", "2097152", "-b:a", "48000", "-ac", "2", "-ar", "22050", outputFile}; FFmpegCmd.exec(complexCommand, 0L, new OnEditorListener() { public void onSuccess() { callback.onFinishTrim(outputFile); }

        public void onFailure() {
            callback.onFailed();
        }

        public void onProgress(float progress) {
            Log.d(TrimVideoUtil.TAG, "FAILED with onProgress : " + progress);
        }
    });