0

how can i demux .mp4 file and separate audio/video and then render individually using openmax and android stagefright.

1.If i have to implement all functions in jni file.

2.what if i use ffmpeg for demuxing,how it can be integrated with android stagefright(if i have to build ffmpeg demuxer as component and link it with android using openmax il or write the entire code in android jni(in that case i have to link ffmpeg with android stagefright)).

3.since android ndk doesn't support stagefright,how to integrate both.

Regards Mayank

Ganesh
  • 5,880
  • 2
  • 36
  • 54
Mayank Agarwal
  • 447
  • 1
  • 7
  • 21

1 Answers1

2

In general, Android has all the requisite functions built into it's framework which can be accessed from both native as well as Java layers. All component names below have a Java abstraction and Native implementation which you can consider using in your project accordingly. For your questions,

1) I would recommend that you could use MediaPlayer directly as found in this JNI implementation, actual implementation of which can be found here.

However, should you require to build your own pipeline, I would recommend employing the available blocks such as MediaExtractor for demuxing and providing separate tracks, OMXCodec for the codecs and I presume you would manage the audio routing and Surface handling for video in your implementation. A good reference for you could be the SimplePlayer example implementation.

2)If you wish to employ a demuxer from FFMPEG, you will have to integrate the same into the list of MediaExtractors supported by the system. Since your primary interest is MP4 and AVI, both of which are supported, I feel you can avoid this effort. If you are still interested in the FFMPEG integration, please raise a separate query as the answer is quite elaborate.

3) I feel this statement may not entirely be true. NDK can support stagefright if required, but philosophy is different here. For playback, NDK supports an OpenMAX AL player application as found in this html file along with an example here. However, please note that only MPEG-2 TS is supported in OpenMAX AL implementation which may not suit your requirements.

Ganesh
  • 5,880
  • 2
  • 36
  • 54