[FFmpeg-user] Android FFmpeg high memory usage sigkill
Jonathan Girven
jonathan.girven at trickbook.com
Thu Nov 17 18:51:14 EET 2016
I am a developer for an Android app that uses FFmpeg to merge,
compress and apply effects to video files. Previously we used a
compiled FFmpeg executable that was run using a shell from our Android
application (with good success). Recently I discovered a patch
included in the FFmpeg master branch that takes advantage of Android's
MediaCodec hardware acceleration
(http://ffmpeg.org/pipermail/ffmpeg-devel/2016-July/196434.html). To
utilise it, I understand FFmpeg needs to be compiled using the JNI, so
I roughly followed the method described in:
https://github.com/appunite/AndroidFFmpeg
I modified the code to use the current git master branch. I have used
the --enable-jni and --enable-mediacodec options in my configure
script. I have written some code to take a command string and run the
ffmpeg.c main function. I believe I now have the system working, but I
am seeing much higher memory usage than with the old executable file,
for the same command. In many cases, Android kills FFmpeg / the whole
app because of it. I have monitored
`Debug.getNativeHeapAllocatedSize()` and see the heap growing to over
1GB on my Nexus 5X.
You can see my FFmpeg command and output here:
http://pastebin.com/gicyqRry
I have added some of my own logs monitoring the progress file and
memory usage in case that is useful. Let me know if more verbose logs
are useful. I am not sure if my problem comes from the FFmpeg command,
build, usage or something else. Any ideas on debugging this would be
gratefully received.
More information about the ffmpeg-user
mailing list