I successfully integrated FFMPEG as a library on android and I am using JNI to communicate my JAVA classes with C and C++ classes.
Background and my question A chat app where GIFs can be sent, the issue is that one GIF could weigh up to 2MB, after a lot of research I found that the best solution is converting those gifs to mp4 (Something that Facebook messenger, whatsapp and telegram do).
My question is, how can I convert a gif to mp4 in order to reduce its size, using ffmpeg (not in command line, in android) as Telegram mentions here ?
What I have attempted
- Understanding and implementing the gifvdeo.cpp from Telegram (it was extremely complicated and I could not understand it fully)
- Converting the gif to frames of bitmaps, and compressing each bitmap and then converting those bitmaps to mp4 (I was not able to pass the bitmap object to C through JNI because of " Fatal signal 11 (SIGSEGV), code 1, fault addr 0x31f in tid 26952" which is another question)
Research I have done
- using ffmpeg to convert gif to mp4 , output doesn't play on android
- How to convert GIF to Mp4 is it possible?
- Convert GIF to Video in Android
- https://unix.stackexchange.com/questions/40638/how-to-do-i-convert-an-animated-gif-to-an-mp4-or-mv4-on-the-command-line
the problem with above questions is that they use command line FFMPEG which is not what I am doing, I am using JNI and direct access to c classes of mentioned library.