android


Adding ffmpeg OMX codec to Genymotion Android 4.4.2 emulator


Basic Question:
Is there a way to add a new audio codec to the Genymotion Android emulator, short of downloading the entire Android source, learning how to build it, and creating my own version of Android?
Context:
I have written a java Android app that acts as an audio renderer, as well as being a DLNA/OpenHome server and client. Think "BubbleUpnp" without video. My primary development platform is Win8.1. The program started as an ActiveState "pure-perl" DLNA MediaServer on Windows, which I then ported to Ubuntu, which I got working under Android a few years ago. It was pretty funky ... all UI being presented thru an HTTP server/jquery/jquery-ui, served from an Ubuntu shell running under Android (a trick in itself), serving up HTML pages to Chrome running on the same (Android) device. Besides being "funky" it had a major drawback that it required a valid IP address to work ... as I could not figure out how to get ubuntu to have a local loopback device for a 127.0.0.01 localhost I use the app as a "car stereo" on my boat (which is my home), which is often not hooked up to the internet.
I had a hard time getting started in Android app development because the speed of the Android emulators in Eclipse was horrid, and the ADB drivers did not work from Win8 for the longest time.
Then one day, about a year ago, I ran into Genymotion (kudos to the authors), and all of a sudden I had a workable Android development environment, so I added a Java implementation of the DLNA server, which then grew into a renderer also, using Android's MediaPlayer class, and, adding the ability to act as a DLNA control point, and more recently also added OpenHome servers and renderers to it.
In a separate effort, I created a build environment for this program called fpCalc, based on ffMpeg, on a variety of platforms, including Win, Linux, and Android x86, arm, and arm7 devices (bitbucket.org/phorton1/) and did an extensive series of tests to determine the validity, and longevity of fpcalc fingerprints, discovering that the fpCalc fingerprint changed based on the version of ffmpeg it was built against, a separate topic to be sure, but in the process, learned at least a bit about how to build ffmpeg as well as Android shared libraries, JNI interfaces, etc.
So now the Android-Java version of the program has advanced past the old perl version, and I am debating whether I want to continue to try to build the perl version (and or add an wxPerl UI) to it.
One issue that has arisen, for me, is that the Genymotion emulator does not support WMA decoding ... as Android dropped support for WMA due to licensing issues, etc, a ways back in time ... yet my music library has significant numbers of tunes in WMA files, and I don't want to "convert" them, my carefully thought-out philosophy is that my program does not modify the contents, or tags, or anything in the original media files that I have accumulated, or will receive in the future, rather treating them as "artifacts" worth preserving "as is". No conversion is going to make a file "better" than it was, and I wish to preserve ALL of the original sources for ALL of my music going forward.
So, I'm thinking, gee, I can build FFMPEG on 7 different platforms, and I see all these references to "OMX FFMPEG Codec Support for Android" on the net, so I'm thinking, "All I need to do is create the OMX Component and somehow get it into Genymotion".
I have studied up OMX, OpenMaxIL, seen Michael Chen's posts, seen the stack overflow questions
How to make ffmpeg codec componet as OMX component
and
Android: How to integrate a decoder to multimedia framework
and Cedric Fung's page https://vec.io/posts/use-android-hardware-decoder-with-omxcodec-in-ndk, and Michael Chen's repository at https://github.com/omxcodec , as well as virtually every other page on the net that mentions any combination of libstagefright, OMX, Genymotion, and FFMPEG.
(this page would not let me put more than 2 links as i don't have a "10" reputation, or I would have listed some of the sources I have seen) ..
My Linux development environment is a Ubuntu12.04 vbox running on my win machine. I have downloaded and run the Android-x86 iso as a vbox, and IT contains the ffmpeg codecs, but unfortunately, it neither supports a wifi interface, nor the vbox "guest additions", so it has a really funky mouse. I tried for about 3 days to address those two issues, but in the end do not feel it is usable for my puproses, and I really like the way genymotion "feels", particularly the moust support, so I'd like to keep genymotion as my "windows android" virtual device under which I may run my program, deprecate and stop using my old perl source,
except genymotion does not support WMA files ...
Several side notes:
(a) There is no good way to write a single sourced application in Java that runs natively in Windows, AND as an Android app.
(b) I don't want to reboot my Windows machine to a "real" Android device just to play my music files. The machine has to stay in Windows as I use it for other things as well.
(c) I am writing this as my machine is in the 36th hour of downloading the entire ASOP source code base to a partition in my Ubuntu vbox while I am sitting in a hotel room on a not-so-good internet connection in Panama City, Panama, before I return to my boat in remote Bocas Del Toro Panama, where the internet connection is even worse.
(d) I did get WMA decoding to work in my app by calling my FFMPEG executable from Java (converting it to either WAV/PCM or AAC), but, because of limitations in Android's MediaPlayer, it does not work well, particularly for remotely hosted WMA files ... MediaPlayer insists on having the whole file present before it starts to play, which can take several seconds or longer, and I am hoping that by getting a 'real' WMA codec underneath MediaPlayer, that problem will just disappear ....
So, I'm trying to figure this whole mess out. There are a lot of tantalizing clues, and suggestions, but what I have found, or at least what I am starting to believe, is that if I want to add a simple WMA audio decoding codec to Android (Genymotion), not only do I have to download, basically, the ENTIRE ASOP Android source tree, and learn a new set of tools (repo, etc), but I have to (be able to) rebuild, from scratch, the entire Android system, esp. libstagefright.so in such a way as to be COMPLETELY compatible with the existing one in GenyMotion, while at the same time adding ffmpeg codecs ala Michael Chen's page.
And I'm just asking, is it, could it really be that difficult?
Anyways, this makes me crazy. Is there no way to just build a new component, or at worst a new OMX core, and add it to Genymotion, WITHOUT building all of Android, and preferably, based only on the OMX h files? Or do I REALLY have to replace the existing libstagefright.so, which means, basically, rebuilding all of Android ...
p.s. I thought it would be nice to get this figured out, build it, and then post the installable new FFMPEG codecs someplace for other people to use, so that they don't also grow warts on their ears and have steam shooting out of their eyeballs, while they get old trying to figure it out ....
Hi Photon and thanks for the kudos, it is much appreciated :D
First, I don't know when you downloaded your device but it's quite a long time we do not provide 4.4.2 but 4.4.4.
If you launch a 4.4.4 device and open /etc/media_codecs.xml file you can see these lines listing the ffmpeg decoders we embed:
<!-- ffmpeg audio codecs -->
<MediaCodec name="OMX.ffmpeg.aac.decoder" type="audio/mp4a-latm" />
<MediaCodec name="OMX.ffmpeg.wma.decoder" type="audio/x-ms-wma" />
<MediaCodec name="OMX.ffmpeg.ra.decoder" type="audio/vnd.rn-realaudio" />
<MediaCodec name="OMX.ffmpeg.flac.decoder" type="audio/flac" />
<MediaCodec name="OMX.ffmpeg.mp2.decoder" type="audio/mpeg-L2" />
<MediaCodec name="OMX.ffmpeg.ac3.decoder" type="audio/ac3" />
<MediaCodec name="OMX.ffmpeg.ape.decoder" type="audio/x-ape" />
<MediaCodec name="OMX.ffmpeg.dts.decoder" type="audio/vnd.dts" />
<MediaCodec name="OMX.ffmpeg.pcm.decoder" type="audio/x-pcm" />
<MediaCodec name="OMX.ffmpeg.atrial.decoder" type="audio/ffmpeg" />
WMA is part of it. You should try to download a new 4.4.4 device and your problem would be solved.
Also, our audio support has extended over time and if a Kitkat device does not do the job maybe a more recent version could do it (check 5.0, 5.1 or 6.0).
Then if you finally cannot do it. I would not advise you to add a new codec by yourself, even if it could be possible by hacking around system files and partially compiled the AOSP. It would be complicated and possibly not possible at all.
A good solution would be to use an alternative media player, including all the codecs you need. You will then embed this media player and it's libraries directly inside you native app and use it instead of the Android MediaPlayer. My first advise would be to use VLC that proposes a standalone libVLC version that is done for that. I already used it and it is really great. There are other third party libs that you can find on the web.
I hope it helped you.

Related Links

Android cannot be resolved to a type
Get an app ready for ICS
save Strikethrough text state in Listview from ArrayAdapter Android
Can I limit TextView's number of characters?
Android color selector doesn't work with custom attributes
Issue in playing m3u8 file in android 3.2
How to get Call number as well as the duration of the call made by a user in Android?
Android screen-size database
GSMCellLocation in android ending up with exception
ImageView Pinch Zoom In - Out Code Sample
Drawing route on the map with over 30 coordinates
ViewPager and PagerAdapter in a document reader
ViewPager background changes while scrolling on Ice Cream Sandwich
Trouble Reading from URL (Android)
How do I stop eclipse from auto creating filters for android logcat?
Android button not resizing when put in table programmatically

Categories

HOME
beautifulsoup
adal
fpga
css3
gpu
pascal
shiro
knitr
gradient
access
static-site
entity-framework-core
sendgrid-api-v3
arangodb
openpyxl
distribution
pybossa
onedrive-api
renjin
keytool
package.json
wolframalpha
drive
imagemap
question2answer
ios10.2
string-concatenation
jquery-callback
onload
pic32
oculus
cppreference
git-squash
playstation-portable
gojs
activexobject
roblox
protege4
wurfl
sql-server-ce
modernizr
odroid
resolution
portforwarding
sharp-snmp
congestion-control
libgphoto2
singleinstance
scalding
tinkerpop
modelsim
git-flow
boo
type-theory
flac
d3-force-directed
restore
cvxpy
cudd
actor-platform
embedding
cfchart
php-socket
libav
relativelayout
directdraw
pypiserver
ess
intel-c++
pax-exam
graphics2d
git-ftp
mraid
fail2ban
ejb-2.x
webmatrix-3
uncaught-typeerror
ssis-data-flow
sonarqube-5.0
webfinger
device-tree
cbind
with-statement
websphere-esb
amslidemenu
git-repo
sbcl
http-patch
cffile
neos-server
process-explorer
kaleidoscope
facebook-timeline
alice
idn
pstack
subgraph
multiplexing
apache-commons-dbutils
urlrewriter
htdocs
winmain
jqote
drawtobitmap
massive
cdonts
collectionviewsource
load-time
easyb
drupal-fivestar
folding
blender-2.49
wordprocessingml
perl5.12
linfu-dynamicproxy
httpcookie

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App