简体   繁体   English

使用MediaCodec压缩视频

[英]Using MediaCodec to compress video

I'm trying to use MediaCodec in Android to compress videos. 我正在尝试在Android中使用MediaCodec压缩视频。

It looks like MediaCodec will give you back the raw stream. 看起来MediaCodec会给您返回原始流。 Is there a way to go from A->B (compress video with an output file at the end)? 有没有办法从A-> B(使用最后的输出文件压缩视频)?

Thanks. 谢谢。

You can employ the MediaMuxer class to store the elementary streams into a file format like MP4 . 您可以使用MediaMuxer类将基本流存储为MP4类的文件格式。 Please refer to this cts example for a good illustration of transcode + muxing where the encoded data is written into a file through the MediaMuxer . 请参阅此cts示例 ,以获取转码+混合的良好示例,其中通过MediaMuxer将编码后的数据写入文件。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM