iknow4 / 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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

需要精确裁剪的拿走不谢

gyymz1993 opened this issue · comments

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);
        }
    });