Android ffmpeg halfninja av_open_input_file returns -2 (no such file or directory)

I built ffmpeg for Android using the code and method described in

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

using Ubuntu running in VirtualBox on windows. Then I copied libvideokit.so to the Project \ libs \ armeabi folder of the Windows copy from the provided projects. From there, I was able to run ProjectTest from Eclipse on my Android device. I see that the ffmpeg executable code is executing, but when it reaches the opening point of the input file, it gives me the specified error. I noticed some discussion of this problem in

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

but the solutions did not help, since the file protocol is included in this assembly, and I also tried to put the file "file:" in front of the file path to no avail. For completeness, I tried setting minimum_featureset = 0 to include all the default values, but this gives me the same error. Below is a logcat snapshot from Eclipse showing the output of Videokit with an extra LOGE call to display the result from av_open_input_file. Any suggestions for trying should 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! 
+2
android ffmpeg
source share
2 answers

The problem is the permissions. On android, we have an SD card mounted with the system as the owner, but without rwx. But ffmpeg checks that:

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; } 

Change this function as follows:

 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; } 

And rebuild your ffmpeg. And it's all!

+6
source share

Actually, I have the same problem when compiling FFMpeg with this version: http://www.roman10.net/?p=389

And include everything that can be included (getting rid of the --disable-everything option).

If you have an idea, I wonder :)

Edit: On the HalfNinja website, this is what it says:
"... at the moment I am having problems with the input files (I think most of the inputs are fine, but do not recognize JPEG sequences).
: (

0
source share

All Articles