mediacodec

Android Decode raw h264 stream with MediaCodec

橙三吉。 提交于 2019-12-04 04:23:46
问题 I have troubles with decoding and drawing raw h264 data with MediaCodec on the TextureView. I recieve the raw data in byte arrays, each of the array is NAL unit (starts with 0x00 0x00 0x00 0x01 ), also there are SPS and PPS NAL units in constant intervals. When new data arrives, I'm putting it into LinkedBlockingQueue : public void pushData(byte[] videoBuffer) { dataQueue.add(videoBuffer); if (!decoderConfigured) { // we did not receive first SPS NAL unit, we want to throw away all data until

I can't capture android screen using adb screen record tool

主宰稳场 提交于 2019-12-04 03:51:33
I have a nexus 4 with android KitKat. I tried screen recording using the following commands: adb shell screenrecord --verbose /sdcard/demo.mp4 adb shell screenrecord --bit-rate 8000000 --time-limit 30 /sdcard/kitkat.mp4 Both times, the commands returned this message: Main display is 768x1280 @60.00fps (orientation=0) Configuring recorder for 768x1280 video at 4.00Mbps ERROR: unable to create video/avc codec instance In the debug console I had open in AndroidStudio, the following log messages were shown: 02-02 18:16:29.058 176-4045/? E/OMX-VENC-720p﹕ Is component secure 0 02-02 18:16:29.058 176

Encoder crash on Adreno GPU while encoding from Surface

最后都变了- 提交于 2019-12-03 22:01:36
I've been struggling with this issue for more than a week, and most likely it is a bug in the Qualcomm GPU/hardware video encoder . Since we are pressed to release the application, and their developer forums did not provide any feedback, I am posting it here too, hoping that someone is able to provide some clues, or even better, a workaround so that the bug in the encoder is not triggered. The application encodes from a Surface. When certain images are rendered to the surface, the encoder fails (100%) in the same place (when the frame currently being encoded is a key frame). The Logcat output

Android MediaCodec usage for decoding MPEG2 video stream

痴心易碎 提交于 2019-12-03 21:03:33
I am trying to use MediaCodec API to decode and display an MPEG2 encoded stream. I use MediaExtractor to extract the stream from an MPEG Transport Stream ( TS ). I notice that configure() of the decoder is failing on all devices that I have tried - Nexus7(2012), Nexus7(2013), Nexus10, with error code 0x80001001. The only parameter that can go wrong in using the configure() API is the MediaFormat configuration provided and this is obtained from the Android MediaExtractor . I do not understand what could be going wrong resulting in this issue getting noticed. The configuration parameters present

how to use software codec in android using mediacodec

混江龙づ霸主 提交于 2019-12-03 20:51:00
In my i want encode yuv data into h264 using mediacodec software codec. I use Google software encoder OMX.google.h264.encoder when i use hardware encoder[OMX.qcom.video.encoder.avc] that time it work but when i use software encoder[OMX.google.h264.encoder] it not encode file.it will give error [see in log]. what is problem i couldn’t identify. Source : mediaCodec = MediaCodec.createByCodecName("OMX.google.h264.encoder"); //mediaCodec = MediaCodec.createByCodecName(codecInfo.getName()); Log.i(TAG,"codec name : "+ mediaCodec.getName()); int mBitrate = (int) ((MainActivity.mHeight * MainActivity

Performance variation of encoder using MediaCodec encode from surface

倾然丶 夕夏残阳落幕 提交于 2019-12-03 19:38:58
I render a texture to both display and a codec input surface (from where an encoder uses it). There is a large performance variation when the texture is rendered to the display surface, and when it is rendered to the input surface of the encoder, but only on some devices, like S3 Galaxy (~10 times slower to render to encoder surface). On other devices, the speed is similar (S4, Nexus4, etc). A similar scenario can be demonstrated with Grafika and Record GL app activity. (FBO blit x2) The fps drops from ~60 to 6 only for the mentioned device, while for the other devices there is a constant rate

MediaCodec converted file from WAV to AMR does not play

大憨熊 提交于 2019-12-03 16:22:09
I am using MediaCodec to convert a .wav file to .amr . I have used following code for input and getting encoded buffer. I get the encoded file but it does not play, my input is proper as i am able to play that file in Audacity. I am using EncodeDecodeTest.java from android API test. Any pointers to potential problem are appreciated. MediaCodec codec = MediaCodec.createByCodecName(componentName); try { codec.configure( format, null /* surface */, null /* crypto */, MediaCodec.CONFIGURE_FLAG_ENCODE); } catch (IllegalStateException e) { AppLog.logString("codec '" + componentName + "' failed

Fastest way to draw a MediaCodec-decoded video frame to screen?

回眸只為那壹抹淺笑 提交于 2019-12-03 14:44:15
I'm looking for the fastest way to take an image frame received from the MediaCodec decoder and draw it to the Android device screen. The important constraints and explanations are: Cannot use MediaPlayer. No intermediate app allowed. Must draw output frames from the MediaCodec decoder to the screen as quickly as possible (minimize latency). The available decoder output formats are as follows: ColorFormat[0] 0x00000013 COLOR_FormatYUV420Planar ColorFormat[1] 0x00000015 COLOR_FormatYUV420SemiPlanar ColorFormat[2] 0x7F000001 OMX_SEC_COLOR_FormatNV12TPhysicalAddress ColorFormat[3] 0x7FC00002 OMX

SurfaceTexture updateTexImage to shared 2 EGLContexts - Problems on Android 4.4

我与影子孤独终老i 提交于 2019-12-03 11:21:22
问题 I am referring to this excellent example of how to encode the preview frames of the camera directly into an mp4 file: http://bigflake.com/mediacodec/CameraToMpegTest.java.txt I have adopted the code in the way that I also would like to render the preview image on the screen. Therefore I got something like a GLTextureView with its own EGLContext. This Context is then used as shared EGLContext when I create the EGLContext for the encoder rendering: mEGLContext = EGL14.eglCreateContext

In Android, how to pass a predefined Surface to MediaCodec for encoding?

霸气de小男生 提交于 2019-12-03 09:25:25
问题 I have an app that manages its own GLSurfaceView and now I want to use Android 4.3's new MediaCodec feature that takes a Surface as input. In all the examples I've seen, the Surface is created using MediaCodec.createInputSurface(), then the GL context is created for this Surface. This feels monolithic and incredibly disruptive to retrofit into a code base that is already stable. Is it possible to use MediaCodec.configure(format, a_predefined_Surface, null, MediaCodec.CONFIGURE_FLAG_ENCODE)