# MuxerUtil

Artifact: [androidx.media3:media3-muxer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/muxer/MuxerUtil.java+class:androidx.media3.muxer.MuxerUtil)

*** ** * ** ***


```
@UnstableApi
public final class MuxerUtil
```

<br />

*** ** * ** ***

Utility methods for muxer.

## Summary

| ### Constants |
|---|---|
| `static final long` | `https://developer.android.com/reference/androidx/media3/muxer/MuxerUtil#UNSIGNED_INT_MAX_VALUE() = 4294967295` The maximum value of a 32-bit unsigned int. |

| ### Public methods |
|---|---|
| `static void` | `https://developer.android.com/reference/androidx/media3/muxer/MuxerUtil#createMotionPhotoFromJpegImageAndBmffVideo(java.io.FileInputStream,long,java.io.FileInputStream,java.lang.String,java.nio.channels.WritableByteChannel)( https://developer.android.com/reference/java/io/FileInputStream.html imageInputStream, long imagePresentationTimestampUs, https://developer.android.com/reference/java/io/FileInputStream.html videoInputStream, https://developer.android.com/reference/java/lang/String.html videoContainerMimeType, https://developer.android.com/reference/java/nio/channels/WritableByteChannel.html outputChannel )` Creates a Motion Photo from a JPEG image and a BMFF video as per the [Motion Photo spec](https://developer.android.com/media/platform/motion-photo-format). |
| `static https://developer.android.com/reference/androidx/media3/muxer/BufferInfo` | `https://developer.android.com/reference/androidx/media3/muxer/MuxerUtil#getMuxerBufferInfoFromMediaCodecBufferInfo(android.media.MediaCodec.BufferInfo)( https://developer.android.com/reference/android/media/MediaCodec.BufferInfo.html mediaCodecBufferInfo )` Returns `https://developer.android.com/reference/androidx/media3/muxer/BufferInfo` corresponding to the `https://developer.android.com/reference/android/media/MediaCodec.BufferInfo.html`. |
| `static boolean` | `https://developer.android.com/reference/androidx/media3/muxer/MuxerUtil#isMetadataSupported(androidx.media3.common.Metadata.Entry)(https://developer.android.com/reference/androidx/media3/common/Metadata.Entry metadata)` Returns whether a given `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` is supported. |

## Constants

### UNSIGNED_INT_MAX_VALUE

```
public static final long UNSIGNED_INT_MAX_VALUE = 4294967295
```

The maximum value of a 32-bit unsigned int.

## Public methods

### createMotionPhotoFromJpegImageAndBmffVideo

```
public static void createMotionPhotoFromJpegImageAndBmffVideo(
    FileInputStream imageInputStream,
    long imagePresentationTimestampUs,
    FileInputStream videoInputStream,
    String videoContainerMimeType,
    WritableByteChannel outputChannel
)
```

Creates a Motion Photo from a JPEG image and a BMFF video as per the [Motion Photo spec](https://developer.android.com/media/platform/motion-photo-format).

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/io/FileInputStream.html imageInputStream` | A `https://developer.android.com/reference/java/io/FileInputStream.html` containing the image data. The caller is responsible for closing the stream once this method returns. |
| `long imagePresentationTimestampUs` | The presentation timestamp of the image in the video (in microseconds). |
| `https://developer.android.com/reference/java/io/FileInputStream.html videoInputStream` | A `https://developer.android.com/reference/java/io/FileInputStream.html` containing the video data. The caller is responsible for closing the stream once this method returns. |
| `https://developer.android.com/reference/java/lang/String.html videoContainerMimeType` | The container mime type of the video. Must be `https://developer.android.com/reference/androidx/media3/common/MimeTypes#VIDEO_MP4()` or `https://developer.android.com/reference/androidx/media3/common/MimeTypes#VIDEO_QUICK_TIME()`. |
| `https://developer.android.com/reference/java/nio/channels/WritableByteChannel.html outputChannel` | A `https://developer.android.com/reference/java/nio/channels/WritableByteChannel.html` to write output to. The caller is responsible for closing the channel once this method returns. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an error occurs when creating the Motion Photo. |

### getMuxerBufferInfoFromMediaCodecBufferInfo

```
public static BufferInfo getMuxerBufferInfoFromMediaCodecBufferInfo(
    MediaCodec.BufferInfo mediaCodecBufferInfo
)
```

Returns `https://developer.android.com/reference/androidx/media3/muxer/BufferInfo` corresponding to the `https://developer.android.com/reference/android/media/MediaCodec.BufferInfo.html`.

### isMetadataSupported

```
public static boolean isMetadataSupported(Metadata.Entry metadata)
```

Returns whether a given `https://developer.android.com/reference/androidx/media3/common/Metadata.Entry` is supported.