
Sources (for example media projection) can populate the `Surface` from `SurfaceAssetLoader` with timestamps that don't start from zero. But `MuxerWrapper` assumes the latest sample timestamp can be used as the duration when it calculates average bitrate and notifies its listener. This can cause a crash because the calculated average bitrate can be zero if the denominator duration is large enough. Use the max minus first sample timestamp across tracks instead to get the duration. Side note: the large timestamps from the surface texture when using media projection arrive unchanged (apart from conversion from ns to us) in effect implementations and in the muxer wrapper (and are passed to the underlying muxer). The outputs of media3 muxer and the framework muxer are similar. PiperOrigin-RevId: 652422674
Transformer module
Provides functionality for transforming media files.
Getting the module
The easiest way to get the module is to add it as a gradle dependency:
implementation 'androidx.media3:media3-transformer:1.X.X'
where 1.X.X
is the version, which must match the version of the other media
modules being used.
Alternatively, you can clone this GitHub project and depend on the module locally. Instructions for doing this can be found in the top level README.