说在前面的是,我用的mp4v2版本是mp4v2-2.2.0,与之前版本相比接口函数稍有不同!
1. 首先调用MP4CreateEx()函数,创建输出的MP4文件
MP4FileHandle file = MP4CreateEx("test.mp4", 0, 1, 1, "isom", 0x00000200, p, 4);
2. 接下来设置timescale
MP4SetTimeScale(file, 90000);
3. 接下来添加video track
MP4TrackId video = MP4AddH264VideoTrack(file, 90000, 90000/25, 640, 480,
0x4d, //sps[1] AVCProfileIndication
0x40, //sps[2] profile_compat
0x1f, //sps[3] AVCLevelIndication
3); // 4 bytes length before each NAL unit
MP4SetVideoProfileLevel(file, 0x7F);
<