代码拉取完成,页面将自动刷新
本项目是基于开源项目mp4parser进行harmonyos化的移植和开发的, 可以通过github地址 追踪到原项目
移植版本:release mp4parser-project-1.9.41
方案一
建议下载开源代码并参照demo引入相关库:
//核心引入
compile project(path: ':isoparser')
compile project(path: ':muxer')
compile project(path: ':streaming')
//部分API直接使用样例
compile project(path: ':examples')
方案二
项目根目录的build.gradle中的repositories添加:
mavenCentral()
module目录的build.gralde中dependencies添加:
implementation 'com.gitee.ts_ohos:isoparser:1.0.0'
implementation 'com.gitee.ts_ohos:muxer:1.0.0'
implementation 'com.gitee.ts_ohos:streaming:1.0.0'
API使用流程很简单:
1 将每个原始格式文件包装到适当的Track对象中
H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl(new File(filesDir,names[1])));
AACTrackImpl aacTrack = new AACTrackImpl(new FileDataSourceImpl(new File(filesDir, names[0])));
2 将这些Track对象添加到Movie对象中
Movie m = new Movie();
m.addTrack(h264Track);
m.addTrack(aacTrack);
3 用MP4Builder创建容器
Mp4Builder builder = new DefaultMp4Builder();
Container c = builder.build(m);
4 将容器写入适当的接收器中
c.writeContainer(new FileOutputStream(outFilePath).getChannel());
更多实例请参考entry中给定的示例
Apache License Version 2.0, January 2004 http://www.apache.org/licenses
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。