使用FFMPEG切割whatsapp共享视频

时间:2015-08-02 07:18:37

标签: android video ffmpeg whatsapp video-editing

我正在使用hiteshsondhi88/ffmpeg-android库来计时或剪切视频。我添加了以下依赖项。

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

它适用于大多数视频,但对于某些视频,它不适用于从whatssapp共享的视频。它给出了以下错误..我正在使用Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_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

0 个答案:

没有答案