Open sayan801 opened 10 years ago
http://developer.android.com/reference/android/media/MediaCodec.html
http://www.sauronsoftware.it/projects/jave/index.php
I upgraded eclipse project to Android Studio and ran the code on my android nexus 4 device... i get following error..
I could reproduce the issue.. Here is the logs from my logcat..
09-22 19:01:03.660 7515-7515/com.example.videoextraction W/System.err﹕ java.io.IOException: Error running exec(). Command: [/bin/chmod, 755, /data/data/com.example.videoextraction/cache/jave-1/ffmpeg] Working Directory: null Environment: null
09-22 19:01:03.660 7515-7515/com.example.videoextraction W/System.err﹕ at java.lang.ProcessManager.exec(ProcessManager.java:211)
09-22 19:01:03.660 7515-7515/com.example.videoextraction W/System.err﹕ at java.lang.Runtime.exec(Runtime.java:173)
09-22 19:01:03.660 7515-7515/com.example.videoextraction W/System.err﹕ at java.lang.Runtime.exec(Runtime.java:128)
09-22 19:01:03.670 7515-7515/com.example.videoextraction W/System.err﹕ at it.sauronsoftware.jave.DefaultFFMPEGLocator.
In the Android Application, Its not able to find the ffmpeg executable..
Read this section from Jave Documentation ( http://www.sauronsoftware.it/projects/jave/manual.php#7 ).. It says jave library includes ffmpeg binary for windows and linux only.. for other you need to compile on your own..
Using an alternative ffmpeg executable
JAVE is not pure Java: it acts as a wrapper around an ffmpeg (http://ffmpeg.mplayerhq.hu/) executable. ffmpeg is an open source and free software project entirely written in C, so its executables cannot be easily ported from a machine to another. You need a pre-compiled version of ffmpeg in order to run JAVE on your target machine. The JAVE distribution includes two pre-compiled executables of ffmpeg: a Windows one and a Linux one, both compiled for i386/32 bit hardware achitectures. This should be enough in most cases. If it is not enough for your specific situation, you can still run JAVE, but you need to obtain a platform specific ffmpeg executable. Check the Internet for it. You can even build it by yourself getting the code (and the documentation to build it) on the official ffmpeg site. Once you have obtained a ffmpeg executable suitable for your needs, you have to hook it in the JAVE library. That's a plain operation. JAVE gives you an abstract class called it.sauronsoftware.jave.FFMPEGLocator. Extend it. All you have to do is to define the following method:
public java.lang.String getFFMPEGExecutablePath()
This method should return a file system based path to your custom ffmpeg executable.
Once your class is ready, suppose you have called it MyFFMPEGExecutableLocator, you have to create an alternate encoder that uses it instead of the default locator:
Encoder encoder = new Encoder(new MyFFMPEGExecutableLocator())
You can use the same procedure also to switch to other versions of ffmpeg, even if you are on a platform covered by the executables bundled in the JAVE distribution.
Anyway be careful and test ever your application: JAVE it's not guaranteed to work properly with custom ffmpeg executables different from the bundled ones.
you can use this executable of ffmpeg for android.. Read the following conversation..
http://stackoverflow.com/questions/4725773/ffmpeg-on-android
The project is to build an android app that achieves video to video/audio extraction. I just saw your comment on github, I was aware of that issue and have been trying to build ffmpeg for android, I tried out instructions mainly from these links :
http://www.roman10.net/how-to-build-ffmpeg-for-android/
http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
https://enoent.fr/blog/2014/06/20/compile-ffmpeg-for-android/
Following those instructions did not exactly help- it did not work and I could not find online help for the error messages.
Is this approach complicating the project too much? Are there better ways of finishing it?
@aparnaSubr ffmpeg is the best option for video encoding and decoding.. There are several version of android port of ffmpeg.. Looks like following one is the best one..
@sayan801 Thank you! I shall try that out :)
http://stackoverflow.com/questions/5337833/ffmpeg-on-android-undefined-references-to-libavcodec-functions-although-it-is http://www.quora.com/What-are-the-steps-for-integrating-FFMPEG-on-Android http://bambuser.com/opensource http://stackoverflow.com/questions/22864926/looking-for-ffmpeg-wrappers-for-android
I have been working on the android project; I am stuck! I am trying to use JAVE libraries to achieve audio extraction from videos, but it uses ffmpeg command and I am not able to figure out how I can get that command to work on my phone.
When I run the application, I get an error message - " java.io.IOException: Error running exec(). Command: [/data/data/com.example.videoextraction/cache/jae-1/ffmpeg, -i, sourcePath, -vn, -acodec, pcm_s16le, -f, wav, -y, destinationPath] Working Directory:null Environment: null ".
I spent all day trying out ways to get ffmpeg to work on android, I couldn't figure it out.