mediacodec

PCM -> AAC (Encoder) -> PCM(Decoder) in real-time with correct optimization

耗尽温柔 提交于 2019-12-17 08:11:13
问题 I'm trying to implement AudioRecord (MIC) -> PCM -> AAC Encoder AAC -> PCM Decode -> AudioTrack?? (SPEAKER) with MediaCodec on Android 4.1+ (API16). Firstly, I successfully (but not sure correctly optimized) implemented PCM -> AAC Encoder by MediaCodec as intended as below private boolean setEncoder(int rate) { encoder = MediaCodec.createEncoderByType("audio/mp4a-latm"); MediaFormat format = new MediaFormat(); format.setString(MediaFormat.KEY_MIME, "audio/mp4a-latm"); format.setInteger

How to reduce latency in MediaCodec video/avc decoding

我与影子孤独终老i 提交于 2019-12-17 07:38:27
问题 I performed some simple timing of MoviePlayer.java in the Grafika MediaCodec sample code running on a Nexus 5. I put a log statement at these locations: At line 203 just before decoder.queueInputBuffer At line 244 after decoder.dequeueOutputBuffer I correlated the log statements using presentationTimeUs . Here is an excerpt from logcat: 01-29 10:56:43.295: I/Grafika(21286): queueInputBuffer index/pts, 2,0 01-29 10:56:43.305: I/Grafika(21286): queueInputBuffer index/pts, 0,33100 01-29 10:56:43

Received wrong frame data with ExtractMpegFramesTest in Android?

时光毁灭记忆、已成空白 提交于 2019-12-13 18:25:26
问题 I'm trying to get frames by using MediaCodec and found ExtractMpegFramesTest.java example from this site http://bigflake.com/mediacodec/ . I could save the frames but it looks a little weird. I don't really know what was wrong with it. Maybe color space? Here is the frame: https://drive.google.com/file/d/0BxhKRYTBr4adMGJ1aWhHNjdHUDg/edit?usp=sharing Many thanks in advance. Edit: Things worked well if the video resolution is 480x360 with Gadmei tablet. If it's bigger, I will get similar

mediaNdk undefined reference to 'AMediaCodec_signalEndOfInputStream'

别来无恙 提交于 2019-12-13 18:08:02
问题 can not find AMediaCodec_signalEndOfInputStream on link process. ExportThread.cpp source configure file apilevel android-21 here is my config CmakeLists.txt target_link_libraries(${Lib_Name} android mediandk EGL GLESv3 log ) gradle.build ndk { abiFilters 'armeabi-v7a' // , 'armeabi-v7a', 'arm64-v8a' } externalNativeBuild { cmake { arguments '-DANDROID_PLATFORM=android-21' } } errors [35/35] Linking CXX shared library /Users/rqg/ASProjects/PboTest/muses/build/intermediates/cmake/debug/obj

MediaCodec.createInputSurface() throws IllegalStateException in Android emulator (Error -38)

倖福魔咒の 提交于 2019-12-13 15:27:00
问题 I have MediaMuxer : MediaMuxer mMediaMuxer = new MediaMuxer(new File(Environment.getExternalStorageDirectory(), "video.mp4").getPath(), MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4); And code, which records video: MediaFormat mMediaFormat = MediaFormat.createVideoFormat("video/avc", width, height); mMediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, CodecCapabilities.COLOR_FormatSurface); mMediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, 128000); mMediaFormat.setInteger(MediaFormat.KEY_FRAME

MediaCodec is giving a storeMetaDataInBuffers trace error

烈酒焚心 提交于 2019-12-13 13:02:19
问题 I'm getting on the logcat the next error while encoding via the MediaCodec in Android. The actual encoding works fine and the output is produced correctly, so I can't really understand why I get this trace. Is it a harmless error trace, or is there something I'm missing? E/ACodec(6438): [OMX.qcom.video.encoder.h263] storeMetaDataInBuffers (output) failed w/ err -1010 Next is the code where I get the trace final int BIT_RATE = 4000000; final int FRAME_RATE = 30; final int IFRAME_INTERVAL = 5;

Will all phones support YUV 420 (Semi) Planar color format in h.264 encoder?

感情迁移 提交于 2019-12-13 12:33:28
问题 Preambule: This may sound like a very specific question, but this is actually a go / no go to build an API 16+ Android application using MediaCodec that is compatible with most phone. I have an application with a h.264 MediaCodec that receives data from a buffer - and not a surface since I'm doing a lot of manipulations on the image. When creating the Encoder , I iterate through the list of possible encoders from the phone to make sure I'm using a proprietary encoder if any. This part is not

Worrying about the compatibility of Android MediaCodec and MediaMuxer since API-18

試著忘記壹切 提交于 2019-12-13 09:22:30
问题 With an effort, I wrote a demo which can record a h264/aac video successfully. I use MediaCodec and MediaMuxer which are both available since api-18. To avoid that the color formats for the camera output and the MediaCodec encoder input are different, I chose the color format "MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface" according to the continous capture activity of grafika. But I am worrying about one thing, there are so many kinds of Android phones, Can my demo record video

How to solve the Android MediaCodec error after setting “csd-0” and “csd-1”?

风流意气都作罢 提交于 2019-12-13 07:56:27
问题 I use the MediaCodec to encode video stream and i need to set the "csd-0" and "csd-1" as following according to here: byte[] sps = { 0, 0, 0, 1, 103, 100, 0, 40, -84, 52, -59, 1, -32, 17, 31, 120, 11, 80, 16, 16, 31, 0, 0, 3, 3, -23, 0, 0, -22, 96, -108 }; byte[] pps = { 0, 0, 0, 1, 104, -18, 60, -128 }; MediaFormat format = MediaFormat.createVideoFormat("video/avc", width, height); format.setByteBuffer("csd-0", ByteBuffer.wrap(sps)); format.setByteBuffer("csd-1", ByteBuffer.wrap(pps)); ...

Receive frames from MediaCodec, edit and show on the glSurfaceView

瘦欲@ 提交于 2019-12-13 05:25:38
问题 What I'm working on is an application which can get frames then modify it (like move pixels in the frame). After that show the edited frames onto the screen with good speed, glSurfaceView will do that part I think. And MediaCodec will help getting the frames. I'm trying a good example about MediaCodec like ExtractMpegFramesTest from http://bigflake.com/mediacodec/. Can I directly edit the received frames with GLES code and show it onto the screen without getting Bitmap ? 来源: https:/