mediacodec

How to use MediaCodec to decode data from RTSP server?

梦想的初衷 提交于 2019-12-21 15:04:51
问题 I tried setDataSource() in MediaExtractor class but it doesn't work with RTSP path. I can use the same path with MediaPlayer class and it works but it is very important for me to use MediaCodec class instead. I think Android doesn't have any RTSP API I could use nor I can find any RTSP libraries for Android. Is there a relatively easy way of feeding video stream from RTSP server into MediaCodec class? 回答1: No easy way. I ended up using this project: https://code.google.com/p/android-rtsp

I can't capture android screen using adb screen record tool

空扰寡人 提交于 2019-12-21 10:51:01
问题 I have a nexus 4 with android KitKat. I tried screen recording using the following commands: adb shell screenrecord --verbose /sdcard/demo.mp4 adb shell screenrecord --bit-rate 8000000 --time-limit 30 /sdcard/kitkat.mp4 Both times, the commands returned this message: Main display is 768x1280 @60.00fps (orientation=0) Configuring recorder for 768x1280 video at 4.00Mbps ERROR: unable to create video/avc codec instance In the debug console I had open in AndroidStudio, the following log messages

Performance variation of encoder using MediaCodec encode from surface

偶尔善良 提交于 2019-12-21 05:57:23
问题 I render a texture to both display and a codec input surface (from where an encoder uses it). There is a large performance variation when the texture is rendered to the display surface, and when it is rendered to the input surface of the encoder, but only on some devices, like S3 Galaxy (~10 times slower to render to encoder surface). On other devices, the speed is similar (S4, Nexus4, etc). A similar scenario can be demonstrated with Grafika and Record GL app activity. (FBO blit x2) The fps

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

Android MediaCodec not working [closed]

一世执手 提交于 2019-12-19 04:42:13
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm trying to directly decode the H.264 encoded camera output of the Raspberry Pi camera module on an android device, but my code fails to properly decode the file. I get no output, and as the last frame I get a garbled image. As I am parsing the input file myself (it is an H.264 byte-stream) into NAL units, I'm

Android Extract Decode Encode Mux Audio

北战南征 提交于 2019-12-18 16:13:32
问题 I am trying to adapt the code found in ExtractDecodeEditEncodeMuxTest.java in order to extract audio and video from a mp4 recorded via Cordova's device.capture.captureVideo, decode the audio, edit the decoded audio samples, encode the audio, and mux the audio back with the video and save as an mp4 again. My first attempt is simply to extract, decode, encode and mux audio without trying to edit any of the audio samples - if I can do this I am fairly certain that I can edit the decoded samples

How to get bitmap (frames) from video using MediaCodec

限于喜欢 提交于 2019-12-18 12:34:16
问题 I'm trying to get all frames from video file using MediaCodec. If I try display video on SurfaceView, everything is ok. But if surface is null, and when I try get Bitmap from byte array, alwaus get null or runtime exception. This is my code: private class PlayerThread extends Thread { private MediaExtractor extractor; private MediaCodec decoder; private Surface surface; public PlayerThread(Surface surface) { this.surface = surface; } @Override public void run() { extractor = new

Android MediaCodec: Reduce mp4 video size

↘锁芯ラ 提交于 2019-12-18 11:51:38
问题 I am looking for a way to "compress" an mp4 video. To achieve this, I want to reduce the resolution of the video and / or reduce FPS. After long research, I think the way to do it is to use MediaCodec and related APIs as follows : -> MediaExtractor to extract encoded media data from a mp4 file. -> MediaCodec (Decoder): Decode each frame for later processing. -> MediaCodec (Encoder): At this point, I guess that's where we should establish MediaFormat parameters such as video resolution, which

Getting QualComm encoders to work via MediaCodec API

会有一股神秘感。 提交于 2019-12-18 11:43:13
问题 I am trying to do hardware encoding (avc) of NV12 stream using Android MediaCodec API. When using OMX.qcom.video.encoder.avc, resolutions 1280x720 and 640x480 work fine, while the others (i.e. 640x360, 320x240, 800x480) produce output where chroma component seems shifted (please see snapshot). I have double-checked that the input image is correct by saving it to a jpeg file. This problem only occurs on QualComm devices (i.e. Samsung Galaxy S4). Anyone has this working properly? Any additional

Android MediaCodec Encode and Decode In Asynchronous Mode

此生再无相见时 提交于 2019-12-18 10:29:22
问题 I am trying to decode a video from a file and encode it into a different format with MediaCodec in the new Asynchronous Mode supported in API Level 21 and up (Android OS 5.0 Lollipop). There are many examples for doing this in Synchronous Mode on sites such as Big Flake, Google's Grafika, and dozens of answers on StackOverflow, but none of them support Asynchronous mode. I do not need to display the video during the process. I believe that the general procedure is to read the file with a