为什么FPS不一样的原装相机应用程序 [英] Why FPS is not same as original camera app

查看:92
本文介绍了为什么FPS不一样的原装相机应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和原装相机应用程序(视频模式)配备了三星Galaxy Tab 8.9的测试。保存的前置摄像头的视频能够达到24帧,640×480。 (通过转移到Windows机器后,看视频文件的属性)

I tested with original camera application (video mode) comes with Samsung Galaxy Tab 8.9. The saved front camera video able to achieve 24 fps, 640x480. (By looking at the properties of video file after transfer to Windows machine)

不过,虽然我前面写的摄像机 code测试。

However, while I write front Camera code to test.

mCamera2.setPreviewCallbackWithBuffer(new PreviewCallback() {
    public void onPreviewFrame(byte[] data, Camera camera) {
        // image processing code placed here.
    }
});

最大的结果,我能做到的,是(不保存视频到磁盘上。我只是衡量previewFrame触发率的回调函数)

The maximum result I can achieve is (without saving video to disk. I merely measure the callback function onPreviewFrame triggered rate)

  • 在每秒15帧
  • 320×240,800×600

我想有相同的性能三星原装相机应用程序。可我知道我失去了一定的技术?

I would like to have performance same as Samsung original camera app. May I know am I missing certain technique?

推荐答案

您看到这些结果的原因是,你的回调得到视频的采样,而不是实际的视频。

The reason you're seeing these results is that your callback is getting a sampling of the video rather than the actual video.

当相机被倾倒它输出到文件系统,它做一个非常低的水平写操作,从相机的视频缓冲器到文件系统复制数据,而没有接触的JVM。这是必需的,以保持视频的高质量和低延迟,并确保顺利晋级决赛的视频。如果你需要做的视频处理上的实际视频,不如做的已经做了视频之后记录。

When the camera is dumping it's output to the file system, it's doing a very low level write operation that copies the data from the camera's video buffer to the file system, without ever touching the JVM. This is required to keep the video at a high quality and low latency, and ensures a smooth final video. If you need to do video processing on the actual video, it is better done after the video is already done being recorded.

在preVIEW回调仅仅是给你的实际视频拍摄,而不是整个视频采集的样本 - 因为大多数15fps的视频将仍然看起来光滑,preVIEW回调只是给你一个较低的分辨率,较低的FPS preVIEW实际的视频版本被抓获。即使是内置三星捕获应用程序将只显示preVIEW版本,因为这是所有的preVIEW接口报错。

The preview callback is merely giving you a sample of the actual video capture, not the entire video capture -- since most 15fps videos will still look smooth, the preview callback is only giving you a lower resolution, lower fps preview version of the actual video being captured. Even the built-in samsung capture application will only show the preview version, because that's all the preview interface is being given.

这将是不可能的,从以外的任何文件系统转储或低级别的字节数组数据结构(使用JNI封装为例)等获得视频录制的精确基准的Andr​​oid系统。这将是很容易的,但试图直接做会阻止输入从摄像机读,反正吹你的基准。

It would be impossible to get an accurate benchmark of video recording in Android from anything other than the file system dump or the low-level byte array data structures (using a JNI wrapper for example). It would be easy enough, but attempting to do it directly would block input reading from the camera and blow your benchmarks anyway.

这篇关于为什么FPS不一样的原装相机应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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