-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Colours discrepancy when applying overlay #1509
Comments
Hi @mikekudzin, thanks for writing in. just to make sure I understand the setup, are you saying in (1) you used overlays and in (2) you didn't use overlays at all? Since you didn't see it in 1.3.1 I figure it could have some involvment to with the way we process color changing. Using the code in #1050 (comment) may help your case In addition I see there are some artefacts around the borders of your image. @ychaparov does any of the recent work you've done around improving sampling help with this? |
Not really, we haven't made improvements to resampling of 45-degree rotated videos yet. The original image bitmap overlay is not aligned with the no. 1 output -- the text is a bit scaled and rotated even though both images have resolution 1080x1920. @mikekudzin can you share your bitmap-reading code?
|
@tof-tof @ychaparov I have the same problem. The version is 1.4.0-beta01. The device I'm using is Samsung S21. I've tried the suggestion in the #1050 comment but it does not help. Here is the input and output resources:
![]()
![]()
![]() val stream = context.contentResolver.openInputStream(uri)
val bitmap = BitmapFactory.decodeStream(stream) |
you should probably set some bitmap factory options like this:
Here's how the MediaItem image BitmapFactory options will be set media/libraries/transformer/src/main/java/androidx/media3/transformer/DefaultAssetLoaderFactory.java Lines 82 to 86 in d833d59
|
@ychaparov just tried that and it stays the same as I mentioned above. |
@tof-tof Correct. @ychaparov here is bitmap initialisation code.
I also tried approach with the BitmapFactory
Still observe the issue . |
@yuriikonovalov and @mikekudzin how many |
@droid-girl In my case, it's 3 |
@droid-girl I use 3 |
@ychaparov figured out the problem, we will have a fix soon in main. The issue was with |
Build upon Transformer.videoFrameProcessorFactory in MultipleInputVideoGraph Check that Transformer.videoFrameProcessorFactory is DefaultVideoFrameProcessor for multi-input video Fixes #1509 PiperOrigin-RevId: 655232381
Could you please try verify if 7103f21 fixes the issue for your use cases? |
@ychaparov Just tried that, it's fixed for my case. Thanks. Just need to set SdrWorkingColorSpace. Otherwise colors will still be a little bit off but not like it was before.
With setting SdrWorkingColorSpace Without setting SdrWorkingColorSpace - here it's possible to see some difference |
Version
Media3 pre-release (alpha, beta or RC not in this list)
More version details
1.4.0-beta01
Devices that reproduce the issue
Pixel 4a Android 13
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
Overlaying video with a bitmap.
no. 1: Create transparent media items with a BitmapOverlay
Code:
Result:
no. 2: create MediaItem directly from the file
Code diff
val overlayFrameEMI = EditedMediaItem.Builder(MediaItem.fromUri(overlayFile.toUri()))
.setFrameRate(D_F_RATE)
.setDurationUs(D_DURATION)
.build()
Although, the the last one looks close to origin, there is a significant colours discrepancy between the origin no. 1 and no. 2
I didn't observe no. 1 issue on 1.3.1
Expected result
Colours in the output are the same as in the origin.
Actual result
There is a difference between colours in the origin and BitmapOverlay
Media
Bug Report
adb bugreport
to [email protected] after filing this issue.The text was updated successfully, but these errors were encountered: