MIME类型的Andr​​oid摄像头previewFormat [英] Mime-type of Android camera PreviewFormat

查看:271
本文介绍了MIME类型的Andr​​oid摄像头previewFormat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用媒体codeC 为en code从相机(未来数据的原因:它更低级因此比使用的 MediaRecorder )。使用相机。previewCallBack ,我捕捉从相机数据转换成一个字节缓冲器,以便将它传递到介质codeC对象

I'd like to use MediaCodec to encode the data coming from the camera (reason: it's more low-level so hopefully faster than using MediaRecorder). Using Camera.PreviewCallBack, I capture the data from the camera into a byte-buffer, in order to pass it on to a MediaCodec object.

要做到这一点,我需要填写 MediaFormat - 对象,这将是相当容易的,如果我知道从摄像机传来的数据MIME- code。我可以选择使用此格式<一个href="http://developer.android.com/reference/android/hardware/Camera.Parameters.html#set$p$pviewFormat%28int%29"相对=nofollow>设置previewFormat()选择在TE的 的imageformat级。

To do this, I need to fill in a MediaFormat-object, which would be fairly easy if I knew the MIME-code of the data coming from the camera. I can pick this format using setPreviewFormat() choosing one of the constants declared in te ImageFormat-class.

因此​​,我的问题:给定的的imageformat级提供不同的选项来设置相机preVIEW格式,有什么对应的MIME类型codeS

Hence my question: given the different options provided by the ImageFormat-class to set the camera preview-format, what are the corresponding MIME-type codes?

感谢很多提前。

推荐答案

见例如在 https://gist.github.com/3990442 。你应该设置MIME类型,你想摆脱连接codeR,即的视频/ AVC

See example at https://gist.github.com/3990442. You should set MIME type of what you want to get out of encoder, i.e. "video/avc".

这篇关于MIME类型的Andr​​oid摄像头previewFormat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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