解决安卓调用ffmpeg函数avformat_open_input进行转码出现打不开文件
来源:互联网 发布:淘宝虚假交易怎么清洗, 编辑:程序博客网 时间:2024/05/18 00:11
安卓下通过jni调用ffmpeg解码视频文件,结果在c文件中调用avformat_open_input函数打开视频文件时报错
- 论坛有说是因为ffmpeg版本问题的,但是我3.x.x和2.的都试过一样的打开失败。返回的结果码是-13,但是看源码也没找到-13代表什么。
- 还好找到如下方法将错误信息打印了出来:
int err_code;
char buf[1024];
if ((err_code = avformat_open_input(&pFormatCtx, input_str, NULL, NULL)) != 0) {
av_strerror(err_code, buf, 1024);
LOGE(“Couldn’t open file %s: %d(%s)”, input_str, err_code, buf);
return -1;
}
控制台打印如下:
Couldn’t open file /storage/emulated/legacy/joy/cuc_ieschool.flv: -13(Permission denied) - 原来是因为Permission denied。之前也想过会不会是文件访问权限问题,后来觉得读文件应该不需要吧,而且觉得用c打开文件应该不需要声明权限吧?还是太naive了。
- 在安卓清单文件加上权限:
uses-permission android:name=”android.permission.READ_EXTERNAL_STORAGE”问题果然随风而去。
0 0
- 解决安卓调用ffmpeg函数avformat_open_input进行转码出现打不开文件
- FFMPEG函数之avformat_open_input
- ffmpeg调用 avformat_open_input失败,返回 -2
- ffmpeg调用 avformat_open_input失败,返回 -2
- 安卓调用ffmpeg
- FFMPEG-avformat_open_input
- FFMPEG-avformat_open_input
- FFMPEG-avformat_open_input
- 图解FFMPEG打开媒体的函数avformat_open_input
- FFMpeg分析:第一个函数avformat_open_input
- FFMpeg分析:第一个函数avformat_open_input
- 图解FFMPEG打开媒体的函数avformat_open_input
- 图解FFMPEG打开媒体的函数avformat_open_input
- 图解FFMPEG打开媒体的函数avformat_open_input
- 图解FFMPEG打开媒体的函数avformat_open_input
- 图解FFMPEG打开媒体的函数avformat_open_input
- 图解FFMPEG打开媒体的函数avformat_open_input
- 图解FFMPEG打开媒体的函数avformat_open_input
- Androidstudio加载工程很慢解决方案
- iOS插入排序
- iOS编译时报错The run destination John的 iPhone is not valid for Running the scheme 'Test'.
- c#实现将DataTable中的数据导出到DBF文件
- JAVA 泛型 - Class<T>
- 解决安卓调用ffmpeg函数avformat_open_input进行转码出现打不开文件
- fiddler抓取https请求(android/ios)
- 15自由度机器人课程日志(二)程序下载
- Spring配置文件-applicationContext.xml
- Angular内置服务
- shell编程中for/while/util/case/select/break/continue
- 影响相机图像亮度的5个因素
- 张绍勋——一个叱咤疆场的抗日英雄之死
- jquery 数组的函数定义