You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a Camera2 CameraCaptureSession that is capable of four outputs:
On-screen preview (SurfaceView, up to 1080p)
Photo capture (ImageReader, up to 8k photos)
Video Capture (MediaRecorder/MediaCodec, up to 4k videos)
Frame Processing (ImageReader, up to 4k video frames)
Unfortunately Camera2 does not support attaching all of those four outputs (Surfaces) at the same time, so I'm going to have to make a compromise.
The compromise that seemed most logical to me was to combine the two video capture pipelines into one, so that the Frame Processing output (#4, ImageReader) redirects the frames into the Video Capture output (#3, MediaRecorder).
OpenGL, as its name implies, is a "graphic" library that is good at "drawing".
So, in short, it can not help you write an image into surface, but it can help "draw" the image into the surface.
extract YUV data from the image
create a texture and upload the YUV as its data
wrap the surface into EglWindowSurface
draw the texture into the EglWindowSurface
(You can find samples in webrtc)
OR, do this manually, just like "memcpy" (very inefficient, not recommended):
MediaCodec will notify you when it's ready to accept a new input frame by callback: #onInputBufferAvailable(index, ...)
Get the image at position "index" as the callback tells
"memcpy" your image to this image
call MediaCodec.queueInputBuffer(index, ...) to return the image back to MediaCodec
(You can find samples in androidx/heifwriter)
I was able to use ImageWriter which works for now, but I'll soon need to write my custom OpenGL pipeline for that because some images aren't correctly oriented. Thanks!
Hi!
I'm trying to create a Camera2
CameraCaptureSession
that is capable of four outputs:SurfaceView
, up to 1080p)ImageReader
, up to 8k photos)MediaRecorder
/MediaCodec
, up to 4k videos)ImageReader
, up to 4k video frames)Unfortunately Camera2 does not support attaching all of those four outputs (Surfaces) at the same time, so I'm going to have to make a compromise.
The compromise that seemed most logical to me was to combine the two video capture pipelines into one, so that the Frame Processing output (#4,
ImageReader
) redirects the frames into the Video Capture output (#3,MediaRecorder
).How do I write the Images from the ImageReader:
..into the
Surface
from theMediaRecorder
?I'm not too familiar with OpenGL, so any help here would be appreciated.
The text was updated successfully, but these errors were encountered: