Trying to capture a video and save it to sd card in Mp4/3gp formats using local socket. Being able to write bytes by bytes to sd card but the video file is not playable.I have gone through many examples :
https://github.com/fyhertz/spydroid-ipcamera
https://github.com/mconf/sipdroid
and many more. I have noticed people suggesting this might be a problem of file's header. I tried to skip those "mdat" data too from header:
private void skipHeader() throws IOException {
// Skip all atoms preceding mdat atom
byte[] buffer = new byte[3];
while (true) {
while (mReceiver.getInputStream().read() != 'm');
mReceiver.getInputStream().read(buffer,0,3);
if (buffer[0] == 'd' && buffer[1] == 'a' && buffer[2] == 't') break;
}
}
At last nothing worked for me.What extra do I need to do for making those video files playable using Local Socket