简体   繁体   English

如何在Android上从h264编码的帧创建mp4文件?

[英]How to create mp4 file from h264 encoded frames on android?

I have some h264 frames already encoded with android encoder. 我有一些已经用android编码器编码的h264帧。 Now i want to create and write them one by one to the mp4 file. 现在,我要创建它们并将它们一个一个地写入mp4文件。 Please advise how to do this on android in Java. 请告知如何在Java中的android上执行此操作。 I don't want to use OpenCV or native code. 我不想使用OpenCV或本机代码。

mp4-parser can't do this as i understand mp4-parser无法做到这一点,据我了解

navite MPEG4Writer is too complicated to use navite MPEG4Writer使用起来过于复杂

Wondering why such a common and very useful thing as mp4 writer NOT FROM CAMERA is not implemented in android 想知道为什么没有在android中实现像MP4编写器NOT FROM CAMERA这样的常见且非常有用的东西

You may use my mp4parser project. 您可以使用我的mp4parser项目。 You can mux H264 and AAC in pure Java with it: 您可以使用它在纯Java中混合使用H264和AAC:

    H264TrackImpl h264Track = new H264TrackImpl(new FileInputStream("raw.h264").getChannel());
    Movie m = new Movie();
    m.addTrack(h264Track);

    IsoFile out = new DefaultMp4Builder().build(m);
    FileOutputStream fos = new FileOutputStream(new File("h264_output.mp4"));
    out.getBox(fos.getChannel());
    fos.close();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android - 将rtsp(h264)流保存到mp4文件 - Android - Save an rtsp (h264) stream to mp4 file 使用IOMX列出组件名称和型号时找不到编码器,但android仍可以使用H264编码的帧记录.mp4文件 - No Encoder found while listing component names and model using IOMX but still android can record .mp4 files with H264 encoded frames Android-在mp4容器中混合原始h264 - android - mux raw h264 in mp4 container Android编码器复用器:原始h264到mp4容器 - Android encoder muxer: raw h264 to mp4 container mp4 h264作为PES有效负载 - mp4 h264 as PES payload 转码 H264 MP4 时重复帧(=冻结效果)会产生奇怪的伪影 - Repeating frames (=freeze effect) while transcoding H264 MP4 creates odd artefacts 使用mp4parser将h264混合到mp4文件中花费的时间太长 - It takes too long time to mux h264 into mp4 file using mp4parser 如何将Android MediaCodec编码的H264打包成RTP包 - How to pack Android MediaCodec encoded H264 into RTP packets Android:ExoPlayer 直接馈送原始 mp4 (h264) 片段 - Android: ExoPlayer direct feed raw mp4 (h264) fragments 带有H264 .MP4的Android 2.2 VideoView“对不起,无法播放视频” - Android 2.2 VideoView “Sorry, Video cannot be played” with H264 .MP4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM