I am working on an Android application that uses MediaCodec to encode H.264 videos using the Surface method. I am targeting Android 5.0, and I followed all the examples and samples from bigflake.com (I started working on this project two years ago, so I went through all the problems and other problems).
Everything works well and well on Nexus 6 (Qualcomm hardware encoder is used for this), and I can record flawlessly in real time 1440p video with AAC audio on multiple outputs (from MP4 local files to HTTP streaming). But when I try to use the application on the Sony Android TV (running Android 5.1), which uses the Mediatek chipset, all hell breaks even from the encoding level. To be more specific:
In principle, it is impossible to make the hardware encoder work correctly (that is, "OMX.MTK.VIDEO.ENCODER.AVC"). With the most basic setup (which succeeds at the MediaCodec level), I will almsot never receive output buffers from it, only weird, spam, logcat error messages stating that the driver encountered errors every time a frame needs to be encoded, for example :
01-20 05:04:30.575 1096-10598/? E/venc_omx_lib: VENC_DrvInit failed(-1)!
01-20 05:04:30.575 1096-10598/? E/MtkOmxVenc: [ERROR] cannot set param
01-20 05:04:30.575 1096-10598/? E/MtkOmxVenc: [ERROR] EncSettingH264Enc fail
Sometimes an attempt to set it up for encoding with a resolution of 360 by 640 pixels will cause the encoder to actually encode the material, but the first problem I noticed is that it will create only one keyframe, that is, the first video frame. After that, key frames are never created again, but only P-frames. Of course, the i-frame interval was set to a decent value and works without problems on other devices. Needless to say, this makes it impossible to create files with the ability to search for MP4 or any kind of streaming solution from above.
In most cases, after releasing the encoder, logcat will endlessly start spam with "Waiting for input frame output ...", which basically requires rebooting the device, since nothing will work from this point in any case.
, , t go havoc (), - , , avc google encoder. , -, , , - , 160 ...
, : , MediaCodec API ? , CTS, Google/ ( Sony), , API , , Android 5.1. - ? - ( MediaCodec) ? !
PS: , Sony , . , , Mediatek, , Android CTS ?