1MP4(3) MP4 File Format Library MP4(3)
2
3
4
6 MP4Optimize - Optimize the layout of an mp4 file
7
9 #include <mp4.h>
10
11 bool MP4Optimize(
12 const char* existingfileName,
13 const char* newfileName = NULL,
14 u_int32_t verbosity = 0
15 );
16
17
19 existingFileName
20 Specifies the path name of the existing file to be optimized.
21
22 newFileName
23 Specifies the path name of the new, optimized file. If NULL,
24 then a temporary file is used, and the existing file is over‐
25 written upon successful completion.
26
27 verbosity
28 Specifies a bitmask of diagnostic details the library should
29 print to stdout during its functioning. See MP4SetVerbosity()
30 for values.
31
32
34 Upon success, true (1). Upon an error, false (0).
35
37 MP4Optimize reads an existing mp4 file and writes a new version of the
38 file with the two important changes:
39
40 First, the mp4 control information is moved to the beginning of the
41 file. (Frequenty it is at the end of the file due to it being con‐
42 stantly modified as track samples are added to an mp4 file.) This opti‐
43 mization is useful in that in allows the mp4 file to be HTTP streamed.
44
45 Second, the track samples are interleaved so that the samples for a
46 particular instant in time are colocated within the file. This elimi‐
47 nates disk seeks during playback of the file which results in better
48 performance.
49
50 There are also two important side effects of MP4Optimize():
51
52 First, any free blocks within the mp4 file are eliminated.
53
54 Second, as a side effect of the sample interleaving process any media
55 data chunks that are not actually referenced by the mp4 control struc‐
56 tures are deleted. This is useful if you have called MP4DeleteTrack()
57 which only deletes the control information for a track, and not the
58 actual media data.
59
61 MP4(3)
62
63
64
65Cisco Systems Inc. Version 0.9 MP4(3)