vlc android的编译及截图,录制视频等功能
来源:互联网 发布:淘宝网天猫花短裙半身 编辑:程序博客网 时间:2024/05/16 01:20
编译的环境是ubuntu 12.04,要安装好java,配置好环境变量,按照http://wiki.videolan.org/AndroidCompile配置好,就可以编译了。
- export JAVA_HOME=/home/sunlit/jdk1.6.0_38/
- export PATH=$JAVA_HOME/bin:$PATH
- export classPath=/home/sunlit/jdk1.6.0_38/
- export ANDROID_SDK=/home/sunlit/sdk
- export ANDROID_NDK=/home/sunlit/android-ndk-r8c
- export PATH=$PATH:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools
- export ANDROID_ABI=armeabi-v7a
2014/03/26日更新开始
在ubuntu下编译vlc https://wiki.videolan.org/AndroidCompile/
安装工具
sudo apt-get install ant autoconf automake autopoint cmake gawk gcc g++ libtool m4 patch pkg-config ragel subversion yasm git
切换vlc android 版本到 0.1.x-bugfix
git clone git://git.videolan.org/vlc-ports/android.git
cd android
git branch -r
git checkout 0.1.x-bugfix
2014/03/26日更新结束
为了在android vlc上增加截图和保存视频的功能
截图:
要对android/configure.sh进行修改 删掉其中的-disable-sout
另外保存图片为png格式,需要让ffmpeg增加-enable-encoder=png的编码器(在android/vlc/contrib/src/ffmpeg/rules.mak中修改)
2014/03/26日更新开始
FFMPEGCONF += --disable-encoders --disable-muxers
->FFMPEGCONF += --disable-encoders --enable-encoder=png
2014/03/26日更新结束
在libvlcjni.c中增加函数:
- jboolean Java_org_videolan_libvlc_LibVLC_takeSnapShot(JNIEnv *env, jobject thiz,jint number, jstring path, jint width,jint height)
- {
- jboolean isCopy;
- libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
- /* Get C string */
- const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
- if (mp)
- if(libvlc_video_take_snapshot(mp, (int)number,psz_path , (int)width,(int)height)==0)
- return JNI_TRUE;
- return JNI_FALSE;
- }
在LibVlc.java中增加native函数的接口
- private native boolean takeSnapShot( int num, String file, int width, int height);
- public boolean takeSnapShot(String file, int width, int height) {
- return takeSnapShot(0, file, width, height);
- }
编译后就可以使用。调用LibVlc.java中的takeSnapShot就可以实现截图了。
录制视频:
2014/03/26日更新开始
- 打上视频录制的补丁 https://patches.videolan.org/patch/606/
- 把patch文件放到/android/vlc中 使用命令patch -p1 < xxxx.patch 查出其中的失败的地方 手动修改
- 修改vlc-android/jni/libvlcjni.c在文件末尾添加
- jboolean Java_org_videolan_libvlc_LibVLC_takeSnapShot(JNIEnv *env, jobject thiz,jint number, jstring path, jint width,jint height)
- {
- jboolean isCopy;
- libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
- /* Get C string */
- const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
- if (mp)
- if(libvlc_video_take_snapshot(mp, (int)number,psz_path , (int)width,(int)height)==0)
- return JNI_TRUE;
- return JNI_FALSE;
- }
- jboolean Java_org_videolan_libvlc_LibVLC_videoRecordStart(JNIEnv *env, jobject thiz,jstring path)
- {
- jboolean isCopy;
- libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
- /* Get C string */
- const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy);
- //const char* psz_filename=(*env)->GetStringUTFChars(env, filename, &isCopy);
- if (mp)
- if(libvlc_media_player_record_start(mp,psz_path)==0)
- return JNI_TRUE;
- return JNI_FALSE;
- }
- jboolean Java_org_videolan_libvlc_LibVLC_videoRecordStop(JNIEnv *env, jobject thiz)
- {
- jboolean isCopy;
- libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
- /* Get C string */
- if (mp)
- if(libvlc_media_player_record_stop(mp)==0)
- return JNI_TRUE;
- return JNI_FALSE;
- }
- jboolean Java_org_videolan_libvlc_LibVLC_videoIsRecording(JNIEnv *env, jobject thiz)
- {
- jboolean isCopy;
- libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
- if (mp)
- if(libvlc_media_player_is_recording(mp))
- return JNI_TRUE;
- return JNI_FALSE;
- }
- jboolean Java_org_videolan_libvlc_LibVLC_videoIsRecordable(JNIEnv *env, jobject thiz)
- {
- jboolean isCopy;
- libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
- if (mp)
- if(libvlc_media_player_is_recordable(mp))
- return JNI_TRUE;
- return JNI_FALSE;
- }
- jint Java_org_videolan_libvlc_LibVLC_getState(JNIEnv *env, jobject thiz)
- {
- libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
- if (mp){
- libvlc_state_t state=libvlc_media_player_get_state(mp);
- return (jint)state;
- }
- else
- return -1;
- }
2014/03/26日更新结束
送佛送到西 源码下载地址http://pan.baidu.com/s/17Y4dO
0 0
- vlc android的编译及截图,录制视频等功能
- vlc android的编译及截图,录制视频等功能
- vlc android的编译及截图,录制视频等功能
- vlc android的编译及截图,录制视频等功能
- 基于 vlc android截图录制视频等功能
- 基于 vlc android截图录制视频等功能
- vlc for android录制视频与截图
- vlc for android录制视频与截图
- android vlc截图与视频录制问题
- vlc android 截图和录制视频(vlc0.9.9)
- VLC Android录制视频
- VLC Android录制视频
- linux下编译vlc for android 添加 截图(去掉了画中画和路径提示)及录像功能
- androidstudio视频录制和截图功能
- vlc for android的编译及使用
- Android系统自带的MediaRecorder结合Camera实现视频录制及播放功能。
- Android仿微信小视频录制功能
- IOS VLC编译步骤(包含移植和截图功能)
- RequireJS:javascript模块化工具基本用法详解
- Json返回/Date(1429175003077)/格式日期转换
- 将博客搬至CSDN
- 【MFC】显示开机动画
- 常用工具和插件,常见功能解决方案
- vlc android的编译及截图,录制视频等功能
- Tez的相关介绍
- 【LeetCode】Number of Islands
- 微信公众帐号开发教程第1篇-引言
- Xcode6恢复出厂设置(reset Xcode to its original state)
- 第一个空白图形程序(未完)
- S3C2440上LCD驱动 (FrameBuffer)实例开发讲解
- vlc-android源码编译过程记录
- 清华这个宝塔的基座——“人文日新”一解