mediaextractor

RTSP Client implementation on Android

泄露秘密 提交于 2019-12-24 01:54:11
问题 I have seen many questions related to this. Nevertheless there is not an answer for mine I think. I would like to use an already coded RTSP Client on Android to use with MediaCodec in order to capture a RTSP stream in H264 to then decode and display it. I have used VideoView and MediaPlayer which are well-known to support RTSP streaming in the .setDataSource method (file or rtsp/http path) (unlike MediaExtractor which only supports file or http), but the latency is to high for my purposes. I

RTSP Client implementation on Android

那年仲夏 提交于 2019-12-24 01:54:03
问题 I have seen many questions related to this. Nevertheless there is not an answer for mine I think. I would like to use an already coded RTSP Client on Android to use with MediaCodec in order to capture a RTSP stream in H264 to then decode and display it. I have used VideoView and MediaPlayer which are well-known to support RTSP streaming in the .setDataSource method (file or rtsp/http path) (unlike MediaExtractor which only supports file or http), but the latency is to high for my purposes. I

How do I handle first output ByteBuffers of Android MediaCodec decoder?

不想你离开。 提交于 2019-12-24 01:54:03
问题 I am trying to write an audio resampler using Android's MediaCodec suite. I am currently feeding an MP3 stereo audio file into a MediaExtractor which is then decoded by a MediaCodec. The sample rate of the source audio is 48000. What I don't understand is the first four output buffers I receive from the decoder: size 0, time 0 size 0, time 24000 size 4312, time 48000 size 4608, time 72000 size 4608, time 96000 etc. From this answer, this answer, and this article, I believe the first two

Android Precise seeking of video

 ̄綄美尐妖づ 提交于 2019-12-21 02:14:10
问题 I'm struggling with precise seeking using MediaExtractor's seekTo() . While I can seek to sync frames without problems, I would like to seek to specific time. This question led me to some ideas how to do this, but I'm not sure if they are valid. Basicly, I would have to seek to closest previous sync frame and then advance() the extractor until target time is reached. Every frame in the process would be fed to the decoder, i.e the first I-frame and the rest P-frames. This is related code

Inconsistent sample time / presentation time during video decoding

我的梦境 提交于 2019-12-18 05:08:26
问题 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

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

Why MediaExtractor getTrackCount returns 0 in android 4.4.2

自古美人都是妖i 提交于 2019-12-11 20:20:55
问题 I ran exactly the same code on: Android 4.1.2 Android 4.2.2 Android 4.4.2. It works well on 4.1.2 and 4.2.2, but NOT on 4.4.2. The problem is MediaExtractor.getTrackCount returns 0 on 4.4.2 (while it returns the right number on other devices) Any idea? I am also facing the very same issue. Did you got the solution ? 回答1: I finally figured out where the problem is. For 4.4.2, u got to add permission in the AndroidManifest.xml about write external storage if you play local file. here is the

android MediaExtractor MediaCodec seek

那年仲夏 提交于 2019-12-11 06:02:41
问题 Question again, guys. I use MediaExtractor and MediaCodec to play MP4 file on android device. Everything works fine until I try to add Extractor.seekto(). If I just play mp3 file with my player,seeking functions well. However, when I try it with MP4 file, the video is not updated. I tried to debug the code, finding out that the mPlayerExtractor.getSampleTrackIndex() always returns 1 (Refer to the audio track). But I do not know how to fix it. I cannot put all my code here. So please give me

Android MediaCodec How to Frame Accurately Trim Audio

一个人想着一个人 提交于 2019-12-11 02:08:40
问题 I am building the capability to frame-accurately trim video files on Android. Transcoding is implemented with MediaExtractor , MediaCodec , and MediaMuxer . I need help truncating arbitrary Audio frames in order to match their Video frame counterparts. I believe the Audio frames must be trimmed in the Decoder output buffer, which is the logical place in which uncompressed audio data is available for editing. For in/out trims I am calculating the necessary offset and size adjustments to the

Android MediaCodec backward seeking

那年仲夏 提交于 2019-12-10 10:59:35
问题 I'm trying to implement precise seeking for video using MediaCodec and MediaExtractor . By following Grafika's MoviePlayer, I've managed to implement the forward seeking. However I'm still having problem with backward seeking. The relevant bit of code is here: public void seekBackward(long position){ final int TIMEOUT_USEC = 10000; int inputChunk = 0; long firstInputTimeNsec = -1; boolean outputDone = false; boolean inputDone = false; mExtractor.seekTo(position, MediaExtractor.SEEK_TO