0

I am trying to build a video system. I get the data from Camera through Preview, then I give the data to Mediacodec and let it do the video encoding job. Now I am focus on the audio part. I am not sure which API to use for the audio caperture and audio encoding.

I've done some search. But it seems that most of the demos use MediaRecord. Since I've replaced the MediaRecord with MediaCodec, I think I need to find some new way to do the audio part. How to capeture the audio? Can MediaCodec do audio codec?

Thank You!

Brendon Tsai
  • 1,267
  • 1
  • 17
  • 31

1 Answers1

1

Yes. The MediaMuxerTest demonstrates using two MediaCodec encoder instances (one for audio, one for video) and MediaMuxer to "clone" a movie file.

Note the audio/mp4a-latm MIME type is used for audio.

fadden
  • 51,356
  • 5
  • 116
  • 166
  • Thank you! but it seems that the demo only contains the MediaMux of video and audio. Does it contain the audio encode?? – Brendon Tsai Jan 06 '14 at 03:03
  • Thank you, fadden! So I should set two instance of encoder, one for video data captured from the preview and one for audio data. Is there any similar API like preview in audio which can help me get the raw data from microphone? – Brendon Tsai Jan 06 '14 at 08:45
  • fadden, I found there is only one variable of Mediasrc. How could this present both video and audio? And I also find the source ' int source = R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz;', is that a real source path? – Brendon Tsai Jan 07 '14 at 03:52
  • `EncoderTest` is strictly audio. `MediaMuxerTest` handles audio and video, but doesn't actually decode or encode. I don't currently have an example that puts it all together. – fadden Jan 07 '14 at 04:44