mediaextractor

ExtractMpegFramesTest having issue with video recorded in portrait mode in android

让人想犯罪 __ 提交于 2019-12-08 04:50:48
问题 I am following ExtractMpegFramesTest post to extract PNG frames from video. This works fine with videos that are recorded in landscape mode but doesn't work with videos that are recorded in portrait mode. Does anybody know how to generate PNG frames from portrait video using solution provided in above link ? I have tested this with 720p and 1080p videos. Couple of things i observed is, MediaExtractor gives width and height 1280 and 720 of 720p video regardless of orientation. this should be

Android decode mp3 with MediaCodec. not use MediaExtractor

社会主义新天地 提交于 2019-12-07 18:23:19
问题 I want to decode the mp3 using the MediaCodec. However, I do not want to use the MediaExtractor. Because it is because I want to get the meta data from mp3. icy (Shoutcast) stream are also taken into consideration. I tried writing the code to decode the mp3 files from FileInputStream by improving the sample of MediaExtractor. However decode caused the error is not possible. package com.test; import android.app.Activity; import android.media.AudioFormat; import android.media.AudioManager;

Android decode mp3 with MediaCodec. not use MediaExtractor

有些话、适合烂在心里 提交于 2019-12-06 12:37:38
I want to decode the mp3 using the MediaCodec. However, I do not want to use the MediaExtractor. Because it is because I want to get the meta data from mp3. icy (Shoutcast) stream are also taken into consideration. I tried writing the code to decode the mp3 files from FileInputStream by improving the sample of MediaExtractor. However decode caused the error is not possible. package com.test; import android.app.Activity; import android.media.AudioFormat; import android.media.AudioManager; import android.media.AudioTrack; import android.media.MediaCodec; import android.media.MediaCodec

Android MediaExtractor seek() accuracy with MP3 audio files

雨燕双飞 提交于 2019-12-06 09:23:28
I am having trouble getting reasonable accuracy on seek() with Android MediaExtractor . For some files, such as this one , I find significant inaccuracies (about 3 seconds in this case.) I have the following flow: call setDataSource() and selectTrack() call seekTo() call play() In this case, it seeks to an incorrect position, but reports the correct position. If I then seek to another position, it continues to be off by the same margin. However, if I seek to 0, it corrects itself, and then will seek to the correct location in the file. Is this simply a limitation / bug in MediaExtractor? Does

Android MediaCodec backward seeking

百般思念 提交于 2019-12-06 05:14:55
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_PREVIOUS_SYNC); Log.d("TEST_MEDIA", "sampleTime: " + mExtractor.getSampleTime()/1000 + " -- position: " +

Recoding one H.264 video to another using opengl surfaces is very slow on my android

回眸只為那壹抹淺笑 提交于 2019-12-04 20:44:02
I'm developing function of translating one video into another with additional effects for each frame. I decided to use opengl-es for applying effects on each frame. My input and output videos are in MP4 using H.264 codec. I use MediaCodec API (android api 18+) for decoding H.264 into the opengl texture, then draw on the surface using this texture with my shader. I thought that using MediaCodec with H.264 will do hardware decoding on android and it will be fast. But appeared that it is not. Recoding small 432x240 15 seconds video consumed 28 seconds of total time! Please, take a look at my code

Android Precise seeking of video

陌路散爱 提交于 2019-12-03 08:17:42
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 snippet (based on google/grafika 's MoviePlayer): extractor.seekTo((long) seekTarget[threadNr],

Use MediaCodec and MediaExtractor to decode and code video

放肆的年华 提交于 2019-12-03 03:41:34
I need to decode a video into a sequence of bitmaps, such that I am able to modify them, and then compress them back to a video file in android. I plan to manage this by using getFrameAtTime and saving it to an image sequence. Then I can modify images in the sequence and code it back to a movie. But I have two problem with this: First, as I read it, the getFrameAtTime is for creating thumbnails and will not guarantee returning the correct frame. This makes the video laggy. Secondly, saving the images and reading it back takes a long time. I read that the proper way of doing the decode is with

MediaExtractor does not understand audio/aacp streams

吃可爱长大的小学妹 提交于 2019-12-02 16:51:55
问题 I have my own MediaDataSource : class MyDataSource extends MediaDataSource { private static final String TAG = "MyDataSource"; private HttpURLConnection connection; private BufferedInputStream inputStream; MyDataSource(@NonNull URL streamURL) throws Throwable { this.connection = (HttpURLConnection) streamURL.openConnection(); this.connection.setRequestMethod("GET"); this.connection.addRequestProperty("Icy-Metadata", "0"); this.connection.connect(); int responseCode = this.connection

MediaExtractor does not understand audio/aacp streams

岁酱吖の 提交于 2019-12-02 09:29:46
I have my own MediaDataSource : class MyDataSource extends MediaDataSource { private static final String TAG = "MyDataSource"; private HttpURLConnection connection; private BufferedInputStream inputStream; MyDataSource(@NonNull URL streamURL) throws Throwable { this.connection = (HttpURLConnection) streamURL.openConnection(); this.connection.setRequestMethod("GET"); this.connection.addRequestProperty("Icy-Metadata", "0"); this.connection.connect(); int responseCode = this.connection.getResponseCode(); if (responseCode != 200) throw new IOException("http response code " + responseCode); for