I have a limited amount of ram to install MiniDLNA on. Right now the package is way too large, i've been able to narrow the culprit down to ffmpeg which seems to require 14mb…. Which is huge when the other dependencies and MiniDLNA itself all require around 100 kb each. Is this normal that ffmpeg is requiring so much space?
I configure ffmpeg with the docs, htmlpages, manpages, podpages, txtpages, avdevice, swresample, swscale, postproc, afilter, and optimizations disabled. Is there anything else that I can disable to reduce the size of ffmpeg?
All you need a the appropriate libraries/codecs compiled for the OS and linked against (or with) minidlna. People run minidlna on a Raspberry PI, is your device less limited?
do to other libraries that are needed I only have a few mb to work with, which I didn't think would be a problem till I found out that the ffmpeg library takes up 14 mb. I'm not sure if I'm doing something wrong with the compilation, but 14mb seems like a lot for a single library.
So i narrowed it down to libavcodec, is it possible to compile without this?
Probably not. Depends on your OS and how you configure it and then minidlna. Please describe your system (OS and HW)
My Buffalo NAS is a old low end box (128MB) . I compiled Minidlna on it. That was slow, but it worked.
ccoupe@debian:~/minidlna$ ls -l /usr/lib/libavcodec.so.52.20.1
-rw-r-r- 1 root root 5726216 Oct 5 2010 /usr/lib/libavcodec.so.52.20.1
That would be 5MB and not all of it is used at once.
I used bitbake to compile for an ARM device which is running the android kernel. After compilation the FFMPEG libraries look like this.
-rwxr-xr-x 2 twear users 11M Jan 30 14:21 libavcodec.so.54.86.100
-rwxr-xr-x 2 twear users 1.3M Jan 30 14:21 libavformat.so.54.59.106
-rwxr-xr-x 2 twear users 167K Jan 30 14:21 libavutil.so.52.13.100
5M's is even a little higher than what I really want, but I might be able to manage if I got it down around that.
Also, I don't believe that libavcodec is needed for streaming, it looks like it is only being used to create the metadata. is this correct?
That would be my guess too. Also when files are deleted or moved, assuming Android supports inotify. It's also possible that turning off optimization increased code size (or not). You might be able to configure ffmpeg to build/use use some codecs that are unlikely to used on your device/application. That's beyond my experiece however.
Turning optimizations on or off didn't seem to works.
This is the line I'm using to configure. Any insights on something I can do to reduce the lib size?
./configure --enable-cross-compile --cross-prefix=/pkg/asw/compilers/codesourcery/arm-2010q1/bin/arm-none-linux-gnueabi- \
--arch=arm --target-os=linux --enable-armv5te --disable-armv6 --disable-mmx \
--enable-shared --disable-doc --disable-htmlpages --disable-manpages --disable-podpages \
--disable-txtpages --disable-avdevice --disable-swresample --disable-swscale \
--disable-postproc --disable-avfilter --disable-debug --disable-ffserver --disable-ffplay
Check if the debug symbols are stripped. On my arm system
ccoupe@debian:~$ file /usr/lib/libavcodec.so.52.20.1
/usr/lib/libavcodec.so.52.20.1: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, stripped
There's probably a way to figure out the command line that built that, but I'm remember how at the moment.
this is what my file shows.
libavcodec.so.54.86.100: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, stripped
I'd suggest visiting a ffmpeg or arm linux forum with your question.
Then again, I'd just build minidlna just to see if it works and discover other problems to be fixed cross compiling to Android.
It also depends on the version of ffmpeg you're working with. On my Ubuntu 12_04 X64 where vlc drags in a bunch of stuff,
ccoupe@twb:~$ ls -lh /usr/lib/x86_64-linux-gnu/libavcodec.so.53.35.0
-rw-r-r- 1 root root 6.7M Jan 24 11:50 /usr/lib/x86_64-linux-gnu/libavcodec.so.53.35.0
after getting a response from the ffmpeg mailing list, the correct configure option to add is -enable-small.
Reduced the size to ~4mb
-rwxr-xr-x 1 jeffery_chi jeffery_chi 570628 2013-05-16 18:01 rootfs/lib/libavcodec.so.53
-rwxr-xr-x 1 jeffery_chi jeffery_chi 875616 2013-05-16 18:01 rootfs/lib/libavformat.so.53
-rwxr-xr-x 1 jeffery_chi jeffery_chi 113860 2013-05-16 18:01 rootfs/lib/libavutil.so.51
In fact, i want to make the library smaller. XD
configure -prefix=/home/jeffery_chi/test/rootfs -cross-prefix=mipsel-linux- -arch=mips -target-os=linux -enable-shared -enable-pthreads -enable-small -disable-debug -disable-devices -disable-bsfs -disable-ffprobe -disable-parsers -disable-encoders -disable-decoders -disable-muxers -disable-mmx -disable-mmx2