0
votes

I’m trying to show live preview from one android device to another. Here is what I did,

Sender : 1.Camera frame(YUV) -> 2.Mediacodec (encode h264 byte[])-> 3.MediaMuxer-> 4.mp4

I'm sending output of media encoder via socket connection.

Receiver : 5.byte[] via socket ->6. Mediacodec (decoder) -> 7.Play.

Till step 5 everything works fine.

However I'm not able to decode the byte[]. What is missing here? I guess, I'm not able to send(don't know how to send) sps and pps properly! also how to test that what I'm sending is correct data?

Thanks.

1

1 Answers

0
votes

You are muxing to mp4 (container format) the encoded h264 video. However, on the decoding side, you are not using demuxer (or parser/splitter). Media codec decoder can take elementary video not any container format. Use mediaextractor to demux in android. (https://developer.android.com/reference/android/media/MediaExtractor.html)