回顾
继上一篇如何在 Ubuntu 中编译 VLC-Android 开源项目, 已经成功的编译了 vlc-Android, 并且也编译出了对应版本的 libvlc-xx.aar
所需环境
项目使用的 rtsp 视频流, 采用的是海康的摄像头
Android studio 最新版本
java jdk 1.8
其他...
搭建工程
首先打开 Android studio, 新建一个项目, 输入项目的名称和包名, 就 ok 了.
然后复制编译好的 libvlc-xx.aar 到 libs 目录下
我的工程目录结构如下
工程目录
还需要在 build.gradle 文件做修改, 如下
- apply plugin: 'com.android.application'
- Android {
- compileSdkVersion 27
- buildToolsVersion '27.0.3'
- defaultConfig {
- applicationId "com.cayden.face"
- minSdkVersion 19
- targetSdkVersion 27
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
- }
- Android {
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- }
- repositories {
- flatDir {
- dirs 'libs'
- }
- maven {
- url "http://dl.bintray.com/jlmd/maven"
- }
- }
- dependencies {
- implementation fileTree(include: ['*.jar'], dir: 'libs')
- implementation 'com.android.support:appcompat-v7:27.1.1'
- implementation 'com.android.support.constraint:constraint-layout:1.1.3'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
- compile(name: 'libvlc-3.0.0', ext: 'aar')
- implementation files('libs/androidutils.jar')
- }
最后运行如图所示
运行如图
项目源码
https://github.com/cayden/facesample
本项目主要基于 vlc 来播放流媒体视频
主要包含以下内容
1, 使用已经编译的 libvlc 来播放流媒体视频
2, 使用 MTCNN 进行人脸识别并标记人脸
3, 保存标记的人脸图片
4, 使用 FACENET 进行人脸比对
未完待续...
- v1.0.0
- 1, added libvlc
- 2, support for playing rtsp video stream
来源: http://www.jianshu.com/p/a5771917135e