久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android中的視頻處理

Video processing in Android(Android中的視頻處理)
本文介紹了Android中的視頻處理的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我正在使用帶有 Eclipse 的 Android 2.2.

I'm using Android 2.2 with Eclipse.

我想制作一個(gè)捕獲視頻的應(yīng)用程序,并且對(duì)于每一幀,將其作為位圖發(fā)送到處理它的方法并返回一個(gè)新位圖并顯示處理后的位圖.

I would like to make an application that captures video, and for each frame, its send it as a bitmap to a method that processes it and returns a new bitmap and shows the processed bitmap.

我對(duì) Android 不是很熟悉,所以請(qǐng)誰(shuí)能給我發(fā)一份我需要查看的資源來(lái)做這樣的事情?

I am not very familiar with Android, so please, can anyone send me to the resources I need to look at to do such a thing?

推薦答案

使用Android SDK完成以下步驟很簡(jiǎn)單:

It is simple enough to accomplish the following steps using the Android SDK:

  • 將相機(jī)中的預(yù)覽幀捕獲為位圖數(shù)據(jù).Camera.PreviewCallback 將返回一個(gè) byte[] 數(shù)據(jù),以多種可能的圖像格式表示幀.
  • 修改像素?cái)?shù)據(jù).由于數(shù)據(jù)以原始字節(jié)的形式返回,因此對(duì)數(shù)據(jù)進(jìn)行調(diào)整相對(duì)容易......這里的困難在于為您想要執(zhí)行的特定圖像處理應(yīng)用算法.沒(méi)有任何內(nèi)置效果(4.0 之前)可以簡(jiǎn)單地應(yīng)用于圖像,因此您必須自己編寫(xiě).
  • 還可以將數(shù)據(jù)解碼為 Bitmap 對(duì)象,以便更輕松地處理像素.在 2.2 中,您可以選擇使用 NDK 和 jnigraphics 在本機(jī)代碼中處理位圖的像素,這比 Java 層要快得多.
  • 獲取生成的 Bitmap 的內(nèi)容并顯示它.對(duì)于快速移動(dòng)的數(shù)據(jù),您可能希望在 SurfaceView 上顯示它;使用視圖包含的 SurfaceHolder 提供的 lockCanvas()unlockCanvasAndPost() 方法.
  • Capture the preview frames from the camera as bitmapped data. Camera.PreviewCallback will return a byte[] of data representing the frame in a number of possible image formats.
  • Modify the pixel data. Since the data comes back as raw bytes, making adjustments to the data is relatively easy...the difficulty here is applying an algorithm for the particular image processing you want to do. There aren't any built-in effects (pre-4.0) that can be applied simply to images so you will have to write your own.
  • It is also possible to decode the data into a Bitmap object to make working with the pixels easier. In 2.2, you have the option of using the NDK and jnigraphics to work with a Bitmap's pixels in native code, which is significantly faster than at the Java layer.
  • Take the contents of your resultant Bitmap and display it. For fast moving data, you would want to display this on a SurfaceView; using the lockCanvas() and unlockCanvasAndPost() methods available from the SurfaceHolder that view contains.

如果這就是您想做的全部,您可以輕松完成.但是,這與捕獲視頻不同.Android 目前不提供掛鉤讓您將幀實(shí)時(shí)流式傳輸?shù)骄幋a的視頻容器(MPEG4、3GP 等)中.它的視頻捕獲功能被緊緊地包裹在 MediaRecorder 中,它控制著從幀捕獲到編寫(xiě)編碼視頻的整個(gè)過(guò)程.您將需要一個(gè)第三部分庫(kù),例如 FFMPEG(已在 Android 應(yīng)用程序中多次使用 NDK 層構(gòu)建和運(yùn)行)來(lái)協(xié)助修改幀的編碼過(guò)程.

If this is all you are wanting to do, you could accomplish this with little difficulty. However, this is not the same as capturing video. Android does not currently provide hooks for you to stream frames out into an encoded video container (MPEG4, 3GP, etc.) in real-time. It's video capture capabilities are wrapped up tightly into the MediaRecorder which controls the process from frame capture all the way to writing the encoded video. You would need a 3rd part library such as FFMPEG (which has been built and run using the NDK layer a number of times in Android applications) to assist in the encoding process of your modified frames.

我知道您的目標(biāo)是 2.2,但 Android 4.0 確實(shí)在這方面提供了一些緩解,因?yàn)樗麄儼l(fā)布了新版本的 NDK,它允許人們?cè)趶牧髦凶x取圖像數(shù)據(jù)然后將其交給之前有更多發(fā)言權(quán)表示層.但是,我沒(méi)有花足夠的時(shí)間來(lái)了解它是否適??合您的情況.

I know you have a 2.2 target, but Android 4.0 does provide some relief here as they have released a new version of the NDK which allows one to have more say in what happens when reading image data from a stream before handing it to the presentation layer. However, I have not spent enough time with it to know whether it could be recommended for your situation.

這篇關(guān)于Android中的視頻處理的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Why does the android emulator camera stop unexpectedly?(為什么android模擬器相機(jī)會(huì)意外停止?)
Android camera , onPictureTaken(byte[] imgData, Camera camera) method amp; PictureCallback never called(Android camera , onPictureTaken(byte[] imgData, Camera camera) 方法 amp;PictureCallback 從未調(diào)用過(guò)) - IT屋-程序員軟件開(kāi)發(fā)技
Understanding the libGDX Projection Matrix(了解 libGDX 投影矩陣)
QR code reading with camera - Android(使用相機(jī)讀取二維碼 - Android)
IP camera with OpenCv in Java(Java中帶有OpenCv的IP攝像頭)
Android mock Camera(Android 模擬相機(jī))
主站蜘蛛池模板: 欧美日韩淫片 | 黄色免费在线网址 | 成人免费视频观看视频 | 精品福利在线 | 国产精品成人一区 | 久久婷婷香蕉热狠狠综合 | 久久久www成人免费无遮挡大片 | 日韩不卡在线 | 日韩欧美中文字幕在线观看 | 91久久综合亚洲鲁鲁五月天 | 草草影院ccyy | av天天干| 亚洲一区中文字幕在线观看 | 中文字幕一区在线观看视频 | 97精品超碰一区二区三区 | 美女视频黄色的 | 精品国产乱码久久久久久蜜柚 | 亚洲天堂一区二区 | 国产精品美女久久久久久久久久久 | 亚州精品天堂中文字幕 | 亚洲九九| av天空 | 一区二区日本 | 在线一区 | 在线观看国产wwwa级羞羞视频 | 国产高清一区二区三区 | 久久久亚洲 | 欧美日韩亚洲国产 | 精品一区二区三区四区外站 | 久久激情视频 | 欧美一级一区 | av黄色在线观看 | 欧美日韩国产一区二区三区 | 2018国产精品 | 7777久久 | 欧美日韩成人在线 | 日本爱爱视频 | 国产高清av免费观看 | 日韩国产在线观看 | 亚洲精品免费在线 | 亚洲一区综合 |