# MuxerUtil

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/muxer/MuxerUtil "View this page in Java")

<br />

```
@UnstableApi
class MuxerUtil
```

<br />

*** ** * ** ***

Utility methods for muxer.

## Summary

|                                     ### Constants                                     |
|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | [UNSIGNED_INT_MAX_VALUE](https://developer.android.com/reference/kotlin/androidx/media3/muxer/MuxerUtil#UNSIGNED_INT_MAX_VALUE())` = 4294967295` The maximum value of a 32-bit unsigned int. |

|                                              ### Public functions                                              |
|----------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                    | [createMotionPhotoFromJpegImageAndBmffVideo](https://developer.android.com/reference/kotlin/androidx/media3/muxer/MuxerUtil#createMotionPhotoFromJpegImageAndBmffVideo(java.io.FileInputStream,long,java.io.FileInputStream,java.lang.String,java.nio.channels.WritableByteChannel))`(` ` imageInputStream: `[FileInputStream](https://developer.android.com/reference/java/io/FileInputStream.html)`!,` ` imagePresentationTimestampUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`,` ` videoInputStream: `[FileInputStream](https://developer.android.com/reference/java/io/FileInputStream.html)`!,` ` videoContainerMimeType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!,` ` outputChannel: `[WritableByteChannel](https://developer.android.com/reference/java/nio/channels/WritableByteChannel.html)`!` `)` 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). |
| `java-static `[BufferInfo](https://developer.android.com/reference/kotlin/androidx/media3/muxer/BufferInfo)`!` | [getMuxerBufferInfoFromMediaCodecBufferInfo](https://developer.android.com/reference/kotlin/androidx/media3/muxer/MuxerUtil#getMuxerBufferInfoFromMediaCodecBufferInfo(android.media.MediaCodec.BufferInfo))`(` ` mediaCodecBufferInfo: `[MediaCodec.BufferInfo](https://developer.android.com/reference/android/media/MediaCodec.BufferInfo.html)`!` `)` Returns[BufferInfo](https://developer.android.com/reference/kotlin/androidx/media3/muxer/BufferInfo)corresponding to the[MediaCodec.BufferInfo](https://developer.android.com/reference/android/media/MediaCodec.BufferInfo.html).                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)              | [isMetadataSupported](https://developer.android.com/reference/kotlin/androidx/media3/muxer/MuxerUtil#isMetadataSupported(androidx.media3.common.Metadata.Entry))`(metadata: `[Metadata.Entry](https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata.Entry)`!)` Returns whether a given[metadata](https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata.Entry)is supported.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

## Constants

### UNSIGNED_INT_MAX_VALUE

```
const val UNSIGNED_INT_MAX_VALUE = 4294967295: Long
```

The maximum value of a 32-bit unsigned int.  

## Public functions

### createMotionPhotoFromJpegImageAndBmffVideo

```
java-static fun createMotionPhotoFromJpegImageAndBmffVideo(
    imageInputStream: FileInputStream!,
    imagePresentationTimestampUs: Long,
    videoInputStream: FileInputStream!,
    videoContainerMimeType: String!,
    outputChannel: WritableByteChannel!
): Unit
```

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                                                           |
|-------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `imageInputStream: `[FileInputStream](https://developer.android.com/reference/java/io/FileInputStream.html)`!`                | A[FileInputStream](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.                                                                                  |
| `imagePresentationTimestampUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)                 | The presentation timestamp of the image in the video (in microseconds).                                                                                                                                                                                                        |
| `videoInputStream: `[FileInputStream](https://developer.android.com/reference/java/io/FileInputStream.html)`!`                | A[FileInputStream](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.                                                                                  |
| `videoContainerMimeType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`                | The container mime type of the video. Must be[VIDEO_MP4](https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#VIDEO_MP4())or[VIDEO_QUICK_TIME](https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#VIDEO_QUICK_TIME()). |
| `outputChannel: `[WritableByteChannel](https://developer.android.com/reference/java/nio/channels/WritableByteChannel.html)`!` | A[WritableByteChannel](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                                          |
|-----------------------------------------------------------------------------------------|----------------------------------------------------|
| [java.io.IOException](https://developer.android.com/reference/java/io/IOException.html) | If an error occurs when creating the Motion Photo. |

### getMuxerBufferInfoFromMediaCodecBufferInfo

```
java-static fun getMuxerBufferInfoFromMediaCodecBufferInfo(
    mediaCodecBufferInfo: MediaCodec.BufferInfo!
): BufferInfo!
```

Returns[BufferInfo](https://developer.android.com/reference/kotlin/androidx/media3/muxer/BufferInfo)corresponding to the[MediaCodec.BufferInfo](https://developer.android.com/reference/android/media/MediaCodec.BufferInfo.html).  

### isMetadataSupported

```
java-static fun isMetadataSupported(metadata: Metadata.Entry!): Boolean
```

Returns whether a given[metadata](https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata.Entry)is supported.