Answer the question
In order to leave comments, you need to log in
Streaming video from camera to server without writing to SDCARD?
There is a code on the client side:
try {
socket = new Socket(InetAddress.getByName(hostname), port);
pfd = ParcelFileDescriptor.fromSocket(socket);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
recorder.setOutputFile(pfd.getFileDescriptor());
// String filename = String.format("/sdcard/%d.mp4", System.currentTimeMillis());
//
// recorder.setOutputFile(filename);
try
{
recorder.prepare();
recorder.start();
}
catch (IllegalStateException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
try
{
System.out.println("create sock");
ServerSocket svsock = new ServerSocket(1935);
System.out.println("accept");
Socket sock = svsock.accept();
System.out.println("buffer read");
FileOutputStream outFile = null;
String filename = String.format("%d.mp4", System.currentTimeMillis());
try {
outFile = new FileOutputStream(filename);
System.out.println(filename);
} catch (IOException e1) {
e1.printStackTrace();
}
InputStream is = new DataInputStream(sock.getInputStream());
byte[] byteBuffer = new byte[1024];
int allsize = 0;
while(sock.isConnected()) {
int size = is.read(byteBuffer);
if (size == -1){
break;
} else {
outFile.write(byteBuffer, 0, size);
}
allsize += size;
}
System.out.println("close size=" + allsize);
outFile.close();
sock.close();
}
catch(Exception e)
{
e.printStackTrace();
}
System.out.println("endmain");
}
}
mp4 error: MP4 plugin discarded (no moov,foov,moof box) avcodec error: Could not open �codec demux error: Specified event object handle is invalid ps error: cannot peek main error: no suitable demux module for `file/:///C:/1345461283455.mp4'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question