android ffmpeg halfninja av_open_input_file返回-2(没有这样的文件或目录) [英] android ffmpeg halfninja av_open_input_file returns -2 (no such file or directory)

查看:313
本文介绍了android ffmpeg halfninja av_open_input_file返回-2(没有这样的文件或目录)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用

https://github.com/halfninja/android-ffmpeg-x264

使用在Windows上运行的VirtualBox 。然后我将libvideokit.so复制到所提供项目的Windows副本的Project\libs\armeabi文件夹中。从那里我能够在我的Android设备上从Eclipse运行ProjectTest。我可以看到正在执行的ffmpeg代码,当它到达打开输入文件的时候,它给我指出的错误。我已经注意到了这个问题的一些讨论。

using Ubuntu running in VirtualBox on windows. I then copied libvideokit.so into the Project\libs\armeabi folder of a Windows copy of the provided projects. From there I was able to run the ProjectTest from Eclipse on my Android device. I can see the ffmpeg code being executed but when it gets to the point of opening the input file it gives me the indicated error. I have noticed some discussion of this problem at

FFMpeg on Android, undefined references to libavcodec functions, although it is listed on command line

但是解决方案没有帮助,因为文件协议在此构建中启用,我还尝试将file:放在文件路径前面无效。为了完整,我尝试设置minimal_featureset = 0以启用所有的默认值,但这给我相同的错误。以下是Eclipse的logcat快照,显示了Videokit的输出,并额外调用了LOGE,以显示av_open_input_file的结果。对于任何想要尝试的建议,将不胜感激。

but the solutions have not helped since the file protocol is enabled in this build and I also tried putting "file:" in front of the filepath to no avail. For completeness I tried setting minimal_featureset=0 to enable all the defaults but this gives me the same error. Below is a snapshot of the logcat from Eclipse showing the output from Videokit with an extra call to LOGE to display the result from av_open_input_file. Any suggestions of things to try would be greatly appreciated.

10-23 11:57:33.888: DEBUG/Videokit(4830): run() called
10-23 11:57:33.888: DEBUG/Videokit(4830): run passing off to main()
10-23 11:57:33.904: DEBUG/Videokit(4830): main(): registering all modules
10-23 11:57:33.927: DEBUG/Videokit(4830): main(): registered everything
10-23 11:57:33.927: DEBUG/Videokit(4830): main(): initting opts
10-23 11:57:33.943: DEBUG/Videokit(4830): main(): initted opts.
10-23 11:57:33.943: ERROR/Videokit(4830): ffmpeg version N-30996-gf925b24, Copyright (c) 2000-2011 the FFmpeg developers
10-23 11:57:33.943: ERROR/Videokit(4830):   built on Oct 21 2011 13:54:03 with gcc 4.4.3
10-23 11:57:33.943: ERROR/Videokit(4830):   configuration: --enable-cross-compile --arch=arm5te --enable-armv5te --target-os=linux --disable-stripping --prefix=../output --disable-neon --enable-version3 --disable-shared --enable-static --enable-gpl --enable-memalign-hack --cc=arm-linux-androideabi-gcc --ld=arm-linux-androideabi-ld --extra-cflags='-fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated' --disable-everything --enable-decoder=mjpeg --enable-demuxer=mjpeg --enable-parser=mjpeg --enable-demuxer=image2 --enable-muxer=mp4 --enable-encoder=libx264 --enable-libx264 --enable-decoder=rawvideo --enable-protocol=file --enable-hwaccels --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-filter=buffer --enable-filter=buffersink --disable-demuxer=v4l --disable-demuxer=v4l2 --disable-indev=v4l --disable-indev=v4l2 --extra-cflags='-I../x264 -Ivideokit' --extra-ldflags=-L../x264
10-23 11:57:33.943: DEBUG/Videokit(4830): main(): parsing options
10-23 11:57:33.943: DEBUG/Videokit(4830): parse_options has 4 options to parse
10-23 11:57:33.951: ERROR/Videokit(4830): opt_input_file av_open_input_file /mnt/sdcard/fun/snap0000.jpg -2 
10-23 11:57:33.951: ERROR/Videokit(4830): /mnt/sdcard/fun/snap0000.jpg: No such file or directory
10-23 11:57:33.951: ERROR/Videokit(4830): ffmpeg_exit(1) called!


推荐答案

问题在于权限。在android上,我们将sdcard安装成系统作为所有者,但没有rwx。但是ffmpeg检查:

The problem is in permissions. On android we have sdcard mounted with system as owner, but without rwx. But ffmpeg checks that:

avformat / file.c:

avformat/file.c:

static int file_check(URLContext *h, int mask)
{
    struct stat st;
    int ret = stat(h->filename, &st);
    if (ret < 0)
        return AVERROR(errno);

    ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ  : 0;
    ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;

    return ret;
}

更改此功能:

static int file_check(URLContext *h, int mask)
{
    struct stat st;
    int ret = stat(h->filename, &st);
    if (ret < 0)
        return AVERROR(errno);

    ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ  : 0;
    ret |= st.st_mode&S_IRGRP ? mask&AVIO_FLAG_READ  : 0;
    ret |= st.st_mode&S_IROTH ? mask&AVIO_FLAG_READ  : 0;
    ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0;
    ret |= st.st_mode&S_IWGRP ? mask&AVIO_FLAG_WRITE  : 0;
    ret |= st.st_mode&S_IWOTH ? mask&AVIO_FLAG_WRITE  : 0;


    return ret;
}

重建你的ffmpeg。那就是吧!

And rebuild your ffmpeg. And that`s it!

这篇关于android ffmpeg halfninja av_open_input_file返回-2(没有这样的文件或目录)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆