XCVideoCompressor

by jczmdeveloper

jczmdeveloper / XCVideoCompressor

A Video compressor which use ffmpeg lib for Android App- Android 视频压缩器

127 Stars 44 Forks Last release: Not found 5 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

XCVideoCompressor

A Video compressor which uses ffmpeg lib for Android App- Android 视频压缩器

The Example for Use:

    String sdcardDir = Environment.getExternalStorageDirectory().getAbsolutePath();

String mInputStr = sdcardDir+"/DCIM/Camera/21s.mp4";
mStrResult = "Compress begin=========\n";
mResult.setText(mStrResult);
VideoCompressor.compress(this, mInputStr, new VideoCompressListener() {
    @Override
    public void onSuccess(final String outputFile, String filename, long duration) {
        Worker.postMain(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(mContext,"video compress success:"+outputFile,Toast.LENGTH_SHORT).show();
                SGLog.e("video compress success:"+outputFile);
                mStrResult +="Compress end=========onSuccess\n";
                mResult.setText(mStrResult);
                mScrollView.fullScroll(View.FOCUS_DOWN);

            }
        });
    }

    @Override
    public void onFail(final String reason) {
        Worker.postMain(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(mContext,"video compress failed:"+reason,Toast.LENGTH_SHORT).show();
                SGLog.e("video compress failed:"+reason);
                mStrResult+="Compress end=========onFail\n";
                mResult.setText(mStrResult);
                mScrollView.fullScroll(View.FOCUS_DOWN);
            }
        });
    }

    @Override
    public void onProgress(final int progress) {
        Worker.postMain(new Runnable() {
            @Override
            public void run() {
                SGLog.e("video compress progress:"+progress);
                mStrResult += "Compress progress:"+progress +"%\n";
                mResult.setText(mStrResult);
                mScrollView.fullScroll(View.FOCUS_DOWN);

            }
        });
    }
});

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.