2

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

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.

Omar Hezi
  • 155
  • 8
  • "*using ffmpeg (not in command line*" look up what the ffmpeg command line tool actually does (by peeking into its source) when converting a .gif to a .mp4 and wrap this into a function you then call from java. – alk Nov 06 '17 at 16:00
  • @alk apologies for the late reply, well yes, I have checked what the ffmpeg.c does, its main method receives 2 parameters, an array (parameters of the command) and its length. That's not what I want to do as it's very slow on an android device. – Omar Hezi Nov 07 '17 at 19:49

0 Answers0