Android Audio video encoder using MediaCodec API - android

I am developing an App that need audio-video encoding simultaneously. I checked the Google Grafika https://github.com/google/grafika CameraCaptureActivity, but it only encodes the video data. How can I encode audio data with other MediaCodec object and create a mp4 with MediaMuxer that contains both audio and video.

Related

I have already encoded byte arrays & i want to create mp4 video. is MediaMuxer is helpful?. can i use MediaMuxer without Mediacodec?

I have live encoded byte stream from which i just need to create .mp4 file. how can I do that?.
I found people are using MediaMuxer API along with MediaCodec but I do
not need to use MediaCodec as I already have encoded frames.
Is it possible with MediaMuxer API only? I do not want to use any library for this.

Video encryption while encoding

I am developing application which is recording video using MediaCodec and converting it into Mp4(h.264+aac) using MediaMuxer. I want to keep that mp4 encrypted but i am not able to find anyway to encrypt video while recording .So currently I have to encrypt video once video is created.
Since MediaCrypto is used while decoding is there any other way ?

Android mediacodec: Is it possible to encode audio and video at the same time using mediacodec and muxer?

There is some good documentation on this site called big flake about how to use media muxer and mediacodec to encode then decode video as mp4, or extract video then encode it again and more stuff.
But it doesnt seem that there is a way to encode audio with video at the same time, no documentation or code about this. It doesn't seem impossible.
Question
Do you know any stable way of doing it that will work on all devices greater than android 18?
Why no one implemented it, is it hard to implement?
You have to create 2 Mediacodec instances, one for video and one for audio and then use MediaMuxer to mux the video with audio after encoding, you can take a look at ExtractDecodeEditEncodeMuxTest.java and at this project to capture camera/mic and save to mp4 file using Mediamuxer and Mediacodec

How do you encode a video with audio using MediaCodec

So, I have encoded a h264 elementary stream with MediaCodec by collectings the frames using Camera's onPreviewFrame method.(using Encoding H.264 from camera with Android MediaCodec). Then, I generated an mp4 video using the h264 stream. Unfortunately, it doesn't have any audio in it.
I notice that MediaCodec should also allow encoding audio because it has settings for audio codecs.
Now is there any ways to add audio to the h264 stream?
thanks for reading and would appreciate any comments or suggestions.
A given instance of MediaCodec will encode either video or audio. You would need to create a second instance of MediaCodec to do the audio encoding, and then combine the streams with the MediaMuxer class (introduced in Android 4.3, API 18).
There are examples of using MediaMuxer on bigflake, but at the time I'm writing this there isn't one that demonstrates combining audio and video (they're just "muxing" the video into a .mp4 file). It should be enough to demonstrate how to use the class though.

Streaming audio/video from Android

I am writing Android app to stream audio/video to Wowza server in RTSP interleaved mode. Using AAC and H.264 encoders. I created packetizers for both audio and video. The problem that I am facing is that when I send both streams simultaneously I am losing video stream. I only get audio on Wowza and VLC. When I do not stream audio video works just fine. This proves that my packetizers and RTP streaming code perform as expected. It looks as if I cannot send video fast enough to sustain the stream.
Similarly architected code on iOS provides stable video and audio feed.
Thank you

Categories

Resources