3

Device Google Glass XE19.1

I'm try write file on remote server:

        mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
        mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
        mMediaRecorder.setVideoEncodingBitRate(0x4c4b40);
        mMediaRecorder.setAudioChannels(2);
        mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
        mMediaRecorder.setAudioEncodingBitRate(0x17700);
        mMediaRecorder.setAudioSamplingRate(44100);

        ParcelFileDescriptor pfd = ParcelFileDescriptor.fromSocket(socket);
        mMediaRecorder.setOutputFile(pfd.getFileDescriptor());

On remote server file writes, but when i try open this, i get next error:

ftypisom isom3gp4 free

But when i save in sd card, it's ok. What wrong?

P.S. this test code: Works very good. File open and play

   socket = new Socket(host,4444);


    File file = new File("C:/video.mp4");
    long length = file.length();
    byte[] bytes = null;
    bytes = new byte[1024]; 
    FileInputStream fis = new FileInputStream(file);
    BufferedInputStream bis = new BufferedInputStream(fis);
    BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream());
    DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
    int count;

    while((count = bis.read(bytes))>0){
        dos.write(bytes, 0, count);
    }
    System.out.println("File send");
    bos.flush();
    bos.close();
    fis.close();
    bis.close();
    socket.close();
user1755546
  • 1,049
  • 2
  • 13
  • 27
  • Have you solved this problem? As I found the problem is mediaRecoder doesn't write any head information to socket. But writes to File. – Vyacheslav Oct 10 '14 at 10:29
  • no. But i know, what head info write to end file – user1755546 Oct 13 '14 at 05:04
  • how to parse it? where this data begins? – Vyacheslav Oct 13 '14 at 09:38
  • I'm tryed create algorithm, but it failed... You can see head info in WinHex programm. You need Сompare the start and end file - in local record(on External/Internal Memory) and in file, receive via Socket. If you can create algorithm, please, post answer here – user1755546 Oct 13 '14 at 10:03

0 Answers0