How to encode Bitmaps into a video using MediaCodec?

后端 未结 4 1975
情话喂你
情话喂你 2020-12-02 06:49

I would like to encode a set of Bitmaps that I have into an h264. Is this possible via MediaEncoder? I have written some code in order to do it, but the output cannot be pla

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 07:28

    1. Encoders output is "raw" h264, so you can set filename extension to "h264" and play it with mplayer, ie mplayer ./your_output.h264
    2. One more thing: you says to encoder that frame will be in COLOR_FormatYUV420Planar color format but it looks like you give him PNG content, so output file will probably contain color mess. I think you should convert PNG to yuv420 (with this, for example, https://code.google.com/p/libyuv/) before feeding it to encoder.

提交回复
热议问题