MasayukiSuda / Mp4Composer-android

This library generate an Mp4 movie using Android MediaCodec API and apply filter, scale, trim, transcode, crop, timeScale, mute and rotate Mp4.
MIT License
956 stars 219 forks source link

视频压缩后文件大小没有变化 #104

Open pz-bottle opened 3 years ago

pz-bottle commented 3 years ago

下面的是我的压缩代码 new Mp4Composer(videoPath, destPath) // .rotation(Rotation.ROTATION_90) // .size((width) 540, (height) 960) // .fillMode(FillMode.PRESERVE_ASPECT_FIT) // .filter(new GlFilterGroup(new GlMonochromeFilter(), new GlVignetteFilter())) // .trim((trimStartMs) 200, (trimEndMs) 5000) .listener(new Mp4Composer.Listener() { @Override public void onProgress(double progress) { Log.d(TAG, "onProgress = " + progress); }

                    @Override
                    public void onCurrentWrittenVideoTime(long timeUs) {

                    }

                    @Override
                    public void onCompleted() {
                        Log.d(TAG, "onCompleted()");
                        runOnUiThread(() -> {
                            ProDismiss();
                            File file = new File(destPath);
                            if(file!=null){
                                videoFile = file;
                                isComposerSuccess = true;
                            }
                        });
                    }

                    @Override
                    public void onCanceled() {
                        Log.d(TAG, "onCanceled");
                        runOnUiThread(() -> {
                            ProDismiss();
                            isComposerSuccess = false;
                        });
                    }

                    @Override
                    public void onFailed(Exception exception) {
                        Log.e(TAG, "onFailed()", exception);
                        runOnUiThread(() -> {
                            ProDismiss();
                            isComposerSuccess = false;
                        });
                    }
                }).start();

压缩前的大小为8.5M,压缩后的视频大小还是8.5M。。。就很纳闷