You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to to use media3 to compress video,and i tried to get compress Progress,
it play well on version1.1.1/1.2.1
but on version 1.3.1/1.4.1, the progress seems can't upto 60, when i get probably 60% the transform is complete, and the video compressed is normal. so i tried many video and many times. it reproduce everytime
this is my demo code to reproduce this bug
String localVideoPath = "/storage/emulated/0/Movies/CameraX-Video/2024-03-01-17-37-18-143.mp4";
String videoPath = getFilesDir().getAbsolutePath() + File.separator + "outPutVideo"+File.separator + "compressVideo.mp4";
try {
File file = new File(videoPath);
if(file.exists()){
file.delete();
}
if (file.getParent() != null && !new File(file.getParent()).exists()) {
new File(file.getParent()).mkdirs();
}
if (!file.exists()) {
file.createNewFile();
}
}catch (Exception e){}
MediaItem mediaItem = MediaItem.fromUri(localVideoPath);
ImmutableList<AudioProcessor> audioProcessors = ImmutableList.of();
ImmutableList.Builder<Effect> effectBuilder = new ImmutableList.Builder<>();
ScaleAndRotateTransformation scaleAndRotateTransformation = new ScaleAndRotateTransformation.Builder()
.setScale(0.5f,0.5f)
.build();
effectBuilder.add(scaleAndRotateTransformation);
//effectBuilder.add(Presentation.createForHeight(1080));
EditedMediaItem editedMediaItem = new EditedMediaItem.Builder(mediaItem).setEffects(new Effects(audioProcessors,effectBuilder.build())).build();
Transformer transformer = new Transformer.Builder(this)
.addListener(new Transformer.Listener() {
@Override
public void onCompleted(Composition composition, ExportResult exportResult) {
Transformer.Listener.super.onCompleted(composition, exportResult);
ThreadHelper.runOnUIThread(new Runnable() {
@Override
public void run() {
r.progressBar.setProgress(100);
}
});
}
@Override
public void onError(Composition composition, ExportResult exportResult, ExportException exportException) {
ThreadHelper.runOnUIThread(new Runnable() {
@Override
public void run() {
Log.d("test2",""+exportResult.exportException.getMessage());
}
});
}
}).build();
transformer.start(editedMediaItem,videoPath);
ProgressHolder progressHolder = new ProgressHolder();
mainHandler.post(
new Runnable() {
@OptIn(markerClass = UnstableApi.class) @Override
public void run() {
@Transformer.ProgressState int progressState = transformer.getProgress(progressHolder);
updateProgressInUi(progressState, progressHolder);
if (progressState != PROGRESS_STATE_NOT_STARTED) {
mainHandler.postDelayed(/* r= */ this, /* delayMillis= */ 33L);
}
}
});
Expected result
get progress correctly
Actual result
get progress not correct, seems can't up to 60%
Media
Not applicable
Bug Report
You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
The text was updated successfully, but these errors were encountered:
Version
Media3 1.4.1
More version details
it can Reproduce bug on version 1.3.1 and 1.4.1
Devices that reproduce the issue
OnePlus PGZ110 running android 14
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
I tried to to use media3 to compress video,and i tried to get compress Progress,
it play well on version1.1.1/1.2.1
but on version 1.3.1/1.4.1, the progress seems can't upto 60, when i get probably 60% the transform is complete, and the video compressed is normal. so i tried many video and many times. it reproduce everytime
this is my demo code to reproduce this bug
Expected result
get progress correctly
Actual result
get progress not correct, seems can't up to 60%
Media
Not applicable
Bug Report
adb bugreport
to [email protected] after filing this issue.The text was updated successfully, but these errors were encountered: