Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, I don't expect the emulator codecs to work at all. If they do work, I'm pleasantly surprised. This outlook helps me avoid disappointment.</p> <p>Second, my guess would be that the size of the frame being passed into the encoder is wrong. You're taking an RGBA frame decoded from a Bitmap and stuffing it into a YUV 420 buffer. This doesn't work. The amount of data you're passing in should be exactly width * height * 1.5 bytes for YUV420 (where stride==width and the planes are packed together). On an Android 4.3+ device this behavior is confirmed via the <a href="http://bigflake.com/mediacodec/#EncodeDecodeTest" rel="noreferrer">CTS EncodeDecodeTest</a>; older devices are not guaranteed to work.</p> <p>Also, you're setting the format to <code>COLOR_FormatYUV420SemiPlanar</code>; in general you can't assume that. You need to query the codec for the list of supported formats, determine whether the input needs to be planar or semi-planar, and then format the buffer input accordingly. The buffer-to-buffer and buffer-to-surface tests in the EncodeDecodeTest demonstrate how to do this.</p> <p>Alternatively, on Android 4.3 and later, you can upload the bitmap to a texture, configure the codec for Surface input, and render the texture with GLES (which lets the hardware take care of any scaling issues if the bitmap size doesn't match your video size). This takes a lot more code though.</p> <p>Having said all that, the <code>MediaCodec</code> diagnostics are generally useless, so this is all guesswork.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload