├── FrameGrabber ├── .gitignore ├── res │ ├── values │ │ ├── strings.xml │ │ └── styles.xml │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── values-v11 │ │ └── styles.xml │ └── values-v14 │ │ └── styles.xml ├── libs │ └── android-support-v4.jar ├── .classpath ├── AndroidManifest.xml ├── src │ └── com │ │ └── tam │ │ ├── gl │ │ ├── GLUtil.java │ │ ├── GLHelper.java │ │ └── TextureRender.java │ │ ├── utils │ │ └── BitmapUtil.java │ │ └── media │ │ ├── FrameGrabber.java │ │ └── VideoDecoder.java ├── project.properties ├── proguard-project.txt └── .project ├── FrameGrabberTest ├── .gitignore ├── ic_launcher-web.png ├── assets │ └── frameCount.mp4 ├── libs │ └── android-support-v4.jar ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── menu │ │ └── main.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── layout │ │ └── activity_main.xml ├── .classpath ├── project.properties ├── proguard-project.txt ├── .project ├── AndroidManifest.xml └── src │ └── com │ └── tam │ └── gltest │ └── MainActivity.java ├── .gitignore └── README.md /FrameGrabber/.gitignore: -------------------------------------------------------------------------------- 1 | gen/* 2 | bin/* 3 | -------------------------------------------------------------------------------- /FrameGrabberTest/.gitignore: -------------------------------------------------------------------------------- 1 | gen/* 2 | bin/* 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | FrameGrabber/gen/* 2 | FrameGrabber/bin/* 3 | -------------------------------------------------------------------------------- /FrameGrabberTest/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabberTest/ic_launcher-web.png -------------------------------------------------------------------------------- /FrameGrabber/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FrameGrabber 4 | 5 | 6 | -------------------------------------------------------------------------------- /FrameGrabberTest/assets/frameCount.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabberTest/assets/frameCount.mp4 -------------------------------------------------------------------------------- /FrameGrabber/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabber/libs/android-support-v4.jar -------------------------------------------------------------------------------- /FrameGrabberTest/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabberTest/libs/android-support-v4.jar -------------------------------------------------------------------------------- /FrameGrabber/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabber/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /FrameGrabber/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabber/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /FrameGrabber/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabber/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /FrameGrabberTest/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabberTest/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /FrameGrabberTest/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabberTest/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /FrameGrabberTest/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabberTest/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /FrameGrabberTest/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kswlee/FrameGrabber/HEAD/FrameGrabberTest/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /FrameGrabberTest/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /FrameGrabberTest/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /FrameGrabberTest/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FrameGrabberTest 5 | Settings 6 | Hello world! 7 | 8 | 9 | -------------------------------------------------------------------------------- /FrameGrabberTest/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /FrameGrabberTest/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /FrameGrabber/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /FrameGrabberTest/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | FrameGrabber 2 | ============ 3 | 4 | An alternative solution to replace the getFrameAt method of Android MediaMetadataRetriever. FrameGrabber uses MediaCodec to decode video frame and use OpenGL to convert the video frame as RGB Bitmap. As Android MediaMetadataRetriever does not guarantee to return result when calling getFrameAtTime, this FrameGrabber can be used to extract video frame with frame accuracy. 5 | -------------------------------------------------------------------------------- /FrameGrabber/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /FrameGrabberTest/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /FrameGrabber/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /FrameGrabberTest/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /FrameGrabber/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /FrameGrabber/src/com/tam/gl/GLUtil.java: -------------------------------------------------------------------------------- 1 | package com.tam.gl; 2 | 3 | import android.opengl.EGL14; 4 | import android.util.Log; 5 | 6 | public class GLUtil { 7 | /** 8 | * Checks for EGL errors. 9 | */ 10 | public static void checkEglError(String msg) { 11 | boolean failed = false; 12 | int error; 13 | while ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) { 14 | Log.e("TAG", msg + ": EGL error: 0x" + Integer.toHexString(error)); 15 | failed = true; 16 | } 17 | if (failed) { 18 | throw new RuntimeException("EGL error encountered (see log)"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /FrameGrabberTest/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | android.library.reference.1=../FrameGrabber 16 | -------------------------------------------------------------------------------- /FrameGrabber/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | android.library=true 16 | android.library.reference.1=../../../../../android_projects/VH2/VH/videoengine/HtcMediaLibrary 17 | -------------------------------------------------------------------------------- /FrameGrabber/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /FrameGrabberTest/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /FrameGrabber/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /FrameGrabberTest/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /FrameGrabber/src/com/tam/utils/BitmapUtil.java: -------------------------------------------------------------------------------- 1 | package com.tam.utils; 2 | 3 | import java.io.FileNotFoundException; 4 | import java.io.FileOutputStream; 5 | import java.io.IOException; 6 | 7 | import android.graphics.Bitmap; 8 | import android.graphics.Bitmap.CompressFormat; 9 | import android.graphics.Matrix; 10 | 11 | public class BitmapUtil { 12 | public static void saveBitmap(Bitmap bmp, String path) { 13 | try { 14 | FileOutputStream fos = new FileOutputStream(path); 15 | bmp.compress(CompressFormat.JPEG, 100, fos); 16 | fos.close(); 17 | } catch (FileNotFoundException e) { 18 | e.printStackTrace(); 19 | } catch (IOException e) { 20 | e.printStackTrace(); 21 | } 22 | } 23 | 24 | public static Bitmap flip(Bitmap src) { 25 | Matrix matrix = new Matrix(); 26 | matrix.preScale(1.0f, -1.0f); 27 | return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /FrameGrabber/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | FrameGrabber 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /FrameGrabberTest/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | FrameGrabberTest 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /FrameGrabberTest/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /FrameGrabberTest/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 21 | 22 |