Android的:如何连接图像codeA流,H264硬件加速? [英] Android: how to encode a stream of images to h264 with hardware acceleration?

查看:210
本文介绍了Android的:如何连接图像codeA流,H264硬件加速?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前工作的一个应用程序,读取摄像机的图像,并使用OpenCV的处理。 我想存储的原始的图像作为一个正常的视频和处理(该信息被提取之后)之后丢弃的处理的图像。 为此,我基本上需要连接code中的图像流H264。 这不会是可能使用的ffmpeg或其他溶液至极做它的一般的CPU。它必须使用内部硬件加速进行。 正因为这样我反倒三个问题:

I am currently working on an app, to read the camera images and process them using OpenCV. I would like to store the original images as a "normal" video and to drop the processed images after processing (after the information is extracted). For this I basically need to encode the image stream to h264. It will not be possible to use ffmpeg or other solutions wich do it on the general cpu. It has to be done using the internal hardware acceleration. Because of this I have actually three questions:

  • 请问somebdy知道如何使用内部硬件模块来连接code视频实现H264编码?

  • Does somebdy know how to achieve h264 encoding using the internal hw-modules to encode videos?

抑或ffmpeg的真正支持这在Android?

Or does ffmpeg really support this on Android?

或者是有没有办法访问期间,通常编码过程的图像流?

Or is there a way access the image stream during the "usual" encoding process?

非常感谢!

推荐答案

您可以运行在 MediaRecorder 以创建使用H264的硬件连接codeR视频(如果可用)和的同时的注册preVIEW帧处理。我不能保证所有 preVIEW帧会在两个方向,但。

You can run the MediaRecorder to create the video using h264 hardware encoder (if available) and at the same time register your preview frame handler. I cannot guarantee that all preview frames will go in both directions, though.

另外,你可以编译的ffmpeg与libstagefright,它将使用硬件AVC EN codeR。

Alternatively, you can compile ffmpeg with libstagefright, and it will use hardware avc encoder.

另外,你可以直接使用stagefright从您的应用程序(通过JNI)。

Alternatively, you can use stagefright directly from your app (via JNI).

最后,你可以按照 libstreaming 的方式找到您的平台的最佳记录API(可它的 MediaRecorder API,或媒体codeC 缓冲区到缓冲区方法,它需要的Andr​​oid 4.1或媒体codeC surface-以缓冲方法,它需要的Andr​​oid 4.3。

Finally, you can follow the approach of libstreaming to find the optimal recording API for your platform (be it MediaRecorder API, or MediaCodec buffer-to-buffer method which requires Android 4.1, or MediaCodec surface-to-buffer method which requires Android 4.3.

这篇关于Android的:如何连接图像codeA流,H264硬件加速?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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