@UnstableApi
public final class MuxerUtil


Utility methods for muxer.

Summary

Constants

static final long

The maximum value of a 32-bit unsigned int.

Public methods

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.

static BufferInfo

Returns BufferInfo corresponding to the MediaCodec.BufferInfo.

static boolean

Returns whether a given metadata 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.

Parameters
FileInputStream imageInputStream

A FileInputStream 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).

FileInputStream videoInputStream

A FileInputStream containing the video data. The caller is responsible for closing the stream once this method returns.

String videoContainerMimeType

The container mime type of the video. Must be VIDEO_MP4 or VIDEO_QUICK_TIME.

WritableByteChannel outputChannel

A WritableByteChannel to write output to. The caller is responsible for closing the channel once this method returns.

Throws
java.io.IOException

If an error occurs when creating the Motion Photo.

getMuxerBufferInfoFromMediaCodecBufferInfo

public static BufferInfo getMuxerBufferInfoFromMediaCodecBufferInfo(
    MediaCodec.BufferInfo mediaCodecBufferInfo
)

Returns BufferInfo corresponding to the MediaCodec.BufferInfo.

isMetadataSupported

public static boolean isMetadataSupported(Metadata.Entry metadata)

Returns whether a given metadata is supported.