Android 使用FFMPEG剪切whatsapp共享视频

Android 使用FFMPEG剪切whatsapp共享视频,android,video,ffmpeg,whatsapp,video-editing,Android,Video,Ffmpeg,Whatsapp,Video Editing,我正在使用库来计时或剪切视频。我在下面添加了依赖项 compile 'com.github.hiteshsondhi88.libffmpeg:FFmpegAndroid:0.2.5' 我正在使用下面的命令 execFFmpegCommand("-i " + path + " -ss " + startMs / 1000 + " -to " + endMs / 1000 + " -strict -2 -async 1 " + dest.getAbsolutePath()); 剪切或修剪视频 p

我正在使用库来计时或剪切视频。我在下面添加了依赖项

compile 'com.github.hiteshsondhi88.libffmpeg:FFmpegAndroid:0.2.5'
我正在使用下面的命令

execFFmpegCommand("-i " + path + " -ss " + startMs / 1000 + " -to " + endMs / 1000 + " -strict -2 -async 1 " + dest.getAbsolutePath());
剪切或修剪视频

private void execFFmpegCommand(final String command) {
        try {
            ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
                @Override
                public void onFailure(String s) {
                    Log.e("Preview", "FAILED with output : " + s);
                }

                @Override
                public void onSuccess(String s) {
                    Log.e("Preview", "SUCCESS with output : " + s);
                }

                @Override
                public void onProgress(String s) {
                    Log.e("Preview", "Started command : ffmpeg " + command);
                    Log.e("Preview", "progress : " + s);
                }

                @Override
                public void onStart() {
                    Log.e("Preview", "Started command : ffmpeg " + command);

                }

                @Override
                public void onFinish() {
                    Log.e("Preview", "Finished command : ffmpeg " + command);



                }
            });
        } catch (FFmpegCommandAlreadyRunningException e) {
            // do nothing for now
        }
    }
它适用于大多数视频,但对于某些视频,它不适用于从WhatsApp共享的视频。它给出了以下错误。我使用
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY\u MOVIES)
存储视频

FAILED with output : WARNING: linker: files/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
    ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
    built on Oct  7 2014 15:11:41 with gcc 4.8 (GCC)
    configuration: --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/i686-linux-android- --arch=x86 --cpu=i686 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/x86 --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -march=i686' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
    libavutil      54.  7.100 / 54.  7.100
    libavcodec     56.  1.100 / 56.  1.100
    libavformat    56.  4.101 / 56.  4.101
    libavdevice    56.  0.100 / 56.  0.100
    libavfilter     5.  1.100 /  5.  1.100
    libswscale      3.  0.100 /  3.  0.100
    libswresample   1.  1.100 /  1.  1.100
    libpostproc    53.  0.100 / 53.  0.100
    /storage/emulated/0/1: No such file or directory

使用-I命令时,我遇到了完全相同的问题。@domji84请确保您的路径在文件名或文件夹中不包含任何空格,并且如果存在空格,请使用字符串格式化程序处理空格。我的路径是正确的,调用失败,因为我只是尝试使用-I获取视频信息,但如果没有输出文件,此标志将失败提供。使用-I命令时,我遇到了完全相同的问题。@domji84确保您的路径在文件名或文件夹中不包含任何空格,并且如果存在空格,请使用字符串格式化程序处理空格。我的路径正确,调用失败,因为我只是尝试使用-I获取视频信息,但如果没有输出文件,此标志将失败提供。