mediacodec

MediaExtractor.setDataSource throws IOException “failed to instantiate extractor”

冷暖自知 提交于 2019-12-06 03:13:23
问题 I'm on Android 4.2 and calling MediaExtractor.setDataSource, and it sometimes throws an IOException of "failed to instantiate extractor". I've found where this is thrown from the C++ implementation, but it hasn't helped. Other people with the same problem and either no answer or an answer which doesn't help me are: android.media.MediaExtractor. Anyone got this beast to work? "Failed to instantiate extractor" exception media extractor show "failed to instantiate extractor" Failed to

MediaCodec get all frames from video

北慕城南 提交于 2019-12-06 01:31:35
问题 I'm trying to use the MediaCodec to retrive all the frames from a video for image processing stuff, I'm trying to render the video and to capture the frame from the outBuffers but I can't initiate a bitmap instance from the received bytes. I've tried to render it to a surface or to nothing(null), because I've notice that when you rendering to null then the outBuffers are getting the bytes of the rendered frames. This is the code: private static final String SAMPLE = Environment

mediacodec vs mediaplayer and mediarecorder

孤街浪徒 提交于 2019-12-05 22:40:45
问题 I'm a bit confused about how to play and record video/audio in Android. I don't really understand in what situations one should use these classes: -To play: MediaPlayer vs MediaExtractor + MediaCodec -To record: MediaRecorder vs MediaCodec + MediaMuxer When do I have to use one or the others? Sorry if it's a repeated question, I think it should be a common one but I haven't found any. 回答1: If the high level interfaces (MediaPlayer, MediaRecorder) can do what you want (play back video from a

How to stream data from MediaCodec to AudioTrack with Xamarin for Android

时光总嘲笑我的痴心妄想 提交于 2019-12-05 12:23:39
I'm trying to decode a mp3 file and stream it to AudioTrack. It all works fine but causes a lot of GC on the Java side. I've made sure to not allocate memory in my play/stream loop and blame ByteBuffer.Get(byte[], int, int) binding of allocating a temp Java array. Anyone can confirm and/or show a better way of feeding data from MediaCodec to AudioTrack? (I know API 21 introduced AudioTrack.write(ByteBuffer, ...)) Thanks Here is what I do: byte[] audioBuffer = new byte[...]; ... ByteBuffer codecOutputBuffer = codecOutputBuffers[outputIndex]; // The next line seems to be the source of a lot of

Encoder crash on Adreno GPU while encoding from Surface

霸气de小男生 提交于 2019-12-05 08:20:35
问题 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

how to use software codec in android using mediacodec

邮差的信 提交于 2019-12-05 06:02:24
问题 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

Android MediaCodec usage for decoding MPEG2 video stream

随声附和 提交于 2019-12-05 02:31:49
问题 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

Recording video using MediaCodec with Camera2 API

家住魔仙堡 提交于 2019-12-05 02:23:20
I am trying to use MediaCodec to record raw frames from ImageReader in onImageAvailable callback but unable to write a working code. Most of the examples are using Camera 1 API or MediaRecorder. My aim is to capture individual frames process it and create an mp4 out of it Raw YUV frames @Override public void onImageAvailable(ImageReader reader) { Image i = reader.acquireLatestImage(); processImage(i); i.close(); Log.d("hehe", "onImageAvailable"); } }; MediaCodec MediaCodec codec = MediaCodec.createByCodecName(name); MediaFormat mOutputFormat; // member variable codec.setCallback(new MediaCodec

Screen Recorder Android Plugin in Unity

你离开我真会死。 提交于 2019-12-05 01:47:42
问题 I'm developing an Unity-Android Plugin to record game screen and create a mp4 video file.I follow to Android Breakout game recorder patch sample in this site : http://bigflake.com/mediacodec/. First, I create my CustomUnityPlayer class that extends UnityPlayer class and override onDrawFrame method.Here is my CustomUnityPlayer class code : package com.example.screenrecorder; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.content

MediaCodec converted file from WAV to AMR does not play

痴心易碎 提交于 2019-12-05 01:24:32
问题 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