Comments (12)
Hello @mihir0109 ,
In the past I succeeded in executing ffmpeg binary in Android's terminal only (both via adb and from Android device itself). I haven't embedded it to an Android application.
The ffmpeg binary searches for *.so files by a relative path. All these *.so files should be accessible by ../lib/*.so
relatively to ffmpeg binary. The ffmpeg binary doesn't expect the installation directory to be changed anyhow.
You can try placing all necessary files in assets rather than in jniLibs and move them all to device's storage. And then the binary should work properly.
from ffmpeg-android-maker.
Consider a 'portable' application. It has its file structure which shouldn't be messed. Only this way such an app can work if you just copy it into a target environment.
That is why you shouldn't change the structure of what FFmpeg building process prepared for you.
from ffmpeg-android-maker.
Hi @Javernaut ,
Thanks a lot for quick reply and suggestion.
Tried moving all .so files to data/ folder same like ffmpeg, but still getting same error.
CANNOT LINK EXECUTABLE "/data/user/0//files/ffmpeg": library "libavdevice.so" not found
from ffmpeg-android-maker.
Did you make the structure of files on the device like at the image below?
This way it should work properly.
from ffmpeg-android-maker.
I have put all these .so files in jniLibs->arm64-v8a->... and same for other 3 CPU architecture like x86 and x86_64.
And all files in assets -> arm64-v8a -> ... (all 7 .so files and ffmpeg and ffprobe binary)
then moving all these assets file to data/ folder.
static boolean copyBinaryFromAssetsToData(Context context, String fileNameFromAssets, String outputFileName) {
// create files directory under /data/data/package name
File filesDirectory = getFilesDirectory(context);
InputStream is;
try {
is = context.getAssets().open(fileNameFromAssets);
// copy ffmpeg file from assets to files dir
final FileOutputStream os = new FileOutputStream(new File(filesDirectory, outputFileName));
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int n;
while(EOF != (n = is.read(buffer))) {
os.write(buffer, 0, n);
}
Util.close(os);
Util.close(is);
return true;
} catch (IOException e) {
Log.e("issue in coping binary from assets to data. ", e);
}
return false;
}
my cpu architecture is: arm64-v8a
copyBinaryFromAssetsToData(context, cpuArchNameFromAssets + File.separator + "libavcodec.so", "libavcodec.so");
Also loading library:
try {
System.loadLibrary("avutil");
System.loadLibrary("avcodec");
System.loadLibrary("avformat");
System.loadLibrary("swscale");
System.loadLibrary("swresample");
System.loadLibrary("avfilter");
System.loadLibrary("avdevice");
} catch (Exception e){
e.printStackTrace();
}
from ffmpeg-android-maker.
System.loadLibrary(xxx);
isn't needed at all if you don't use the JNI bindings.
I would like to repeat again the thing regarding the file structure of binaries and shared libraries. They have to be in separate directories with specific names. See my screenshot above. You shouldn't place into a single directory - that just will not work.
from ffmpeg-android-maker.
Hello,
Yes, but as you said above, try moving .so files from assets folder to data/ folder same like ffmpeg binary.
The ffmpeg binary searches for *.so files by a relative path. All these .so files should be accessible by ../lib/.so
i tried earlier removing system.loadlibrary, but same issue.
from ffmpeg-android-maker.
Is there any way i can create ffmpeg itself with all necessary .so files.. i.e. using this scripe, i can generate ffmpeg with just 250 kb of binary.. can i get it which includes all .so files i.e. ffmpeg binary itself 20 mb, so other .so files dont required?
from ffmpeg-android-maker.
Not sure if this is possible. The ffmpeg binary is just a facade for a set of av** libraries. And there are other binaries that work with these shared libraries as well.
from ffmpeg-android-maker.
I've compiled the ffmpeg binary and tried everything myself. Indeed there is an issue just as you described: "CANNOT LINK EXECUTABLE "./ffmpeg": library "libavdevice.so" not found".
I'm sure the executable worked for me in the past, but I don't remember details. Perhaps my device was rooted and it impacted the thing somehow.
I'll investigate this issue further, but it isn't my priority for now.
from ffmpeg-android-maker.
Thanks a lot champ.. waiting for the updated one if can be fixed soon.
from ffmpeg-android-maker.
Transferred this issue to private Jira
from ffmpeg-android-maker.
Related Issues (20)
- Clang Error: No input Files HOT 2
- Git utility is absent into the image.. HOT 1
- cmake error with libaom test file HOT 21
- add libvorbis but compile failed HOT 1
- linux invalid variable name HOT 6
- how to link libx265 with libstdc++.so? HOT 6
- How to enable h264_mediacodec for decoding? HOT 3
- Build Error on MacOS M1 HOT 3
- Build ffmpeg with libx265 enabled HOT 8
- Ffmpeg.so file for android HOT 1
- Is there a similar maker or scripts for IOS HOT 1
- Build Failed HOT 4
- /bin/sh: 1: cd: can't cd to /mnt/ffmpeg-android-maker HOT 4
- Vulkan support for ffmpeg 6.1 HOT 2
- Add external library libxml2 HOT 3
- Ffmpeg with rtmps support HOT 1
- Host compiler lacks C11 support HOT 11
- How can I get FFPLAY to build? HOT 6
- How to add a custom external library? HOT 7
- Help me writing .cpp and .h file to run any ffmpeg command from .java file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ffmpeg-android-maker.