在Android 4.1以上版本MP4的FileWriter [英] MP4 filewriter in android 4.1+

查看:683
本文介绍了在Android 4.1以上版本MP4的FileWriter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android 4.1媒体codeC API已推出(API等级16)启动。这些API支持基本流解码和放大器;编码。此外MediaExtractor API将通过分析媒体流给小学轨道的详细信息。

Starting from Android 4.1 (API level 16) MediaCodec APIs have been introduced. These APIs support Elementary stream Decoding & Encoding. Also MediaExtractor API will give elementary track details by analyzing Media streams.

我的问题是,我设置连接使用Media codeC API codeR,这给了我带codeD文件.h264格式的视频。我想写.h264文件转化为播放/存储/共享目的的.MP4文件。我不觉得Android的任何.mp4档案作家API。有什么办法能实现吗?

My Question is, I setup a video encoder using MediaCodec API, which gives me encoded file in .h264 format. I want to write .h264 file into a .mp4 file for playing/storing/sharing purposes. I don't find any .MP4 file-writer API for android. Is there any way to achieve it?

谢谢,
萨蒂什。

Thanks, Satish.

推荐答案

随着搭载Android 4.3(API 18)可以使用的 MediaMuxer类以原始H.264码流转换为.MP4​​文件(甚至在合并的音频流)。

As of Android 4.3 (API 18) you can use the MediaMuxer class to convert the raw H.264 stream to a .mp4 file (and even merge an audio stream in).

查看恩codeAndMuxTest和CameraToMpegTest来源在这个页面样品code。

See the EncodeAndMuxTest and CameraToMpegTest sources on this page for sample code.

这篇关于在Android 4.1以上版本MP4的FileWriter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆