Skip to content

Most visited

Recently visited


NdkMediaMuxer.h File Reference

NdkMediaMuxer.h File Reference


typedef struct AMediaMuxer AMediaMuxer




AMediaMuxerAMediaMuxer_new (int fd, OutputFormat format)
media_status_t AMediaMuxer_delete (AMediaMuxer *)
media_status_t AMediaMuxer_setLocation (AMediaMuxer *, float latitude, float longitude)
media_status_t AMediaMuxer_setOrientationHint (AMediaMuxer *, int degrees)
ssize_t AMediaMuxer_addTrack (AMediaMuxer *, const AMediaFormat *format)
media_status_t AMediaMuxer_start (AMediaMuxer *)
media_status_t AMediaMuxer_stop (AMediaMuxer *)
media_status_t AMediaMuxer_writeSampleData (AMediaMuxer *muxer, size_t trackIdx, const uint8_t *data, const AMediaCodecBufferInfo *info)

Typedef Documentation

◆ AMediaMuxer

typedef struct AMediaMuxer AMediaMuxer

Enumeration Type Documentation

◆ OutputFormat


Function Documentation

◆ AMediaMuxer_addTrack()

ssize_t AMediaMuxer_addTrack ( AMediaMuxer ,
const AMediaFormat format 

Adds a track with the specified format. Returns the index of the new track or a negative value in case of failure, which can be interpreted as a media_status_t.

◆ AMediaMuxer_delete()

media_status_t AMediaMuxer_delete ( AMediaMuxer )

Delete a previously created media muxer

◆ AMediaMuxer_new()

AMediaMuxer* AMediaMuxer_new ( int  fd,
OutputFormat  format 

Create new media muxer

◆ AMediaMuxer_setLocation()

media_status_t AMediaMuxer_setLocation ( AMediaMuxer ,
float  latitude,
float  longitude 

Set and store the geodata (latitude and longitude) in the output file. This method should be called before AMediaMuxer_start. The geodata is stored in udta box if the output format is AMEDIAMUXER_OUTPUT_FORMAT_MPEG_4, and is ignored for other output formats. The geodata is stored according to ISO-6709 standard.

Both values are specified in degrees. Latitude must be in the range [-90, 90]. Longitude must be in the range [-180, 180].

◆ AMediaMuxer_setOrientationHint()

media_status_t AMediaMuxer_setOrientationHint ( AMediaMuxer ,
int  degrees 

Sets the orientation hint for output video playback. This method should be called before AMediaMuxer_start. Calling this method will not rotate the video frame when muxer is generating the file, but add a composition matrix containing the rotation angle in the output video if the output format is AMEDIAMUXER_OUTPUT_FORMAT_MPEG_4, so that a video player can choose the proper orientation for playback. Note that some video players may choose to ignore the composition matrix during playback. The angle is specified in degrees, clockwise. The supported angles are 0, 90, 180, and 270 degrees.

◆ AMediaMuxer_start()

media_status_t AMediaMuxer_start ( AMediaMuxer )

Start the muxer. Should be called after AMediaMuxer_addTrack and before AMediaMuxer_writeSampleData.

◆ AMediaMuxer_stop()

media_status_t AMediaMuxer_stop ( AMediaMuxer )

Stops the muxer. Once the muxer stops, it can not be restarted.

◆ AMediaMuxer_writeSampleData()

media_status_t AMediaMuxer_writeSampleData ( AMediaMuxer muxer,
size_t  trackIdx,
const uint8_t *  data,
const AMediaCodecBufferInfo info 

Writes an encoded sample into the muxer. The application needs to make sure that the samples are written into the right tracks. Also, it needs to make sure the samples for each track are written in chronological order (e.g. in the order they are provided by the encoder.)

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)