androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.68k stars 399 forks source link

media3.transformer fails during video compression(TransformerListeners onError() recieved). #1672

Open Sach-24 opened 2 months ago

Sach-24 commented 2 months ago

Version

Media3 main branch

More version details

No response

Devices that reproduce the issue

The issue was seen in Somin XP9900

Devices that do not reproduce the issue

Tried in below devices and issue was not seen. Samsung S9 Samsung S10

Reproducible in the demo app?

Yes

Reproduction steps

  1. Select any video that has a higher bitrate per second. -Example: A video that is just 10 sec and is sized 60 MB.
  2. Compress the video via media3.Transformer and add Transformer.Listener. -Start compression transformer.start(editedMediaItem, destination);

Expected result

The video should be successfully compressed and onCompleted() of Transformer.Listener should be received.

Actual result

Here, onError() of Transformer.Listener is received and the file compression did not happen.

Refer below Adb logs.

Logs-1 08-27 12:15:38.228 E/QC2V4l2Codec( 965): [avcE_118] INIT : Failed to set default resolution on input port 08-27 12:15:38.228 E/QC2Comp ( 965): [avcE_118] failed to init codec ! 08-27 12:15:38.030 I/msm_vidc( 0): err : 00000003: ....e: H/W is overloaded. needed: 490440 max: 489600 08-27 12:15:38.030 I/msm_vidc( 0): err : ffffffff: .....: Running instances: 08-27 12:15:38.244 E/MediaCodec(11246): Codec reported err 0xfffffff4, actionCode 0, while in state 5/STARTING 08-27 12:15:38.257 D/DefaultCodec(11246): MediaCodec error 08-27 12:15:38.257 D/DefaultCodec(11246): android.media.MediaCodec$CodecException: start failed

Logs-2 08-20 12:31:51.164 8788 24258 W TransformerInternal: Export error after export ended 08-20 12:31:51.164 8788 24258 W TransformerInternal: obfuscated.y00: Video frame processing error 08-20 12:31:51.164 8788 24258 W TransformerInternal: Caused by: obfuscated.aj1: Release timed out. OpenGL resources may not be cleaned up properly.

Media

I'm not able to upload the media it says "This video is too big. with a file size less than 10MB." media will be sent via mail.

Bug Report

Sach-24 commented 2 months ago

Please check this below media where issue was observed. https://drive.google.com/file/d/13A4Fi8xyEp9eJtZnAWX61T_u3cWd-8dX/view

ychaparov commented 2 months ago

The numbers in the shared log H/W is overloaded. needed: 490440 max: 489600 are macroblocks per second.

489600 corresponds to 1920x1080 at 60 fps. I wonder why 490440 was needed: the test video you shared is 1920x1080 at 30 fps and should need fewer macroblocks per second from the encoder.

Did you apply any effects to the EdtiedMediaItem?

Was there another video app running on the phone at the same time, and does a restart resolve the issue?

Are these the correct specs for the XP9900 that failed to process the video https://www.sonimtech.com/products/devices/xp10/#specifications ? Is the chipset Qualcomm SM4350 Pro,2xA76@2.2GHz, 6xA55@1.9GHz (i.e. SM4350-AC)?

I was unable to reproduce this issue on a device with a similar (slightly under-clocked) SM4350 chipset -- and running Transformer on the video shared was also successful while I was recording a video with the camera app.

Sach-24 commented 2 months ago

Hi ychaparov

Did you apply any effects to the EdtiedMediaItem? No.

Was there another video app running on the phone at the same time, and does a restart resolve the issue? No video app was running in BG. but need to check if restarting can solve the issue.

Are these the correct specs for the XP9900 that failed to process the video Yes.This is the device

ychaparov commented 2 months ago

Can you please reproduce the issue, collect adb bugreport and send the resulting zip file to android-media-github@google.com as requested in the issue template above:

You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue

How is Transformer configured?

Are you using setRequestedVideoEncoderSettings?

Sach-24 commented 1 month ago

Hi

I have sent ADB logs via mail, Please check.

How is Transformer configured?

              MediaItem inputMediaItem = MediaItem.fromUri(source);
               EditedMediaItem editedMediaItem = new EditedMediaItem.Builder(inputMediaItem)
                       .setEffects(new Effects(ImmutableList.of(),
                        ImmutableList.of(Presentation.createForHeight(getHeightForCompression(source)))))
                        .build();

              Transformer transformer =
                new Transformer.Builder(DroidApiManager.getApplicationContext())
                        .addListener(transformerListener)
                        .build();

            transformer.start(editedMediaItem, destination);

Are you using [setRequestedVideoEncoderSettings] No.

ychaparov commented 1 month ago

You sent a text file, the output of adb logcat. We asked you to send a zip file, the output of adb bugreport.

The logs you sent ran on a different device from the original bug report: 08-20 12:25:05.220 8788 22841 I ExoPlayerImpl: Release 6fb219c [AndroidXMedia3/1.3.0] [xcoverpro2, SM-G736U, samsung, 34]

And a different Media3 version - 1.3.0 is not the main branch.

Did you send logs from August 20?

Can you reliably reproduce this issue or does it only happen rarely?

What is the height used in the code snippet above: getHeightForCompression(source)?

Sach-24 commented 1 month ago

Please wait while we send you the adb bug report. Thanks.

droid-girl commented 3 weeks ago

@Sach-24 did you send the bug report?

google-oss-bot commented 4 days ago

Hey @Sach-24. We need more information to resolve this issue but there hasn't been an update in 14 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!