mediacodec

Mediacodec, decode byte packet from server and render it on surface

冷暖自知 提交于 2019-12-01 14:37:11
I have some issues with MediaCode. I have 3 components; Decoder, Downloader and Render. And Simple FragmentStreamVideo that initialize the 'SurfaceView' and the 'Downloader'. The other components like the Render and Decoder are initialized in the SurfaceView. Then, a syncronize is done between the Decoder and the Dowloader, implemented by BlockingQueue<String> queue where String = Filename ( Each frame has its file ). Another syncronize between Decode and Render is done by the standard ByteBuffer as stated in documentation. Find below my piece of code. Would be very grateful if you can help.

Nexus 7 2013 mediacodec video encoder garbled output

故事扮演 提交于 2019-12-01 11:15:05
I'm working on an app which encodes a movie using h.264 encoder to gallery and other targets. This app supports variable aspect ratios at output (1:1, 2:3, 3:2, 16:9, 3:4, 4:3). I'm using surface inputs for input/output from the 4.3 API. The app works ok on many devices (tested on S3, Motorola G, Nexus 7 2012, Motorola X), however, I've hit a wall when running it on Nexus 7 2013. Basically, some output resolutions work, some do not. 3:4 (720x960), 2:3 (720x1080) and 16:9 (1280x720) work as intended, but the rest (1:1 (960x960), 3:2 (1080x720) and 4:3 (960x720)) produce an output like this:

How to change MediaCodec encoding bitrate on the fly while streaming in Android?

半腔热情 提交于 2019-12-01 10:38:10
I want to change the encoding bitrate including H264 and AAC by Android MediaCodec dynamically , according to the current network. How to update the encoding bitrate in Android MediaCodec dynamically ? PS: I found PARAMETER_KEY_VIDEO_BITRATE and setParameters is available on API 19 PARAMETER_KEY_VIDEO_BITRATE Change a video encoder's target bitrate on the fly. The value is an Integer object containing the new bitrate in bps. Constant Value: "video-bitrate" setParameters Communicate additional parameter changes to the component instance. Throws IllegalStateException if in the Uninitialized

MediaCodec Encoded video has green bar at bottom and chrominance screwed up

我怕爱的太早我们不能终老 提交于 2019-12-01 09:04:23
I started a project from Grafika and modified it. I've got a framework (not too different from the original) which captures a preview from the Camera and continuously encodes it to a video at the same time both at different resolutions. MediaCodec (for encoding) is configured to use COLOR_FormatSurface in order for us to be able to render to the Surface queried using getInputSurface() using GLES. The media format is set to MIME Type video/avc For most phones, this setup works perfectly. But for a few phones, the encoded video has the chrominance values slightly skewed and a green bar at the

How to change MediaCodec encoding bitrate on the fly while streaming in Android?

亡梦爱人 提交于 2019-12-01 08:46:54
问题 I want to change the encoding bitrate including H264 and AAC by Android MediaCodec dynamically , according to the current network. How to update the encoding bitrate in Android MediaCodec dynamically ? PS: I found PARAMETER_KEY_VIDEO_BITRATE and setParameters is available on API 19 PARAMETER_KEY_VIDEO_BITRATE Change a video encoder's target bitrate on the fly. The value is an Integer object containing the new bitrate in bps. Constant Value: "video-bitrate" setParameters Communicate additional

How to know Android decoder MediaCodec.createDecoderByType(type) is Hardware or software decoder?

↘锁芯ラ 提交于 2019-12-01 07:55:28
Is there a way to find out if the decoder that received using MediaCodec.createDecoderByType(type) is a hardware decoder or a software decoder? There is no real formal flag for indicating whether a codec is a hardware or software codec. In practice, you can do this, though: MediaCodec codec = MediaCodec.createDecoderByType(type); if (codec.getName().startsWith("OMX.google.")) { // Is a software codec } (The MediaCodec.getName() method is available since API level 18. For lower API levels, you instead need to iterate over the entries in MediaCodecList and manually pick the right codec that fits

AVC HW encoder with MediaCodec Surface reliability?

守給你的承諾、 提交于 2019-12-01 07:34:39
I'm working on a Android app that uses MediaCodec to encode H.264 video using the Surface method. I am targeting Android 5.0 and I've followed all the examples and samples from bigflake.com (I started working on this project two years ago, so I kind of went through all the gotchas and other issues). All is working nice and well on Nexus 6 (which uses the Qualcomm hardware encoder for doing this), and I'm able to record flawlessly in real-time 1440p video with AAC audio, in a multitude of outputs (from MP4 local files, upto http streaming). But when I try to use the app on a Sony Android TV

How to determine a video file's framerate with MediaCodec, MediaExtractor or MediaMetadataRetriever?

青春壹個敷衍的年華 提交于 2019-12-01 06:46:14
问题 How to I extract the frame rate of a recorded video file? I know that there is MediaFormat.KEY_FRAME_RATE and that I can access MediaFormat objects through MediaExtractor. However KEY_FRAME_RATE is only available for encoders. Instead I want to find out the frame rate of an already recorded video. Any ideas? 回答1: It looks like there is no way to get framerate through any of official API functions. It might require some extra logic - count times between timestamps or to parse headers info. in

MediaCodec Encoded video has green bar at bottom and chrominance screwed up

£可爱£侵袭症+ 提交于 2019-12-01 06:33:23
问题 I started a project from Grafika and modified it. I've got a framework (not too different from the original) which captures a preview from the Camera and continuously encodes it to a video at the same time both at different resolutions. MediaCodec (for encoding) is configured to use COLOR_FormatSurface in order for us to be able to render to the Surface queried using getInputSurface() using GLES. The media format is set to MIME Type video/avc For most phones, this setup works perfectly. But

AVC HW encoder with MediaCodec Surface reliability?

﹥>﹥吖頭↗ 提交于 2019-12-01 05:19:30
问题 I'm working on a Android app that uses MediaCodec to encode H.264 video using the Surface method. I am targeting Android 5.0 and I've followed all the examples and samples from bigflake.com (I started working on this project two years ago, so I kind of went through all the gotchas and other issues). All is working nice and well on Nexus 6 (which uses the Qualcomm hardware encoder for doing this), and I'm able to record flawlessly in real-time 1440p video with AAC audio, in a multitude of