mediacodec

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

淺唱寂寞╮ 提交于 2019-12-18 09:09:08
问题 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

VP8 Encoding Nexus 5 returns empty/0-Frames

依然范特西╮ 提交于 2019-12-18 07:18:12
问题 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: //

VP8 Encoding Nexus 5 returns empty/0-Frames

风格不统一 提交于 2019-12-18 07:18:02
问题 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: //

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

Multiple instances of MediaCodec used as video encoder in Android

佐手、 提交于 2019-12-18 04:24:17
问题 Is it possible to use two Android MediaCodec instances as video encoder to encode two videos simultaneously? I know that MediaCodec itself can have multiple instances, for video/audio encoding/decoding. But is there any restriction on hardware/Android version on encoding multiple videos, besides the impact of performance? More specifically, if considering only Android version 4.3 or higher, is multiple instances of video encoder valid or still be device-dependent? 回答1: From my experience it

How to initialize MediaFormat to configure a MediaCodec to decode raw AAC data?

扶醉桌前 提交于 2019-12-18 04:23:17
问题 I have a strange issue with my StreamPlayer and I need any help I can get. The main goal I need to achieve is StreamPlayer which is able to play back MPEG-2 Transport Streams with smallest possible latency. For this I am following this approach: The stream is parsed by a Java based TS Parser. I have implemented a TSExtractor which is similar to the MediaExtractor and which works fine. I can receive all the media samples for a selected track the same way it is possible using the MediaExtractor

MediaMuxer video file size reducing (re-compress, decrease resolution)

£可爱£侵袭症+ 提交于 2019-12-17 23:42:26
问题 I'm looking for efficient way to reduce some video weight (as a File , for upload) and obvious answer for that is: lets reduce resolution! (fullHD or 4K not needed, simple HD is sufficient for me) I've tried lot of ways which should work through lot of APIs (needed 10) and best way was using android-ffmpeg-java, BUT... on my pretty fast almost-current flagship device whole process lasts about length_of_video*4 seconds and also this lib weight is 9 Mb, this amount increases my app size... No

Render Bitmap frames to Surface for encoding

为君一笑 提交于 2019-12-17 20:27:05
问题 My goal is to take in a M4V video file, decode a segment of the video as PNG frames, modify these frames, and re-encode the trimmed video (also to M4V). The workflow is like so: [Input Video] -> Export Frames -> Modify Frames -> Encode Frames -> [Output Video] . For the decode process, I have been referencing the bigflake examples. Using the ExtractMpegFramesTest example code I was able to generate Bitmap frames from an .m4v file and export frames as PNG files. Now I am attempting the re

Controlling Frame Rate of VirtualDisplay

痞子三分冷 提交于 2019-12-17 19:52:10
问题 I'm writing an Android application, and in it, I have a VirtualDisplay to mirror what is on the screen and I then send the frames from the screen to an instance of a MediaCodec . It works, but, I want to add a way of specifying the FPS of the encoded video , but I'm unsure how to do so. From what I've read and experimented with, dropping encoded frames (based on the presentation times) doesn't work well as it ends up with blocky/artifact ridden video as opposed to a smooth video at a lower

Compress Videos using android MediaCodec api

跟風遠走 提交于 2019-12-17 17:59:38
问题 I want to compress locally saved video file to a smaller size in order to upload to a server. Since i used MediaCodec , i have found some tips to compress video . Here are the steps that i followed 1) . Extracted the media file using MediaExrtactor and Decoded it. 2) . Creates the Encoder with required file format 3) . Create muxer to save file in local storage. (not complete) Question : But i dont know how to encode the already decoded stream and save the stream in to the local storage using