androidandroid-mediacodecglsurfaceview

How to feed the video frames directly to Encoder surface, without using Decoder?


I am developing a video compressor app where the general architecture everyone follow is first decode the video frames on the Output surface of decoder then swap those buffer directly to the Input surface and then encode it. Here we are using both decoder and Encoder. that requires double time. My question is is it possible to by pass my video frames directly to the Input surface of Encoder without passing it through the Output surface of decoder. I don't want to use decoder. If it is possible then kindly suggest me the solution.

I looked into this example EncodeAndMux where the programme is creating frames and passing it directly to the Input surface of Encoder. I want the similar way how to pass video frames directly to the Encoder Surface.

Thank you in advance.


Solution

  • If you have already decoded frames or raw frames so yes you can pass them to input surface of encoder without using a decoder check this answer, otherwise you should decode frames first using input/output buffers of decoder.