Your company here, and a link to your site. Click to find out more.

MP4 - Man Page


The MP4 library provides an API to create and modify mp4 files as defined by ISO-IEC:14496-1:2001 MPEG-4 Systems. This file format is derived from Apple's QuickTime file format that has been used as a multimedia file format in a variety of platforms and applications. It is a very powerful and extensible format that can accomodate practically any type of media.

The basic structure of an mp4 file is that the file is a container for one or more tracks. These tracks contain one type of media, such as audio or video. Each track has its own timeline, samples, and properties. An example of a sample is a frame of video. The file describes how to synchronize the timelines of the tracks and the aggregate properties of the tracks.

The MP4 library is focussed on providing an easy to use API for the mp4 file format. It has been used with an encoder, a server, a player, and a number of mp4 utilities. However, it may not be adequate for multimedia editors that wish to work directly with mp4 files. It can be used by these type of tools to export an mp4 file. (The library is open source so contributions of extensions to the library are welcome.)

In providing a easy to use API not all the information in the mp4 file is directly exposed via the API. To accomodate applications that need access to information not otherwise available via the API there are file and track level generic get and set property routines that use arbitary string property names. To use these routines you will need to be familar with the mp4 file specification or be willing to wade thru the output of MP4Dump() to determine what you want. See MP4GetIntegerProperty() for more details.


The libary API is defined in <mp4.h> which includes all the necessary dependent include files.

The MP4 library can be used by either C or C++ programs. The calling convention is C, but if C++ is used then the default argument feature of that language can be used.

For example:
MP4Create("foo.mp4", 0, 0, 0); /* OK in C++ and C */
MP4Create("foo.mp4"); /* OK in C++, ERROR in C */


See mpeg4ip/lib/mp4v2/util and mpeg4ip/lib/mp4v2/test for simple example programs that use the MP4 library.

In particular:
Program that creates an empty mp4 file.

Simple program to print a text version of an mp4 file

Program to read each track and sample and place them in a separate file to ease inspection or recombination.

Program to broadcast the hinted tracks of an mp4 file using RTP.

Program that reads the video track but doesn't actually render the video.

For more complete applications that use the MP4 library see mpeg4ip/server/mp4creator, mpeg4ip/server/mp4live, and mpeg4ip/player/src.

Referenced By

MP4AddRtpESConfigurationPacket(3), MP4AddRtpHint(3), MP4AddRtpImmediateData(3), MP4AddRtpPacket(3), MP4AddRtpSampleData(3), MP4AddRtpVideoHint(3), MP4AddTrackEdit(3), MP4AppendHintTrackSdp(3), MP4AppendSessionSdp(3), MP4BinaryToBase16(3), MP4BinaryToBase64(3), MP4CloneTrack(3), MP4ConvertFromMovieDuration(3), MP4ConvertFromTrackTimestamp(3), MP4ConvertToTrackTimestamp(3), MP4CopyTrack(3), MP4DeleteTrack(3), MP4DeleteTrackEdit(3), MP4FindTrackId(3), MP4FindTrackIndex(3), MP4GetAudioProfileLevel(3), MP4GetDuration(3), MP4GetGraphicsProfileLevel(3), MP4GetHintTrackReferenceTrackId(3), MP4GetHintTrackRtpPayload(3), MP4GetHintTrackSdp(3), MP4GetNumberOfTracks(3), MP4GetODProfileLevel(3), MP4GetRtpHintNumberOfPackets(3), MP4GetRtpPacketBFrame(3), MP4GetRtpPacketTransmitOffset(3), MP4GetRtpTimestampStart(3), MP4GetSampleIdFromEditTime(3), MP4GetSceneProfileLevel(3), MP4GetSessionSdp(3), MP4GetTrackAudioMpeg4Type(3), MP4GetTrackAudioType(3), MP4GetTrackBitRate(3), MP4GetTrackDuration(3), MP4GetTrackEditDuration(3), MP4GetTrackEditDwell(3), MP4GetTrackEditMediaStart(3), MP4GetTrackEditStart(3), MP4GetTrackEditTotalDuration(3), MP4GetTrackESConfiguration(3), MP4GetTrackFixedSampleDuration(3), MP4GetTrackNumberOfEdits(3), MP4GetTrackNumberOfSamples(3), MP4GetTrackVideoFrameRate(3), MP4GetTrackVideoHeight(3), MP4GetTrackVideoType(3), MP4GetTrackVideoWidth(3), MP4GetVideoProfileLevel(3), MP4MakeIsmaCompliant(3), MP4ReadRtpHint(3), MP4ReadRtpPacket(3), MP4ReadSampleFromEditTime(3), MP4SetAudioProfileLevel(3), MP4SetGraphicsProfileLevel(3), MP4SetHintTrackRtpPayload(3), MP4SetHintTrackSdp(3), MP4SetODProfileLevel(3), MP4SetRtpTimestampStart(3), MP4SetSceneProfileLevel(3), MP4SetSessionSdp(3), MP4SetTrackEditDuration(3), MP4SetTrackEditDwell(3), MP4SetTrackEditMediaStart(3), MP4SetTrackESConfiguration(3), MP4SetVideoProfileLevel(3), MP4WriteRtpHint(3).

Version 0.9 Cisco Systems Inc. MP4 File Format Library