MediaCodec sample code
来源:互联网 发布:手机电销软件 编辑:程序博客网 时间:2024/06/03 06:21
1.简单的decoder和encoder
https://github.com/taehwandev/MediaCodecExample
2.encode a set of Bitmaps that I have into an h264
http://stackoverflow.com/questions/17096726/how-to-encode-bitmaps-into-a-video-using-mediacodec?rq=1
mMediaCodec = MediaCodec.createEncoderByType("video/avc");mMediaFormat = MediaFormat.createVideoFormat("video/avc", 320, 240);mMediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, 125000);mMediaFormat.setInteger(MediaFormat.KEY_FRAME_RATE, 15);mMediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar);mMediaFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 5);mMediaCodec.configure(mMediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);mMediaCodec.start();mInputBuffers = mMediaCodec.getInputBuffers();ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();image.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); // image is the bitmapbyte[] input = byteArrayOutputStream.toByteArray();int inputBufferIndex = mMediaCodec.dequeueInputBuffer(-1);if (inputBufferIndex >= 0) { ByteBuffer inputBuffer = mInputBuffers[inputBufferIndex]; inputBuffer.clear(); inputBuffer.put(input); mMediaCodec.queueInputBuffer(inputBufferIndex, 0, input.length, 0, 0);}
3.编码camera
http://blog.csdn.net/dxpqxb/article/details/8805110
4.
Android: MediaCodec视频文件硬件解码,高效率得到YUV格式帧,快速保存JPEG图片(不使用OpenGL)(附Demo)
https://www.polarxiong.com/archives/Android-MediaCodec%E8%A7%86%E9%A2%91%E6%96%87%E4%BB%B6%E7%A1%AC%E4%BB%B6%E8%A7%A3%E7%A0%81-%E9%AB%98%E6%95%88%E7%8E%87%E5%BE%97%E5%88%B0YUV%E6%A0%BC%E5%BC%8F%E5%B8%A7-%E5%BF%AB%E9%80%9F%E4%BF%9D%E5%AD%98JPEG%E5%9B%BE%E7%89%87-%E4%B8%8D%E4%BD%BF%E7%94%A8OpenGL.html
0 0
- MediaCodec sample code
- MediaCodec Sample
- sample code
- JDK 1.5 Sample Code
- Events Sample Code(1)
- Events Sample Code(2)
- logic font sample code
- MetaWeblogAPI C# Code Sample
- JavaScript Sample Code
- XMl - xerces code sample
- java concurrent code sample
- Sample CRC Code
- sample code of webview
- Spring AOP Sample Code
- sample transaction code
- File Output sample code
- Thread sample code
- MKMapView Sample Code
- Android中创建so库存储密钥,NDK环境搭建与jni介绍
- Git—创建版本库
- iOS对象方法和类方法的区别与调用方式
- arttemplate 讀取map轉成的json數據
- Windows tcp客户端程序 设置非阻塞
- MediaCodec sample code
- using 三种使用方式
- 在客户端程序中使用OpenSSL来实现HTTPS在证书认证上的一些分析
- 数据结构之HashMap的实现
- Linux学习总结(四)——标准I/O与文件I/O
- 工资计算-CCF往届题
- Altium Designer入门
- 移动H5开发基础
- rxJava,rxAndroid实现1秒内只能进行一次有效点击