3

I am trying to create a 3gp video file by combining an mp3 audio clip and an image for my android application. That is: mp3 + image = 3gp video clip.

I did so much research on this but found that help available was limited.

Please let me know how to do this.

Praful Bhatnagar
  • 7,390
  • 2
  • 34
  • 44
TharakaNirmana
  • 9,667
  • 8
  • 45
  • 67

3 Answers3

2

The process is called transcoding. Pointers:

Community
  • 1
  • 1
Emre
  • 4,545
  • 7
  • 25
  • 39
  • Thank you for the reply, I did set up android NDK but now I need to know how to use it to create a video. Please let me know how to do this? I am new to android development.. – TharakaNirmana Jan 04 '13 at 09:08
2

If you are looking to do that outside of your application then check out this post which gives ffmpeg command that can be used to achieve the same.

Also ffmpeg can also be compiled for android and used using the JNI as discussed in this post.

copying the best answer for quick reference:

Here are the steps I went through in getting ffmpeg to work on Android:

  1. Build static libraries of ffmpeg for Android. This was achieved by building olvaffe's ffmpeg android port (libffmpeg) using the Android Build System. Simply place the sources under /external and make away. You'll need to extract bionic(libc) and zlib(libz) from the Android build as well, as ffmpeg libraries depend on them.
  2. Create a dynamic library wrapping ffmpeg functionality using the Android NDK. There's a lot of documentation out there on how to work with the NDK. Basically you'll need to write some C/C++ code to export the functionality you need out of ffmpeg into a library java can interact with through JNI. The NDK allows you to easily link against the static libraries you've generated in step 1, just add a line similar to this to Android.mk: LOCAL_STATIC_LIBRARIES := libavcodec libavformat libavutil libc libz
  3. Use the ffmpeg-wrapping dynamic library from your java sources. There's enough documentation on JNI out there, you should be fine.

Regarding using ffmpeg for playback, there are many examples (the ffmpeg binary itself is a good example), here's a basic tutorial. The best documentation can be found in the headers.

Community
  • 1
  • 1
Praful Bhatnagar
  • 7,390
  • 2
  • 34
  • 44
2

Compile a port of ffmpeg to android. You'll get an ffmpeg executable file, put in your app. Setup you app to extract it in its data directory and mark it as executable. Then use it with ffmpeg command line options.

Build a wrapper JNI class, if you need to call it from java code only.

S.D.
  • 28,125
  • 2
  • 75
  • 122
  • I did set up android NDK but now I need to know how to use it to create a video. Please let me know how to do this? I am new to android development.. – TharakaNirmana Jan 04 '13 at 09:07