media icon indicating copy to clipboard operation
media copied to clipboard

Add Dolby Vision Transcoding and Editing Support

Open ybai001 opened this issue 1 year ago • 13 comments

This code contribution adds Dolby Vision transcoding and editing support to transformer.

ybai001 avatar Apr 02 '24 05:04 ybai001

@ybai001 I just wanted to update that due to other high priority work, it might take a few weeks to review this change. I appreciate your patience.

SheenaChhabra avatar May 09 '24 11:05 SheenaChhabra

@ybai001 I just wanted to update that due to other high priority work, it might take a few weeks to review this change. I appreciate your patience.

Sure, understood.

ybai001 avatar May 09 '24 23:05 ybai001

We need to have some tests cases around these changes.

What can I do for this request? At least, I can provide test stream. If you mean I need to implement some test cases, could you guide me what kinds of test cases I should add. Previously, I added some DD+JOC and AC-4 test cases for my media3 contributions so that I am familiar with that process. But for transformer, this is my first contribution.

ybai001 avatar Jun 18 '24 05:06 ybai001

We need to have some tests cases around these changes.

What can I do for this request? At least, I can provide test stream. If you mean I need to implement some test cases, could you guide me what kinds of test cases I should add. Previously, I added some DD+JOC and AC-4 test cases for my media3 contributions so that I am familiar with that process. But for transformer, this is my first contribution.

We could include following tests:

  1. Transmuxing a dolby vision input file should preserve the dolby vision data. This could be a robolectric test. For this, you can refer tests in MediaItemExportTest.java
  2. Transcoding a normal H.264/H.265 to dolby vision. For this your can refer tests in TransformerEndToEndTest.java
  3. Editing a dolby vision input. For this your can refer tests in TransformerEndToEndTest.java

I would also suggest to run these scenario using Transformer demo app. This is to ensure that it works as expected.

SheenaChhabra avatar Jun 26 '24 15:06 SheenaChhabra

We need to have some tests cases around these changes.

What can I do for this request? At least, I can provide test stream. If you mean I need to implement some test cases, could you guide me what kinds of test cases I should add. Previously, I added some DD+JOC and AC-4 test cases for my media3 contributions so that I am familiar with that process. But for transformer, this is my first contribution.

We could include following tests:

  1. Transmuxing a dolby vision input file should preserve the dolby vision data. This could be a robolectric test. For this, you can refer tests in MediaItemExportTest.java
  2. Transcoding a normal H.264/H.265 to dolby vision. For this your can refer tests in TransformerEndToEndTest.java
  3. Editing a dolby vision input. For this your can refer tests in TransformerEndToEndTest.java

I would also suggest to run these scenario using Transformer demo app. This is to ensure that it works as expected.

Hi, @SheenaChhabra, Thanks for your suggestion. As far as the three tests you mentioned,

  1. I checked the file MediaItemExportTest.java and there are several test cases for transmux. But all of them are general test cases. None of them is for specific video format, e.g. AV1. Could you help to clarify why we need to add test case for Dolby Vision but not for other video format? And which test case I should refer to? Instead, I find there is a case in https://github.com/androidx/media/blob/main/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/HdrEditingTest.java#L79. Should I create a case for Dolby Vision here?
  2. I have added the case as you mentioned. I created it based on this one (for AV1) https://github.com/androidx/media/blob/main/libraries/transformer/src/androidTest/java/androidx/media3/transformer/TransformerEndToEndTest.java#L1517
  3. I checked the file TransformerEndToEndTest.java. But none of them is related to HDR editing. Instead, I find there is a Dolby Vision editing case in https://github.com/androidx/media/blob/main/libraries/transformer/src/androidTest/java/androidx/media3/transformer/mh/HdrEditingTest.java#L191. Is it enough for your requirement?

Finally, (1) I added export_transmuxDolbyVisionFile() in HdrEditingTest.java to match your requirement 1; (2) I added transcode_withOutputVideoMimeTypeDolbyVision_completesSuccessfully() in TransformerEndToEndTest.java to match your requirement 2; (3) I applied exist exportAndTranscode_dolbyVisionFile_whenHdrEditingIsSupported() and created exportAndTranscode_dolbyVisionFile_whenHdrEditingUnsupported_toneMapsOrThrows() in HdrEditingTest.java to match your requirement 3

If this solution is OK, I'll upload my code.

ybai001 avatar Jul 02 '24 02:07 ybai001

I have uploaded the test cases code.

ybai001 avatar Jul 03 '24 09:07 ybai001

@ychaparov Can you please help with another review of this PR?

SheenaChhabra avatar Aug 02 '24 18:08 SheenaChhabra

Looks good to me. @SheenaChhabra please approve when you think your comments have been resolved

ychaparov avatar Aug 05 '24 11:08 ychaparov

@SheenaChhabra, I have updated code as your comments except resolving conflicts. Let me know whether there is any other comment from your side.

ybai001 avatar Aug 06 '24 03:08 ybai001

Overall changes are good but some of the comments are still not resolved. Once the comments are resolved/answered and the conflicts are resolved, we can take this forward.

I have updated the code as you requested and resolved the conflicts. Let's me know whether there is any other issue.

ybai001 avatar Aug 08 '24 06:08 ybai001

After resolving the merge conflict, I find the code base is updated to the latest one and I have to update my test code to match the latest one. (Some definitions are changed totally, e.g. MP4_ASSET. I'll refine my code and upload it.

ybai001 avatar Aug 08 '24 06:08 ybai001

@SheenaChhabra, I updated code based on latest code on main branch. I think I resolved all the conflicts. Let me know whether you have more questions. Sorry for tons of commits and comments today.

ybai001 avatar Aug 08 '24 09:08 ybai001

Thanks for making this change. I'm going to send this for internal review now. You may see some more commits being added as I make changes in response to review feedback. Please refrain from pushing any more substantive changes as it will complicate the internal review - thanks!

Thanks. BTW, just want to let you know: Google can't push changes to this organization-owned forks because Dolby didn't grant you collaborator access. I have applied for it to our Dolby admin but she didn't agree with it. As result, you can merge this PR but it will result in an 'evil' merge. See details here: https://github.com/androidx/media/blob/release/CONTRIBUTING.md#push-access-to-pr-branches

ybai001 avatar Aug 12 '24 05:08 ybai001