mediacodec

How to convert YUV420SP to RGB and display it?

邮差的信 提交于 2019-12-11 19:28:23
问题 Im trying to render a video frame using android NDK. Im using this sample of google Native-Codec NDK sample code and modified it so I can manually display each video frame (non-tunneled). so I added this code to get the output buffer which is in YUV. ANativeWindow_setBuffersGeometry(mWindow, bufferWidth, bufferHeight, WINDOW_FORMAT_RGBA_8888 uint8_t *decodedBuff = AMediaCodec_getOutputBuffer(d->codec, status, &bufSize); auto format = AMediaCodec_getOutputFormat(d->codec); LOGV("VOUT: format

MediaCodec render on offscreen GL Texture notworking on some specific video

爱⌒轻易说出口 提交于 2019-12-11 19:05:29
问题 I am doing some video frame extracting work, based on the sample given by BigFlakes's example code It worked well for most of the videos I tested with, however, there are some video clips which I shot by my phone, cannot be correctly extracted by this method. Please refer to the screen shot. The correct frame is extracted by default MediaMetadataRetriever, and the "image of the colors" is extracted by the sample code. Correct Frame: False Frame: The testing video clip is here It can be played

If is it possible to get BGR from MediaCodec?

我与影子孤独终老i 提交于 2019-12-11 15:45:54
问题 As far as I know, MediaCodec return output buffer of image in YUV420 and then you can process with it as you like to... But in my case I need to convert YUV420 in BGR , it is quite expensive conversion. So, question is if it is possible immediately (without conversion) get BGR from MediaCodec ? My code now uint8_t *buf = AMediaCodec_getOutputBuffer(m_data.codec, static_cast<size_t>(status), /*bufsize*/nullptr); cv::Mat YUVframe(cv::Size(m_frameSize.width, static_cast<int>(m_frameSize.height *

NdkMediaCodec: couldn't get output / input buffers

限于喜欢 提交于 2019-12-11 15:28:42
问题 I am using native codec to read .mp4 file... My application flow: I have 2 buttons when I click on first button I am starting to read one .mp4 file, when I click second button I am starting to read another .mp4 file So, problems came when I am clicking on the buttons 1 and 2 in one second delay between them in order to check app behaviour when I am switching the video from one to another... And sometimes I get crash with such log / E/NdkMediaCodec: sf error code: -38 / E/NdkMediaCodec: sf

How to get decode format from MediaCodec?

老子叫甜甜 提交于 2019-12-11 14:25:42
问题 I am working with MediaCodec I am using it for decode .mp4 video MediaCodec decode a video to YUV format, but I need to get RGBA All is ok, but I found out that there is a few possible formats like YUV420 , YUV422 and so on... So, as far as I understand to make conversion I need to know exactly which conversion to apply YUV420_to_RGBA or YUV422_to_RGBA or something else... So, question is - how using MediaCodec get know about decoding format? Feel free to ask. EDIT I found out that this way I

Smooth Scrubbing video in Android

自作多情 提交于 2019-12-11 11:12:31
问题 I am trying to achieve smooth video scrubbing with Android VideoView . The seekTo method of MediaPlayer is not doing exactly what i want. It does not exactly seek to millisecond i passed in it, it actually plays from/jumps to the nearest position, not the exact I seeked to. Also the frames are showing with a large gaps. Not the exact frame for millisecond. I came on searching around and found that SEEK_CLOSEST_SYNC can only seek to the nearest sync frame not the EXACT. It depends on the way

(For fadden) Is this the same Android MediaCodec crash?

▼魔方 西西 提交于 2019-12-11 10:39:29
问题 This question was directed specifically to fadden, and then re-directed to nikhilelite, who posted the question "Media codec decoding without surface causes crash". I don't see any followups in the aforementioned post, so I am asking the question here. Now I am re-directing this question again to fadden, or anyone with insight about Android's MediaCodec: I have an app, which uses Android MediaCodec but not Surface, crashing on a few phones while running OK on most other phones. This is how I

Playing audio with video using MediaDecoder

痞子三分冷 提交于 2019-12-11 10:36:50
问题 I have an MPEG2-transport file, and using the newfangled MediaCodec API in Android, I can play the video frames. I'm using MediaExtractor to load the file, and call getTrackFormat to get a MediaFormat. The reported MIME type for the format is "video/avc". Is there a straightforward way to play the audio at the same time, and make sure the video and audio are synchronized? I'm aware of the SimplePlayer sample code for stagefright, but that's in C and uses undocumented interfaces. Can it be

Android mediacodec configureFailed

孤街醉人 提交于 2019-12-11 10:33:32
问题 Following this i have tried below code to initialize MediaCodec, but it failed! The github hosted project runs without any problem. The updated log is as below 01-27 02:02:25.125: I/OMXClient(8956): Using client-side OMX mux. 01-27 02:02:25.140: I/ACodec(8956): setupVideoEncoder succeeded 01-27 02:02:25.140: E/OMXNodeInstance(1910): OMX_GetExtensionIndex failed 01-27 02:02:25.140: A/ACodec(8956): frameworks/av/media/libstagefright/ACodec.cpp:3234 CHECK_EQ( (status_t)OK,mCodec-

Problems of using MediaCodec.getOutputFormat() for an encoder in Android 4.1/4.2 devices

十年热恋 提交于 2019-12-11 08:25:34
问题 I'm trying to use MediaCodec to encode frames (either by camera or decoder) into a video. When processing the encoder output by dequeueOutputBuffer(), I expect to receive the return index = MediaCodec.INFO_OUTPUT_FORMAT_CHANGED, so I can call getOutputFormat() to get the encoder output format as the input of the currently used ffmpeg muxer. I have tested some pad/phone devices with Android version 4.1~4.3. All of them have at least one hardware video AVC encoder and is used in the test. On