Are there plans to implement 3gps, 3gpt or 3gpr streamable formats
from the MediaRecorder?

On Oct 19, 4:21 pm, "Roman ( T-Mobile USA)" <roman.baumgaert...@t-
mobile.com> wrote:
> A file which is recorded as a3gpfile by the Android MediaRecorder is
> NOT streamable. You would need to make it streamable before trying to
> play it back via the MediaPlayer.
>
> --
> Roman Baumgaertner
> Sr. SW Engineer-OSDC
> ·T· · ·Mobile· stick together
> The views, opinions and statements in this email are those of the
> author solely in their individual capacity, and do not necessarily
> represent those of T-Mobile USA, Inc.
>
> On Oct 18, 8:36 pm, zongan liu <[email protected]> wrote:
>
>
>
> > After several days of agonizing, ultimately did not solve the problem,
> > is hereby published issue and hoping to get friends to help.
>
> > Requirements: The android to record video and transmitted through the
> > socket means to save the file on the server (3gpfile).
>
> > Question:3gpfiles saved to the server, mobile player can't open,3gp
> > file encoding is not correct.
>
> > Note: stored in the phone's local system,3gpfiles encoded in the
> > correct format, mobile phone player to open.
>
> > android record code:
>
> > String hostname = "192.168.20.106";
> >                 int port = 1234;
> >                 try
> >                 {
> >                         socket = new 
> > Socket(InetAddress.getByName(hostname), port);
> >                 }
> >                 catch (UnknownHostException e)
> >                 {
> >                         e.printStackTrace();
> >                 }
> >                 catch (IOException e)
> >                 {
> >                         e.printStackTrace();
> >                 }
> >                 ParcelFileDescriptor pfd = 
> > ParcelFileDescriptor.fromSocket(socket);
> >                 mMediaRecorder = new MediaRecorder();
>
> >                 // 设置以流方式输出
> >                 mMediaRecorder.setOutputFile(pfd.getFileDescriptor());
> >                 
> > mMediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
> >                 
> > mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
> >                 
> > mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
> >                 mMediaRecorder.setOutputFormat
> > (MediaRecorder.OutputFormat.THREE_GPP);
> >                 mMediaRecorder.setVideoSize(176, 144);
> >                 mMediaRecorder.setVideoFrameRate(15);
> >                 
> > mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
> >                 
> > mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
> >                 mMediaRecorder.setMaxDuration(10000);
>
> > Server receives the data  code:
> > public MultiThreadServer() throws IOException
> >         {
> >                 serverSocket = new ServerSocket(port);
> >                 // Runtime的availableProcessor()方法返回当前系统的CPU数目.
> >                 executorService = 
> > Executors.newFixedThreadPool(Runtime.getRuntime
> > ().availableProcessors() * POOL_SIZE);
>
> >                 System.out.println("服务器启动");
> >         }
>
> >         public void service()
> >         {
> >                 while (true)
> >                 {
> >                         Socket socket = null;
> >                         try
> >                         {
> >                                 // 接收客户连接,只要客户进行了连接,就会触发accept();从而建立连接
> >                                 socket = serverSocket.accept();
> >                                 //executorService.execute(new 
> > Handler(socket));
> >                                 new Thread(new Handler(socket)).start();
>
> >                         }
> >                         catch (Exception e)
> >                         {
> >                                 e.printStackTrace();
> >                         }
> >                 }
> >         }
>
> > Handler class code:
>
> > public Handler(Socket socket)
> >         {
> >                 this.socket = socket;
> >                 d = new File("D:/ds");
> >                 if (!d.exists())
> >                 {
> >                         d.mkdirs();
> >                 }
>
> >                 try
> >                 {
> >                         store = File.createTempFile("sdsd", ".3gp", d);
> >                         fos = new FileOutputStream(store);
> >                         socketIn = socket.getInputStream();
> >                 }
> >                 catch (IOException e)
> >                 {
> >                         // TODO Auto-generated catch block
> >                         e.printStackTrace();
> >                 }
> >         }
>
> >         public void run()
> >         {
> >                 try
> >                 {
> >                         System.out.println("New connection accepted " +
> > socket.getInetAddress() + ":" + socket.getPort());
>
> >                         while ((length = socketIn.read(buffer)) != -1)
> >                         {
> >                                 fos.write(buffer, 0, length);
> >                                 fos.flush();
> >                                 System.out.println("正在写入中。。。。" + length);
> >                         }
>
> >                         fos.flush();
> >                         store = null;
> >                         socketIn.close();
> >                 }
> >                 catch (IOException e)
> >                 {
> >                         e.printStackTrace();
> >                 }
> >                 finally
> >                 {
> >                         try
> >                         {
> >                                 fos.close();
> >                                 fos = null;
> >                                 store = null;
> >                                 if (socket != null)
> >                                         socket.close();
> >                         }
> >                         catch (IOException e)
> >                         {
> >                                 e.printStackTrace();
> >                         }
> >                 }
> >                 System.out.println("-----------------------------完毕");
> >         }
>
> > You help me find the cause of it, in this thank you. Given at the high
> > score! ! !- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to