ISOBMFF
ISO Base Media File Format Reference Software Documentation
 
Loading...
Searching...
No Matches
Movie related functions

Functions to operate with ISOMovie/MP4Movie objects. More...

Functions

ISOErr MJ2SetMovieMatrix (ISOMovie theMovie, u32 matrix[9])
 This sets the matrix of the overall movie.
 
ISOErr MJ2GetMovieMatrix (ISOMovie theMovie, u32 outMatrix[9])
 This returns the overall transformation matrix for the movie.
 
ISOErr MJ2SetMoviePreferredRate (ISOMovie theMovie, u32 rate)
 This sets the rate of the movie (the normal and default rate is 1.0).
 
ISOErr MJ2GetMoviePreferredRate (ISOMovie theMovie, u32 *outRate)
 This returns the currently set movie preferred rate.
 
ISOErr MJ2SetMoviePreferredVolume (ISOMovie theMovie, s16 volume)
 This sets the normal volume of the movie.
 
ISOErr MJ2GetMoviePreferredVolume (ISOMovie theMovie, s16 *outVolume)
 This returns the movie volume setting.
 
ISOErr MJ2NewMovie (ISOMovie *outMovie)
 Creates a new empty Motion JPEG 2000 Movie in memory.
 
ISOErr New3GPPMovie (ISOMovie *outMovie, u16 release)
 Creates a new empty 3GPP Movie in memory, and sets the brand to the indicated release (4, 5 or 6).
 
ISOErr ISOWriteMovieToFile (ISOMovie theMovie, const char *filename)
 Writes the in-memory Movie to a file.
 
ISOErr ISOSetMovieBrand (ISOMovie theMovie, u32 brand, u32 minorversion)
 Sets the Movie’s major brand.
 
ISOErr ISOSetMovieCompatibleBrand (ISOMovie theMovie, u32 brand)
 Adds a minor brand into the compatible brands list of the Movie.
 
ISOErr ISOGetMovieBrand (ISOMovie theMovie, u32 *brand, u32 *minorversion)
 Returns the Movie’s major brand and minor version.
 
ISOErr ISOIsMovieCompatibleBrand (ISOMovie theMovie, u32 brand)
 If the brand is a compatible brand of the movie, this returns MP4NoErr, otherwise it returns MP4NotFoundErr.
 
MP4Err MP4DisposeMovie (MP4Movie theMovie)
 This function releases any resources owned by the Movie.
 
MP4Err MP4GetMovieDuration (MP4Movie theMovie, u64 *outDuration)
 This calculates and returns the movie duration as recorded in the movie header.
 
MP4Err MP4GetMovieInitialObjectDescriptor (MP4Movie theMovie, MP4Handle outDescriptorH)
 Retrieves the initial object descriptor from a Movie and places it into a Handle.
 
MP4Err MP4GetMovieInitialObjectDescriptorUsingSLConfig (MP4Movie theMovie, MP4SLConfig slconfig, MP4Handle outDescriptorH)
 Retrieves the initial object descriptor from a Movie.
 
MP4Err MP4GetMovieIODInlineProfileFlag (MP4Movie theMovie, u8 *outFlag)
 Queries the setting of includeInlineProfileLevelFlag from the movie's initial object descriptor.
 
MP4Err MP4GetMovieProfilesAndLevels (MP4Movie theMovie, u8 *outOD, u8 *outScene, u8 *outAudio, u8 *outVisual, u8 *outGraphics)
 Use this to obtain the profiles and levels from a Movie's initial object descriptor.
 
MP4Err MP4GetMovieTimeScale (MP4Movie theMovie, u32 *outTimeScale)
 Use this to obtain the time scale of a Movie.
 
MP4Err MP4GetMovieTrack (MP4Movie theMovie, u32 trackID, MP4Track *outTrack)
 Use this to obtain a track given its track ID.
 
MP4Err MP4AddAtomToMovie (MP4Movie theMovie, MP4GenericAtom the_atom)
 Adds the given atom to the movie.
 
MP4Err MP4NewMovie (MP4Movie *outMovie, u32 initialODID, u8 OD_profileAndLevel, u8 scene_profileAndLevel, u8 audio_profileAndLevel, u8 visual_profileAndLevel, u8 graphics_profileAndLevel)
 Creates a new empty Movie in memory.
 
MP4Err MP4NewMovieFromHandle (MP4Movie *outMovie, MP4Handle movieH, u32 newMovieFlags)
 Parses a movie ‘file’ in the handle and creates a Movie in memory from this file.
 
MP4Err NewMPEG21 (MP4Movie *outMovie)
 Creates a new empty MPEG-21 ‘movie’ in memory.
 
MP4Err ISONewMetaMovie (MP4Movie *outMovie, u32 handlertype, u32 brand, u32 minorversion)
 Like NewMPEG21() but allows you to specify the meta handlertype, and the major brand and minor version of that brand.
 
MP4Err MP4SetMovieIODInlineProfileFlag (MP4Movie theMovie, u8 theFlag)
 Indicates that the given track is to be considered as the initial BIFS track.
 
MP4Err MP4SetMovieTimeScale (MP4Movie theMovie, u32 timeScale)
 Sets the Movie’s time scale.
 
MP4Err MP4OpenMovieFile (MP4Movie *theMovie, const char *movieURL, int openMovieFlags)
 Opens a movie file and creates a Movie in memory from this file.
 
MP4Err MP4PutMovieIntoHandle (MP4Movie theMovie, MP4Handle movieH)
 Places the movie and its media samples into a handle.
 
MP4Err MP4WriteMovieToFile (MP4Movie theMovie, const char *filename)
 See ISOWriteMovieToFile()
 
MP4Err ISOStartMovieFragment (MP4Movie theMovie)
 This starts a new movie fragment.
 
MP4Err ISOAddDelayToTrackFragmentDecodeTime (MP4Movie theMovie, u32 delay)
 Add delay to track fragment decode time.
 
MP4Err ISOSetCompositonToDecodePropertiesForFragments (MP4Movie theMovie, u32 trackID, s32 compositionToDTSShift, s32 leastDecodeToDisplayDelta, s32 greatestDecodeToDisplayDelta, s32 compositionStartTime, s32 compositionEndTime)
 Sets the compositon to decode parameters for a specific track.
 

Detailed Description

Functions to operate with ISOMovie/MP4Movie objects.

Function Documentation

◆ ISOAddDelayToTrackFragmentDecodeTime()

MP4Err ISOAddDelayToTrackFragmentDecodeTime ( MP4Movie  theMovie,
u32  delay 
)

Add delay to track fragment decode time.

Setting the delay parameter to other than zero, a delay will be introduced, which will add a time offset to the track fragment decode time.

Note
Must be called right after ISOStartMovieFragment().
Parameters
theMovieinput movie object
delaydelay value
Returns
MP4Err error code

◆ ISOGetMovieBrand()

ISOErr ISOGetMovieBrand ( ISOMovie  theMovie,
u32 *  brand,
u32 *  minorversion 
)

Returns the Movie’s major brand and minor version.

Parameters
theMovieinput movie object
brandoutput brand
minorversionoutput minor version
Returns
ISOErr error code

◆ ISOIsMovieCompatibleBrand()

ISOErr ISOIsMovieCompatibleBrand ( ISOMovie  theMovie,
u32  brand 
)

If the brand is a compatible brand of the movie, this returns MP4NoErr, otherwise it returns MP4NotFoundErr.

Parameters
theMovieinput movie object
brandbrand value to check
Returns
ISOErr error code

◆ ISONewMetaMovie()

MP4Err ISONewMetaMovie ( MP4Movie outMovie,
u32  handlertype,
u32  brand,
u32  minorversion 
)

Like NewMPEG21() but allows you to specify the meta handlertype, and the major brand and minor version of that brand.

Parameters
outMovieoutput movie object
handlertypeHandler type
brandBrand
minorversionMinor version
Returns
MP4Err error code

◆ ISOSetCompositonToDecodePropertiesForFragments()

MP4Err ISOSetCompositonToDecodePropertiesForFragments ( MP4Movie  theMovie,
u32  trackID,
s32  compositionToDTSShift,
s32  leastDecodeToDisplayDelta,
s32  greatestDecodeToDisplayDelta,
s32  compositionStartTime,
s32  compositionEndTime 
)

Sets the compositon to decode parameters for a specific track.

They have to be calculated and added before calling the first ISOStartMovieFragment() and cannot be changed later.

Note
Must be called before the first ISOStartMovieFragment().
Parameters
theMovieinput movie object
trackIDinput track ID
compositionToDTSShiftcomposition to decoding time shift
leastDecodeToDisplayDeltaleast decode to display delta
greatestDecodeToDisplayDeltagreatest decode to display delta
compositionStartTimecomposition start time
compositionEndTimecomposition end time
Returns
MP4Err error code

◆ ISOSetMovieBrand()

ISOErr ISOSetMovieBrand ( ISOMovie  theMovie,
u32  brand,
u32  minorversion 
)

Sets the Movie’s major brand.

Also inserts the major brand into the compatible brands list. This function is not normally needed; the brand is set by the appropriate movie-creation function.

Parameters
theMovieinput movie object
brandbrand value to set
minorversionminor version
Returns
ISOErr error code

◆ ISOSetMovieCompatibleBrand()

ISOErr ISOSetMovieCompatibleBrand ( ISOMovie  theMovie,
u32  brand 
)

Adds a minor brand into the compatible brands list of the Movie.

The following brands have defined constants in the headers, though of course you may use MP4_FOUR_CHAR_CODE() also.

Brand Description
JP2JPEG2000Brand brand for JPEG-2000
MJ2JPEG2000Brand brand for Motion JPEG-2000
ISOQuickTimeBrand brand for QuickTime
ISOMpeg4V1Brand brand for MPEG-4 version 1
ISOMpeg4V2Brand brand for MPEG-4 version 2
ISOISOBrand conforming brand for all files
ISOISO2Brand conforming brand for all files
ISO3GP4Brand 3GPP Release 4
ISO3GP5Brand 3GPP Release 5
ISO3GP6Brand 3GPP Release 6
ISOMPEG21Brand MPEG-21
Parameters
theMovieinput movie object
brandbrand value to set
Returns
ISOErr error code

◆ ISOStartMovieFragment()

MP4Err ISOStartMovieFragment ( MP4Movie  theMovie)

This starts a new movie fragment.

Before calling this, you should create a normal movie, up to the point you would write it to the file, and you should set the track fragment defaults on the tracks to which you want to add samples. After calling this, you should only add samples, and write the file out. Each call to this function starts a new fragment. For example, you might call this function after ISOEndMediaEdits, and then insert some more samples into the track(s).

Parameters
theMovieinput movie object
Returns
MP4Err error code

◆ ISOWriteMovieToFile()

ISOErr ISOWriteMovieToFile ( ISOMovie  theMovie,
const char *  filename 
)

Writes the in-memory Movie to a file.

The file given by filename is created, written, and closed.

Parameters
theMovieinput movie object
filenamefile name
Returns
ISOErr error code

◆ MJ2GetMovieMatrix()

ISOErr MJ2GetMovieMatrix ( ISOMovie  theMovie,
u32  outMatrix[9] 
)

This returns the overall transformation matrix for the movie.

Parameters
theMovieinput movie object
matrixoutput matrix
Returns
ISOErr error code

◆ MJ2GetMoviePreferredRate()

ISOErr MJ2GetMoviePreferredRate ( ISOMovie  theMovie,
u32 *  outRate 
)

This returns the currently set movie preferred rate.

Parameters
theMovieinput movie object
outRateoutput preferred rate
Returns
ISOErr error code

◆ MJ2GetMoviePreferredVolume()

ISOErr MJ2GetMoviePreferredVolume ( ISOMovie  theMovie,
s16 *  outVolume 
)

This returns the movie volume setting.

Parameters
theMovieinput movie object
outVolumeoutput volume
Returns
ISOErr error code

◆ MJ2NewMovie()

ISOErr MJ2NewMovie ( ISOMovie *  outMovie)

Creates a new empty Motion JPEG 2000 Movie in memory.

Parameters
outMovieoutput movie object
Returns
ISOErr error code

◆ MJ2SetMovieMatrix()

ISOErr MJ2SetMovieMatrix ( ISOMovie  theMovie,
u32  matrix[9] 
)

This sets the matrix of the overall movie.

The default matrix is the unity matrix, if none has been set.

Parameters
theMovieinput movie object
matrixinput matrix
Returns
ISOErr error code

◆ MJ2SetMoviePreferredRate()

ISOErr MJ2SetMoviePreferredRate ( ISOMovie  theMovie,
u32  rate 
)

This sets the rate of the movie (the normal and default rate is 1.0).

Parameters
theMovieinput movie object
rateinput rate represented as a 16.16 fixed-point number
Returns
ISOErr error code

◆ MJ2SetMoviePreferredVolume()

ISOErr MJ2SetMoviePreferredVolume ( ISOMovie  theMovie,
s16  volume 
)

This sets the normal volume of the movie.

Parameters
theMovieinput movie object
volumeinput volume value. The normal, default, value is 1.0. The volume is expressed as an 8.8 fixed-point number.
Returns
ISOErr error code

◆ MP4AddAtomToMovie()

MP4Err MP4AddAtomToMovie ( MP4Movie  theMovie,
MP4GenericAtom  the_atom 
)

Adds the given atom to the movie.

See also
MP4NewForeignAtom, MP4NewUUIDAtom
Parameters
theMovieinput movie object
the_atomnew atom to add to the movie object

◆ MP4DisposeMovie()

MP4Err MP4DisposeMovie ( MP4Movie  theMovie)

This function releases any resources owned by the Movie.

Note
You should not make any further reference to the Movie after calling this.
Parameters
theMovieMovie object to kill
Returns
MP4Err error code

◆ MP4GetMovieDuration()

MP4Err MP4GetMovieDuration ( MP4Movie  theMovie,
u64 *  outDuration 
)

This calculates and returns the movie duration as recorded in the movie header.

It is the maximum track duration, expressed in units of the movie’s timescale. Get the timescale using the MP4GetMovieTimeScale().

Parameters
theMovieinput movie object
outDurationoutput duration in movie's timescale.
Returns
MP4Err error code

◆ MP4GetMovieInitialObjectDescriptor()

MP4Err MP4GetMovieInitialObjectDescriptor ( MP4Movie  theMovie,
MP4Handle  outDescriptorH 
)

Retrieves the initial object descriptor from a Movie and places it into a Handle.

Parameters
theMovieinput movie object
outDescriptorHoutput handle with the data
Returns
MP4Err error code

◆ MP4GetMovieInitialObjectDescriptorUsingSLConfig()

MP4Err MP4GetMovieInitialObjectDescriptorUsingSLConfig ( MP4Movie  theMovie,
MP4SLConfig  slconfig,
MP4Handle  outDescriptorH 
)

Retrieves the initial object descriptor from a Movie.

Similar to MP4GetMovieInitialObjectDescriptor() but with additional MP4SLConfig parameter.

Parameters
theMovieinput movie object
slconfiginput MP4SLConfig configuration object
outDescriptorHoutput handle with the data
Returns
MP4Err error code

◆ MP4GetMovieIODInlineProfileFlag()

MP4Err MP4GetMovieIODInlineProfileFlag ( MP4Movie  theMovie,
u8 *  outFlag 
)

Queries the setting of includeInlineProfileLevelFlag from the movie's initial object descriptor.

Parameters
theMovieinput movie object
outFlagoutput flags
Returns
MP4Err error code

◆ MP4GetMovieProfilesAndLevels()

MP4Err MP4GetMovieProfilesAndLevels ( MP4Movie  theMovie,
u8 *  outOD,
u8 *  outScene,
u8 *  outAudio,
u8 *  outVisual,
u8 *  outGraphics 
)

Use this to obtain the profiles and levels from a Movie's initial object descriptor.

You may pass in null for parameters that don't care to read.

Note
This call will return an error if the movie does not contain an initial object descriptor
Parameters
theMovieinput movie object
outODoutput object descriptor profile and level
outSceneoutput scene profile and level
outAudiooutput audio profile and level
outVisualoutput visual profile and level
outGraphicsoutput graphics profile and level
Returns
MP4Err error code

◆ MP4GetMovieTimeScale()

MP4Err MP4GetMovieTimeScale ( MP4Movie  theMovie,
u32 *  outTimeScale 
)

Use this to obtain the time scale of a Movie.

Parameters
theMovieinput movie object
outTimeScaleoutput value for timescale
Returns
MP4Err error code

◆ MP4GetMovieTrack()

MP4Err MP4GetMovieTrack ( MP4Movie  theMovie,
u32  trackID,
MP4Track outTrack 
)

Use this to obtain a track given its track ID.

Parameters
theMovieinput movie object
trackIDtrack ID
outTrackoutput track object
Returns
MP4Err error code

◆ MP4NewMovie()

MP4Err MP4NewMovie ( MP4Movie outMovie,
u32  initialODID,
u8  OD_profileAndLevel,
u8  scene_profileAndLevel,
u8  audio_profileAndLevel,
u8  visual_profileAndLevel,
u8  graphics_profileAndLevel 
)

Creates a new empty Movie in memory.

You may assign an initial object descriptor ID and profile and level indications that describe the presentation you are making. The profile and level definitions are detailed in the MPEG-4 Systems specification.

If you provide zero as the initialODID, then no object descriptor is created. Such files can be used as the target of an ES URL, or standalone. Similarly if you provide zero for all the profiles, then the IOD atom will contain an object descriptor, not an initial object descriptor; these files can also be useful on occasion.

Attention
Do not attempt to add tracks to the object descriptor if you have asked that one not be created.
Parameters
outMovieoutput movie object
initialODIDinitial object descriptor. If 0, then no object descriptor is created.
OD_profileAndLevelObject descriptor profile and level
scene_profileAndLevelscene profile and level
audio_profileAndLevelaudio profile and level
visual_profileAndLevelvisual profile and level
graphics_profileAndLevelgraphics profile and level
Returns
MP4Err error code

◆ MP4NewMovieFromHandle()

MP4Err MP4NewMovieFromHandle ( MP4Movie outMovie,
MP4Handle  movieH,
u32  newMovieFlags 
)

Parses a movie ‘file’ in the handle and creates a Movie in memory from this file.

Parameters
outMovieoutput movie object
movieHinput movie handle
newMovieFlagsis ordinarily set to MP4OpenMovieNormal, but if you set it to MP4OpenMovieDebug a parse tree will be printed to standard output while the movie is parsed
Returns
MP4Err error code

◆ MP4OpenMovieFile()

MP4Err MP4OpenMovieFile ( MP4Movie theMovie,
const char *  movieURL,
int  openMovieFlags 
)

Opens a movie file and creates a Movie in memory from this file.

Parameters
theMovieoutput movie object
movieURLpathname or a file URL.
openMovieFlagsis ordinarily set to MP4OpenMovieNormal, but if you set it to MP4OpenMovieDebug a parse tree will be printed to standard output while the movie is parsed
Returns
MP4Err error code

◆ MP4PutMovieIntoHandle()

MP4Err MP4PutMovieIntoHandle ( MP4Movie  theMovie,
MP4Handle  movieH 
)

Places the movie and its media samples into a handle.

Parameters
theMovieinput movie object
movieHoutput handle with the data from theMovie
Returns
MP4Err error code

◆ MP4SetMovieIODInlineProfileFlag()

MP4Err MP4SetMovieIODInlineProfileFlag ( MP4Movie  theMovie,
u8  theFlag 
)

Indicates that the given track is to be considered as the initial BIFS track.

This information is placed into the Movie's initial object descriptor.

Parameters
theMovie
theBIFSTrack
Returns
MP4Err error code

Indicates that the given track is to be considered as the initial Object Descriptor stream track.

This information is placed into the Movie's initial object descriptor.

Parameters
theMovie
theODTrack
Returns
MP4Err error code

Sets the includeInlineProfileLevelFlag in the movie's initial object descriptor.

Parameters
theMovieinput movie object
theFlagprofile and level flag
Returns
MP4Err error code

◆ MP4SetMovieTimeScale()

MP4Err MP4SetMovieTimeScale ( MP4Movie  theMovie,
u32  timeScale 
)

Sets the Movie’s time scale.

Parameters
theMovieinput movie object
timeScaletimescale value
Returns
MP4Err error code

◆ New3GPPMovie()

ISOErr New3GPPMovie ( ISOMovie *  outMovie,
u16  release 
)

Creates a new empty 3GPP Movie in memory, and sets the brand to the indicated release (4, 5 or 6).

Parameters
outMovieoutput movie object
releaserelease brand (4, 5 or 6).
Returns
ISOErr error code

◆ NewMPEG21()

MP4Err NewMPEG21 ( MP4Movie outMovie)

Creates a new empty MPEG-21 ‘movie’ in memory.

Actually it creates an MPEG-21 file with a meta-atom but no movie atom. You will probably want to get the meta-atom reference ISOGetFileMeta to add items etc.

Note
If you want a dual-function MP4/MPEG-21 file, create an MP4 file and then add a file-level meta atom to that, instead of using this function.
Parameters
outMovieoutput movie object
Returns
MP4Err error code