176 Commits

Author SHA1 Message Date
sheenachhabra
a944ffecb9 Add support for adding capture FPS via transformer
PiperOrigin-RevId: 534814892
2023-05-24 16:11:27 +01:00
sheenachhabra
7c477589e5 Add support for updating Metadata entries via InAppMuxer
Mp4Muxer already supports writing Mp4LocationData so added that
as supported Metadata entry.
Support for more Metadata entries will be added in upcoming CLs.

PiperOrigin-RevId: 534473866
2023-05-24 16:02:48 +01:00
ibaker
b3db85133a Add android.namespace to all build.gradle files
This is a pre-requisite for the Android Studio upgrade assistant to
upgrade from AGP 7.2.2 to 8.0.1, otherwise it fails and complains
this is missing.

Issue: androidx/media#409
PiperOrigin-RevId: 533463246
2023-05-19 17:19:15 +01:00
sheenachhabra
b3fd202e11 Add test file with metadata track
Mp4Muxer supports adding Metadata track.
Added test file to cover this scenario.

PiperOrigin-RevId: 531496409
2023-05-15 10:36:17 +01:00
sheenachhabra
867355fdc5 Rollback of 925aa34e13
*** Original commit ***

Rollback of 65d5132f76

*** Original commit ***

Create InAppMuxer in transformer

To use the InAppMuxer, the client needs to pass InAppMuxer Factory.

***

***

PiperOrigin-RevId: 531470081
2023-05-12 13:20:31 +00:00
christosts
dae7abbfa6 End-to-end Robolectric playback test for audio capabilities
This change adds end-to-end Robolectric playback tests which handle
the scenario the player is playing audio via passthrough and
AudioTrack raises the ERROR_DEAD_OBJECT error upon which the player
attempts to recover by switching to another audio format.

PiperOrigin-RevId: 531180183
2023-05-12 10:06:47 +01:00
Googler
925aa34e13 Rollback of 65d5132f76
*** Original commit ***

Create InAppMuxer in transformer

To use the InAppMuxer, the client needs to pass InAppMuxer Factory.

***

PiperOrigin-RevId: 531056436
2023-05-11 10:03:35 +00:00
sheenachhabra
65d5132f76 Create InAppMuxer in transformer
To use the InAppMuxer, the client needs to pass InAppMuxer Factory.

PiperOrigin-RevId: 530684007
2023-05-11 09:56:46 +00:00
huangdarwin
2db2de5993 Transformer: Add codec support for Dolby Vision HDR video
Allow use of H265/H264 codecs for Dolby Vision video.

Also, reflow ExoPlayer code to use this new utility class

PiperOrigin-RevId: 530619388
2023-05-11 09:47:52 +00:00
michaelkatz
06ac2f7990 Add UTF-16 encoded subtitle support to SsaDecoder
Issue: androidx/media#319
PiperOrigin-RevId: 527891646
2023-05-03 17:04:35 +01:00
Ian Baker
fab134f0b3 Merge pull request #313 from pengbins:fix_ts_h265reader_parse_sps
PiperOrigin-RevId: 527259619
2023-04-26 15:53:58 +01:00
huangdarwin
324115f6cf Effects: Allow BT2020 colors with SDR transfers
Previously, I assumed that SDR contents must be BT709, and HDR contents must be
BT2020. Turns out BT2020 is just wide-gamut, and SDR contents / transfers may be
represented in BT2020 color spaces.

Relax the check, so that we don't throw when valid BT2020 SMPTE 170M contents
are input into effects.

PiperOrigin-RevId: 526668347
2023-04-26 15:41:33 +01:00
sheenachhabra
b11dd106ae Replace MediaFormat with Format class in muxer module
PiperOrigin-RevId: 526655859
2023-04-26 15:40:40 +01:00
peng bin
114020c2d8 Fix previousNumDeltaPocs in skipShortTermRefPicSets 2023-04-25 09:15:25 +01:00
Ian Baker
75d81c7630 Derive previousNumDeltaPocs from numNegativePics and numPositivePics
This more closely matches the equations in equations 7-61 and 7-62 in
See H.265/HEVC (2014) section 7.4.8.
2023-04-25 09:15:25 +01:00
peng bin
bc0dc01a69 Add a test sample for ts+h265 2023-04-25 09:15:25 +01:00
rohks
8a73d8d3fe Add support to fetch ColorInfo from avcC box in AtomParsers
#minor-release

PiperOrigin-RevId: 526082823
2023-04-24 11:37:55 +01:00
sheenachhabra
546b25bbc9 Set default value 0 for compressorname
PiperOrigin-RevId: 525734520
2023-04-24 11:24:48 +01:00
sheenachhabra
3b9ee1c1a1 Add NAL unit start code in csd0/csd1 test data
The actual csd data contains NAL units so it should always start with
a NAL unit start code (00 00 00 01).
This issue was not caught before because in the code there was no
validation to check whether its a valid NAL unit.

PiperOrigin-RevId: 524849867
2023-04-17 17:21:32 +01:00
huangdarwin
acdb7ee921 HDR: Add HDR pixel tests.
Implement HDR input support for texture output, and add HDR pixel tests.

PiperOrigin-RevId: 523417701
2023-04-12 16:51:51 +01:00
andrewlewis
d43fe3470f Fix audio encode timestamp off by one
Simplify the audio encoder input timestamp calculation. The new calculation
avoids drifting by tracking the total number of bytes encoded rather than
tracking the timestamp and remainder separately, and also makes the timestamps
match the decoder output buffer timestamps.

Also switch one of the export tests that was passing through AMR samples over
to using WAVE audio. The problem with using AMR is that the compressed samples
are not necessarily an integer number of audio frames and the shadow decoder
would pass them from input to output, so the audio encoder was receiving
non-integer numbers of audio frames.

Tested by logging the timestamps at the decoder output and encoder input with
forcing transcoding audio, and verifying that after this change the audio
timestamps are no longer off by one.

PiperOrigin-RevId: 523409869
2023-04-12 16:50:25 +01:00
sheenachhabra
b219be0fdd Remove edit box functionality from Mp4Muxer
PiperOrigin-RevId: 521731485
2023-04-05 15:44:04 +01:00
kimvde
0bfe43866a Add test for clipped media items concatenation
This was broken and has been fixed in <unknown commit>.

PiperOrigin-RevId: 521380415
2023-04-05 15:40:09 +01:00
sheenachhabra
bf2d311bf1 Remove adjustable ftyp functionality from Mp4Muxer
PiperOrigin-RevId: 520886975
2023-04-05 15:37:39 +01:00
ibaker
43ad45dbef Remove all RawCC references from media3
RawCC is a Google-internal subtitle format that is no longer directly
supported by this library (since 4f616d6003).

PiperOrigin-RevId: 520591591
2023-03-30 17:25:20 +00:00
sheenachhabra
df46748c6b Add unit test for "elst" box
PiperOrigin-RevId: 519727954
2023-03-30 17:12:52 +00:00
sheenachhabra
35f016f5c4 Add end to end test for edit box
PiperOrigin-RevId: 519184599
2023-03-30 17:10:07 +00:00
sheenachhabra
69cece1d82 Make getMp4LocationData method inline
PiperOrigin-RevId: 518827223
2023-03-30 17:04:46 +00:00
sheenachhabra
0747486e5a Remove helper method to create "hdlr" box for "meta" box
The "hdlr" box for "meta" box can be easily created by passing required parameters to Boxes.hdlr() method.

PiperOrigin-RevId: 518568103
2023-03-30 17:00:53 +00:00
sheenachhabra
e211889d70 Add Mp4 boxes test cases
PiperOrigin-RevId: 518531999
2023-03-30 16:57:33 +00:00
sheenachhabra
87cd90eb15 Fix TODO in Boxes.java
The fix is as per MP4 spec ISO/IEC 14496-12

PiperOrigin-RevId: 518240043
2023-03-21 14:22:08 +00:00
sheenachhabra
669008f437 Use FakeExtractorOutput in Mp4MuxerMetadataTest
The FakeExtractorOutput dumps data in more readable format
so using that where ever possible.

The MdtaMetadataEntry which contains key and value dumped only "key".
Added fix to dump "value" as well.

PiperOrigin-RevId: 517968996
2023-03-21 14:19:12 +00:00
sheenachhabra
ccdbd3b0a3 Add tkhd, mvhd and mdhd box test cases
PiperOrigin-RevId: 517933485
2023-03-21 14:17:47 +00:00
huangdarwin
e54c7a7c79 Test: Trim 4k60 test file to 300ms.
This was trimmed using the Transformer Demo, from ~4 seconds to 300ms

Otherwise, this test file will be quite large, and folks who clone the repo will
have to clone this content as well. Trimming the file also allows the test to
take less time, while still testing the core purpose of the file, to confirm that 4k extraction/decode/GL/encode/muxing works.

PiperOrigin-RevId: 517408463
2023-03-21 14:15:35 +00:00
huangdarwin
a6479c3d10 Test: Move 4k60 test file to local from remote.
This test file used to be remote, which led to various errors in loading the file or timing out during the muxer or overall transformer.

export4k60 test timing on Pixel 7:

|Condition                 |elapsedTimeMs|AS Test "Duration" (s)|
|--------------------------|-------------|----------------------|
|local file (this CL)      |4253         |14                    |
|Remote file, googleguest  |5510         |17                    |
|Remote file, 4G           |11423        |25                    |

PiperOrigin-RevId: 516815462
2023-03-16 15:31:56 +00:00
sheenachhabra
edfef0a879 Add test for Mp4Muxer robustness
With the Mp4Muxer, while writing a large file if the something unexpected happens and muxer is not closed properly then it still outputs a valid MP4 file with partial data.

PiperOrigin-RevId: 516572804
2023-03-16 15:31:03 +00:00
sheenachhabra
40dfe9f07d Add muxer end to end test for av1 video format
PiperOrigin-RevId: 516499906
2023-03-14 15:55:44 +00:00
sheenachhabra
7b8c562d7b Remove setLocation() method from Muxer interface
PiperOrigin-RevId: 516314175
2023-03-14 07:56:52 +00:00
sheenachhabra
7031d2c6f4 Remove sample_h265.mp4 test file
The h265 encoding is getting covered in HDR test case (hdr10-720p.mp4) so having a separate asset is redundant here.

PiperOrigin-RevId: 515347662
2023-03-14 07:49:28 +00:00
sheenachhabra
2f01f9c53b Add support for reading location data in MP4 extractor
The geodata is stored in the "udta" box as per MediaMuxer reference
https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/libstagefright/MPEG4Writer.cpp;drc=master;l=5588

PiperOrigin-RevId: 515095127
2023-03-14 07:46:28 +00:00
samrobinson
3264cb8271 Pass Metadata to Muxer when adding a track.
PiperOrigin-RevId: 514575400
2023-03-07 11:56:53 +00:00
kimvde
0f8b67b875 Make onOutputFormat nullable
- This is to make sure we know about all the tracks before initializing
the SamplePipelines. This allows to set the muxer and the fallback
listener track count before the SamplePipelines are built.
- As a result, the test files had to be updated because the order in
which the tracks are written has changed.
- The ImageAssetLoader also had to be updated to call onOutputFormat
repeatedly until it returns a non-null SampleConsumer.
- Also fix the trackCount sent to the muxer and fallback listener. The
correct track count can be computed now that we know about all the
tracks before building the SamplePipelines.

PiperOrigin-RevId: 514426123
2023-03-07 11:52:52 +00:00
sheenachhabra
a81a5f2699 Create orientation matrix byte array using util method
PiperOrigin-RevId: 514375835
2023-03-07 11:51:13 +00:00
sheenachhabra
f23d6c1dc1 Fix nit issues in muxer end to end tests
Renamed MuxerEndToEndTest.java to Mp4MuxerEndToEndTest.java to align it with class under test.
Removed muxed prefix from dump file name because Mp4 implicitely means muxed only.

PiperOrigin-RevId: 513574681
2023-03-07 11:44:26 +00:00
tofunmi
8ec1f86967 README.md line reflow.
PiperOrigin-RevId: 513289716
2023-03-02 13:23:30 +00:00
tofunmi
e425b6e082 Image frame processing color transfer fix
Used an actual captured image with set color profile for test to minimise the chance of the test flaking. Also renamed the media/bitmap/overlay folder to media/bitmap/input_images for clarity.

PiperOrigin-RevId: 513273353
2023-03-02 13:22:27 +00:00
sheenachhabra
9f51182bb8 Move Mp4MuxerMetadataTest into muxer module
Changes include:
1. Move the test fine into muxer module.
2. Use dump file infra for test cases.
3. Add one additional test for adding float metadata.
4. Few improvements in the code.

In next CL will remove Mp4 term from the file name as we are not using this term in test file names.

PiperOrigin-RevId: 513222506
2023-03-01 17:27:58 +00:00
sheenachhabra
36aa29809d Add Muxer end to end tests
Following test cases are added:
1. Mux H264 video
2. Mux H265 video
3. Mux HDR video

Each test case performs following actions:
1. Extract track and samples from input Mp4 using MediaExtractor.
2. Feed those samples into Mp4 muxer.
3. Use extractor to extract the samples from muxed file and create dump file.

PiperOrigin-RevId: 512589069
2023-02-27 18:50:56 +00:00
huangdarwin
cc1ca860b1 Test: Add format codec info and update HDR10 file to 720p.
Add format codec info, which can make test skipping checks more similar to the
actual Transformer decoder checks.

Also for the test file, the actual format was 720p, but somehow the file name and
media metadata indicated 1080p. This format mismatch led to some decoding errors,
so fix the format (and associated errors). This also allows us to remove the
exception catch in ForceInterpretHdrVideoAsSdrTest, which was included due to
errors from the incorrect format.

PiperOrigin-RevId: 511809507
2023-02-27 18:32:55 +00:00
kimvde
5c54a7dffb Add unit tests for audio track dis(appearing) during export
PiperOrigin-RevId: 511764841
2023-02-27 18:28:14 +00:00