1.
在工程的jni目录下建ffmpeg-jni.c文件,内容为ffmpeg.c文件的内容,只不过main函数改名为video_gen函数,然后在该.c文件创建一个jni接口,函数如下
- jstring
- Java_com_broventure_video_VideoGenTestActivity_stringFromJNI( JNIEnv* env,
- jobject thiz )
- {
- char str[25];
- int a = 8;
- char *arg[8];
- arg[0] = "ffmpeg";
- arg[1] = "-i";
- arg[2] = "/sdcard/data/%d.jpg";
- arg[3] = "-s";
- arg[4] = "1024x768";
- arg[5] = "-vcodec";
- arg[6] = "mpeg4";
- arg[7] = "/sdcard/data/video.avi";
- //__android_log_print(ANDROID_LOG_INFO, "JNIMsg", "++++++++++++++++");
- __android_log_print(ANDROID_LOG_INFO, "filePath", arg[2]);
- //__android_log_print(ANDROID_LOG_INFO, "int ", stri);
- int ret = video_gen(a,arg);
- __android_log_print(ANDROID_LOG_INFO, "JNIMsg", "==================");
- sprintf(str, "%d", avcodec_version());
- return (*env)->NewStringUTF(env, str);
- }
2. 建立Eclipse工程,导入Eclipse仿真即可。
阅读(2949) | 评论(0) | 转发(0) |