4

Does somebody know how to use FFMPEG on Android to convert YUV420 frame to H.264?

I have ported FFMPEG work on Android with NDK, I just don't know how to use it. A source code is appreciated.

Reno
  • 33,594
  • 11
  • 89
  • 102
huppyuy
  • 133
  • 4
  • 10
  • If this is a personal/non-profint/non-commercial,anything project, could you please tell us the result and how you did it, and if possible, a download link for stopping the reinvention of the wheel? – Behrooz Mar 19 '11 at 21:40

1 Answers1

7

You have two options:

  1. use ffmpeg api - google ffmpeg sample code. this requires good understanding of the api and which is very comprehnsive.
  2. compile ffmpeg.c and invoke its main() via jni. This requires that you understand the command line parameters. It is rather cumbersome but works.

    You need to look out for the static vars defined in ffmpeg.c and reset them every time you invoke the main function. Also make sure you don't invoke the main in two threads simultaneously .

Reno
  • 33,594
  • 11
  • 89
  • 102
Eli Konky
  • 2,697
  • 1
  • 20
  • 17
  • 2
    I am trying to do #2 that you stated above. I have asked this question already and have not gotten any useful answers and that is why I am resorting to asking it here. Could you please give me some information on how to call ffmpeg.c through JNI. I am just getting all kinds of compiling errors when I add it to the Android.mk file. – DRiFTy Mar 21 '11 at 15:33
  • would be happy to help, but please add your compilation errors. probably it would be better to do that in a new question. – Eli Konky Mar 23 '11 at 07:40
  • Thank you! Any help is much appreciated! I created my own question with a some details [here](http://stackoverflow.com/questions/5412722/compile-ffmpeg-c-and-call-its-main-via-jni) – DRiFTy Mar 23 '11 at 22:59