So, I have this video in .mp4 format and I've converted it into bytes and sent to my server and written the bytes to a file.
When I try to open the new file, it says, 'No Proper Codec found' or something like that.
So, How do I transfer the video to client with the codec so it can play at my server end.
Clinet.java
File file = new File("/Users/Batman/Documents/Eclipse/Record/outo.flv");
InputStream is = new FileInputStream(file);
OutputStream os = RTSPSocket.getOutputStream();
long len = file.length();
byte[] bytes = new byte[(int) len];
int offset = 0;
int numRead = 0;
while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
offset += numRead;
}
String s = String.valueOf(len);
RTSPBufferedWriter.write(s);
RTSPBufferedWriter.flush();
os.write(bytes);
os.close();
is.close();
Server.java
inputStream = socket.getInputStream();
byte[] bytes = new byte[1415874];
for (int i = 0; i < bytes.length; i++) {
fileOutputStream.write(inputStream.read(bytes));
}
fileOutputStream.close();
inputStream.close();
Thanks