Reputation: 183
In My App, I have to decode the bytearray (that is in .h264 format) in to video and the byte array coming from live steaming. The code is below:
static final int VIDEO_BUF_SIZE = 100000;
static final int FRAME_INFO_SIZE = 16;
byte[] frameInfo = new byte[FRAME_INFO_SIZE];
byte[] videoBuffer = new byte[VIDEO_BUF_SIZE];
File SDFile = android.os.Environment.getExternalStorageDirectory();
File destDir = new File(SDFile.getAbsolutePath() + "/test.h264");
//avRecvFrameData returns the length of the frame and stores it in ret.
int ret = av.avRecvFrameData(avIndex, videoBuffer,
VIDEO_BUF_SIZE, frameInfo, FRAME_INFO_SIZE,
frameNumber);
fos=new FileOutputStream(destDir,true);
fos.write(videoBuffer, 0, ret);
fos.close();
So what can I do now?
Thanks to All.
Upvotes: 0
Views: 4572
Reputation: 3843
I have used javacv library for performing decoding of H.264 live stream. Its quite nice library. here is the my question and its answer, it may help you. If you perform similar steps as i have performed, it will decode the video and you will be able to play it on device.
Upvotes: 1