mediacodec

How to add Audio to Video while Recording [ContinuousCaptureActivity] [Grafika]

谁说我不能喝 提交于 2019-11-30 04:48:21
问题 I implement Video recording using ContinuousCaptureActivity.java . it's work perfectly. Now i want to add Audio in this video. I know using MediaMuxer it is possible to add audio in video. But the problem is i don't know how to i use MediaMuxer . Also if you have any other solution without MediaMuxer then share with me any link or doc. also i have demo AudioVideoRecordingSample . But i don't understand how to i merge this with my code. please explain to me if anyone knows. Thanks in Advance.

MediaCodec H264 Encoder not working on Snapdragon 800 devices

▼魔方 西西 提交于 2019-11-29 22:39:24
I have written a H264 Stream Encoder using the MediaCodec API of Android. I tested it on about ten different devices with different processors and it worked on all of them, except on Snapdragon 800 powered ones (Google Nexus 5 and Sony Xperia Z1). On those devices I get the SPS and PPS and the first Keyframe, but after that mEncoder.dequeueOutputBuffer(mBufferInfo, 0) only returns MediaCodec.INFO_TRY_AGAIN_LATER. I already experimented with different timeouts, bitrates, resolutions and other configuration options, to no avail. The result is always the same. I use the following code to

Using MediaCodec asynchronously to decode and render a Video File

谁都会走 提交于 2019-11-29 18:25:45
Recently started toying around with the Android Media Codec class to render the video frames from a Native C++ application. Was able to successfully decode and render both audio and video streams using Android MediaCodec class using synchronous approach[queueInputBuffer and deququeInputBuffer]. Android has a good reference example of how to do it in Native C++ Application. Ex : SimplePlayer.cpp Now i have started with the implementation of asynchronous approach using callbacks and feed the input streams to codec in those callbacks[OnInputBufferAvailable/ OnOutPutBufferAvailable]. I was

How to get frame by frame from MP4? (MediaCodec)

你。 提交于 2019-11-29 15:40:58
Actually I am working with OpenGL and I would like to put all my textures in MP4 in order to compress them. Then I need to get it from MP4 on my Android I need somehow decode MP4 and get frame by frame by request. I found this MediaCodec https://developer.android.com/reference/android/media/MediaCodec and this MediaMetadataRetriever https://developer.android.com/reference/android/media/MediaMetadataRetriever But I did not see approach how to request frame by frame... If there is someone who worked with MP4, please give me a way where to go. P.S. I am working with native way (JNI), so does not

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

MediaCodec KEY_FRAME_RATE seems to be ignored

蹲街弑〆低调 提交于 2019-11-29 14:48:26
问题 I am trying to modify the source for screenrecord in android 4.4 and lower the captured frame rate, but no matter what value I put in: format->setFloat("frame-rate", 5); the result is always the same ( a very high frame rate ) Is the encoder ignoring this property ? how can I control the frame rate ? 回答1: The frame-rate value is not ignored, but it doesn't do what you want. The combination of frame-rate and i-frame-interval determines how often I-frames (also called "sync frames") appear in

VP8 Encoding Nexus 5 returns empty/0-Frames

社会主义新天地 提交于 2019-11-29 12:49:46
I'm trying to encode my camera feed to VP8. The problem is: when I get the frame from the output buffer, the byte array is always different size but all entries are 0. Here's the code where I grab the frame and print it: while (true) { try { encoderIndex = mEncoder.dequeueOutputBuffer(encoderOutputInfo, timeOut); } catch (Exception e) { e.printStackTrace(); } switch (encoderIndex) { case MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED: // something break; case MediaCodec.INFO_OUTPUT_FORMAT_CHANGED: // something else break; case MediaCodec.INFO_TRY_AGAIN_LATER: // something completely different break;

Resizing surface view for aspect ratio change in video display in android

こ雲淡風輕ζ 提交于 2019-11-29 12:39:19
问题 I am working on a video conferencing project. My video display is using surface view. Now during a video call there is a chance of aspect ratio change for the incoming frames. So i have tried the following code for it public void surfaceResize() { // WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Point size = new Point(); int screenWidth = 0; //Get the SurfaceView layout parameters float aspectRatio = (float) recv_frame_width / recv_frame_height; if

Recording a Surface using MediaCodec

时间秒杀一切 提交于 2019-11-29 11:52:23
问题 So, In my application, I am able to show effects(like blur filter, gaussian) to video that comes from Camera using GPUImage library. Basically, I (library) will take the input from the Camera, get's the raw byte data, converts it into RGBA format from YUV format, then applies effects to this image and displays on the Surface of GLSurfaceView using OpenGL. finally, to the user, it looks like a video with effects applied. Now I want to record the frames of Surface as a video using MediaCodec

Handle MediaCodec video with dropped frames

让人想犯罪 __ 提交于 2019-11-29 09:14:34
I'm currently doing fast precise seeking using MediaCodec . What I currently do to skip frame by frame is, I first get the total frames: mediaInfo.totalFrames = videoTrack.getSamples().size(); Then I get the length of the video file: mediaInfo.durationUs = videoTrack.getDuration() * 1000 *1000 / timeScale; //then calling: public long getDuration() { if (mMediaInfo != null) { return (int) mMediaInfo.durationUs / 1000; // to millisecond } return -1; } Now, when I want to get the next frame I call the following: mNextFrame.setOnClickListener(new View.OnClickListener() { @Override public void