![](/img/trans.png)
[英]Is there a simple way to turn the byte array from the camera's onPreviewFrame into a picture in android?
[英]how to add another byte array into onpreviewframe's byte array in surfaceview in android
實際上,我需要執行簡單的任務,將徽標添加到Surface View創建的視頻中
首先,我將徽標圖像轉換為字節數組,然后在下一階段成功實現了這一點,需要將徽標字節數組添加到OnPreviewFrame方法的參數Byte [] xxx中。
我如何添加這兩個字節數組
有什么方法可以使用表面視圖在視頻一角使用我的靜態應用程序徽標進行視頻錄制。
按照我的代碼:
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
Camera.Parameters parameters = camera.getParameters();
if (yuvIplimage != null && recording) {
if (nextFrametime == -1) {
nextFrametime = startTime;
}
if (System.currentTimeMillis() >= nextFrametime) {
videoTimestamp = 1000 * (System.currentTimeMillis() - startTime);
// Put the camera preview frame right into the yuvIplimage
// object
yuvIplimage.getByteBuffer().put(data);
try {
// Get the correct time
recorder.setTimestamp(videoTimestamp);
// Record the image into FFmpegFrameRecorder
recorder.record(yuvIplimage);
recordError = false;
} catch (FFmpegFrameRecorder.Exception e) {
recordError = true;
nextFrametime = -1;
frameCount = 0;
Log.v(LOG_TAG, e.getMessage());
e.printStackTrace();
}
nextFrametime = startTime
+ (long) ((1000.0 / 15) * (++frameCount));
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.