mediaextractor

Problems with MediaExtractor

十年热恋 提交于 2019-12-02 05:24:58
问题 I am trying to get specific frames at specific times as images from a movie using MediaExtractor and MediaCodec . I can do it successfully if: I use extractor.seekTo(time, MediaExtractor.SEEK_TO_PREVIOUS_SYNC); , however, this only gives the nearest sync frame not the target frame. I sequentially extract all frames using extractor.advance(); , but I need to get the target frame not all. So, I try the following: extractor.seekTo(time, MediaExtractor.SEEK_TO_PREVIOUS_SYNC); while(extractor

Android MediaMuxer failed to stop

一个人想着一个人 提交于 2019-12-02 00:01:34
问题 I am trying to use MediaCodec,MediaExtractor and MediaMuxer to generate mp4 file. EveryThing seems to work properly but when i call MediaMuxer.stop i'm having an error . The MP4 file is created but i can't play it with a Player. Here is my logcat: 02-13 10:41:22.420: D/OpenGLRenderer(11768): Enabling debug mode 0 02-13 10:41:22.600: I/OMXClient(11768): Using client-side OMX mux. 02-13 10:41:22.717: E/ACodec(11768): [OMX.TI.DUCATI1.VIDEO.DECODER] storeMetaDataInBuffers failed w/ err

How to determine a video file's framerate with MediaCodec, MediaExtractor or MediaMetadataRetriever?

青春壹個敷衍的年華 提交于 2019-12-01 06:46:14
问题 How to I extract the frame rate of a recorded video file? I know that there is MediaFormat.KEY_FRAME_RATE and that I can access MediaFormat objects through MediaExtractor. However KEY_FRAME_RATE is only available for encoders. Instead I want to find out the frame rate of an already recorded video. Any ideas? 回答1: It looks like there is no way to get framerate through any of official API functions. It might require some extra logic - count times between timestamps or to parse headers info. in

Android MediaExtractor and mp3 stream

▼魔方 西西 提交于 2019-11-30 09:35:38
I am trying to play an mp3 stream using MediaExtractor/MediaCodec. MediaPlayer is out of the question due to latency and long buffer size. The only sample code i have found is this: http://dpsm.wordpress.com/category/android/ The code samples are only parcial (?) and use a File instead of a stream. I have been trying to adapt this example to play an Audio Stream but i can't get my head around how this is supposed to work. The Android documentation as usual is no help. I understand that first we get information about the stream, presumably setup the AudioTrack with this information ( code

Android MediaExtractor and mp3 stream

旧街凉风 提交于 2019-11-29 15:07:33
问题 I am trying to play an mp3 stream using MediaExtractor/MediaCodec. MediaPlayer is out of the question due to latency and long buffer size. The only sample code i have found is this: http://dpsm.wordpress.com/category/android/ The code samples are only parcial (?) and use a File instead of a stream. I have been trying to adapt this example to play an Audio Stream but i can't get my head around how this is supposed to work. The Android documentation as usual is no help. I understand that first

Inconsistent sample time / presentation time during video decoding

扶醉桌前 提交于 2019-11-29 07:23:53
I'm writing an APP that can encode video by camera input and process video by decode-edit-encode steps. For the camera, I use the Camera class rather than Intent to configure the details settings of the camera. Then I feed the camera frames to the encoder (MediaCodec in API 16) and the muxer (I use ffmpeg muxer since I want to work on 4.1 Devices). I measure the time code of camera frames by system nano time, and select a subset of frames to fit a desired FPS (currently 15). There are some small "noises" in the time values, for example (in ms): 0, 60718, 135246, 201049, ... rather than 0,

Decoding Video and Encoding again by Mediacodec gets a corrupted file

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-29 05:07:00
I am trying to implement https://android.googlesource.com/platform/cts/+/jb-mr2-release/tests/tests/media/src/android/media/cts/DecodeEditEncodeTest.java but modifying the source by using a video file mp4. The mime tipe is video/avc, bitrate 288kbps, iframeinterval 100, width: 176, height: 144. The file size is 6MB. When I decode the video and put the frame in the outputsurface, I can save the frame to a bitmap and see the frame great. But at the end, after encoding (with the same parameters of the original video), I get a 700kb file and I cannot see the video (may be a corrupted file).

How to reduce latency in MediaCodec video/avc decoding

梦想与她 提交于 2019-11-27 05:12:40
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.315: I/Grafika(21286): queueInputBuffer index/pts, 3,66466 01-29 10:56:43.325: I/Grafika(21286):

SurfaceTexture's onFrameAvailable() method always called too late

空扰寡人 提交于 2019-11-26 20:17:32
I'm trying to get the following MediaExtractor example to work: http://bigflake.com/mediacodec/ - ExtractMpegFramesTest.java (requires 4.1, API 16) The problem I have is that outputSurface.awaitNewImage(); seems to always throw RuntimeException("frame wait timed out"), which is thrown whenever the mFrameSyncObject.wait(TIMEOUT_MS) call times out. No matter what I set TIMEOUT_MS to be, onFrameAvailable() always gets called right after the timeout occurs. I tried with 50ms and with 30000ms and it's the same. It seems like the onFrameAvailable() call can't be done while the thread is busy, and

SurfaceTexture's onFrameAvailable() method always called too late

非 Y 不嫁゛ 提交于 2019-11-26 12:17:08
问题 I\'m trying to get the following MediaExtractor example to work: http://bigflake.com/mediacodec/ - ExtractMpegFramesTest.java (requires 4.1, API 16) The problem I have is that outputSurface.awaitNewImage(); seems to always throw RuntimeException(\"frame wait timed out\"), which is thrown whenever the mFrameSyncObject.wait(TIMEOUT_MS) call times out. No matter what I set TIMEOUT_MS to be, onFrameAvailable() always gets called right after the timeout occurs. I tried with 50ms and with 30000ms