Skip to content

Instantly share code, notes, and snippets.

@bryanwang
bryanwang / EncodeAndMuxTest.java
Last active December 27, 2015 19:49
EncodeAndMuxTest.java (requires 4.3, API 18) Generates a movie using OpenGL ES. Uses MediaCodec to encode the movie in an H.264 elementary stream, and MediaMuxer to convert the stream to a .MP4 file. This was written as if it were a CTS test, but is not part of CTS. It should be straightforward to adapt the code to other environments.
/*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@bryanwang
bryanwang / ExtractMpegFramesTest.java
Created November 9, 2013 02:43
EncodeDecodeTest.java (requires 4.3, API 18) CTS test. There are three tests that do essentially the same thing, but in different ways. Each test will: Generate video frames Encode frames with AVC codec Decode generated stream Test decoded frames to see if they match the original The generation, encoding, decoding, and checking are near-simultan…
/*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
OpenCV 是一个开源的跨平台计算机视觉库,实现了图像处理和计算机视觉方面的很多通用算法。
最近试着在MacOS和iOS上使用OpenCV,发现网上关于在MacOS和iOS上搭建OpenCV的资料很少。好不容易搜到些资料,却发现由于OpenCV和XCode的版本更新,变得不再有用了。有些问题费了我很多时间,在此总结分享给大家,希望后来人少走些弯路。
可以预见到,随着XCode和OpenCV的版本更新,本文可能不再有效了。
所以特此注明,文本介绍的搭建方法仅针对于 XCode4.5.1 和 OpenCV 2.4.2版本。
(2013-6-22)更新: 我在XCode4.6.2 和 OpenCV 2.4.5版本的时候重新进行了一次环境搭建,以下内容做了相应调整,应该也是有效的。
@bryanwang
bryanwang / Android MediaCodec
Created November 9, 2013 02:41
The MediaCodec class first became available in Android 4.1 (API 16). In Android 4.3 (API 18), MediaCodec was expanded to include a way to provide input through a Surface (via the createInputSurface method). This allows input to come from camera preview or OpenGL ES rendering. This release also introduced MediaMuxer, which allows the output of th…
Samples
EncodeAndMuxTest.java (requires 4.3, API 18)
Generates a movie using OpenGL ES. Uses MediaCodec to encode the movie in an H.264 elementary stream, and MediaMuxer to convert the stream to a .MP4 file.
This was written as if it were a CTS test, but is not part of CTS. It should be straightforward to adapt the code to other environments.
CameraToMpegTest.java (requires 4.3, API 18)
@bryanwang
bryanwang / CameraToMpegTest.java
Created November 9, 2013 02:42
CameraToMpegTest.java (requires 4.3, API 18) Records video from the camera preview and encodes it as an MP4 file. Uses MediaCodec to encode the movie in an H.264 elementary stream, and MediaMuxer to convert the stream to a .MP4 file. As an added bonus, demonstrates the use of a GLES fragment shader to modify the video as it's being recorded. Thi…
/*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software