Android FFmpeg 视频信息获取及压缩
来源:互联网 发布:教散打的软件 编辑:程序博客网 时间:2024/06/11 04:32
FFmpeg移植到Android:
http://blog.csdn.net/leixiaohua1020/article/details/47056365
获取视频信息:
// java string -> c char* (JNI)
const char* filePath = (*env)->GetStringUTFChars(env,jFilePath,JNI_FALSE);
int angle = -1;
//1.注册所有组件
av_register_all();
//封装格式上下文
AVFormatContext *pFormatCtx = avformat_alloc_context();
//2.打开输入视频文件
if(avformat_open_input(&pFormatCtx, filePath, NULL,NULL) != 0){
LOGE("%s","无法打开输入视频文件");
return -1;
}
//3.获取视频文件信息
if(avformat_find_stream_info(pFormatCtx, NULL) < 0){
LOGE("%s","无法获取视频信息");
return -1;
}
//获取视频流的索引位置
int v_stream_idx = -1;
int i = 0;
for(i = 0; i < pFormatCtx->nb_streams; i++){
if(pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO){
v_stream_idx = i;
break;
}
}
//获取视频方向数据
AVDictionaryEntry *tag = NULL;
tag = av_dict_get(pFormatCtx->streams[v_stream_idx]->metadata, "rotate", tag, 0);
if(tag != NULL){
angle = atoi(tag->value);
LOGE("%d", angle);
}
//分辨率
LOGE("%d", pFormatCtx->streams[v_stream_idx]->codecpar->width);
LOGE("%d", pFormatCtx->streams[v_stream_idx]->codecpar->height);
avformat_free_context(pFormatCtx);
其他信息看C源码,都有解释.
视频压缩本质是视频转码,将视频码率,帧速,分辨率等降低 视频体积自然下降
使用方法见:http://blog.csdn.net/leixiaohua1020/article/details/47056365
自己调试的结果,满足清晰度效率上最高的执行语句:
ffmpeg -y -i %s -r 10 -b:v 1280k %s
(降低分辨率会显著增加执行时间)
- Android FFmpeg 视频信息获取及压缩
- FFmpeg获取视频信息的对应字段
- php 调用ffmpeg获取视频信息
- 使用FFmpeg接口获取视频信息
- PHP使用FFmpeg获取视频信息
- php 调用ffmpeg获取视频信息
- FFMPEG库压缩视频
- FFmpeg压缩MP4视频
- ffmpeg无压缩视频
- 怎样用ffmpeg 压缩视频
- android 获取视频缩略图终极解决方案(ffmpeg)
- ffmpeg源码分析及录制/压缩/上传视频等
- java调用ffmpeg获取视频信息函数代码
- ffmpeg 截图 视频信息
- ffmpeg查看视频信息
- 用FFmpeg玩转Android视频录制与压缩
- 利用FFmpeg玩转Android视频录制与压缩
- 利用FFmpeg玩转Android视频录制与压缩
- 使用xutils 上传 数组记录
- 用1.4.10 Synergy配置Win7(64位)和Ubuntu(64位)
- ios 启动图尺寸 及icon尺寸
- react
- php的api数据接口书写实例
- Android FFmpeg 视频信息获取及压缩
- SQL Server Profiler使用教程
- Docker使用非root用户
- java多线程和并发性介绍
- cookie入门介绍
- JS内错误提示
- 单链表的翻转
- iOS--文件下载
- android 画虚线,虚线不能正常显示问题