2013-04-23 44 views
2

看来,即使我的录像机配置文件设置为低,该视频是最高质量的低质量的视频。的Android设备不捕捉果冻豆4.2.2

这里是我的代码:

 camera.setDisplayOrientation(90); 
     camera.unlock(); 
     recorder.reset(); 
     recorder.setCamera(camera); 
     recorder.setAudioSource(MediaRecorder.AudioSource.MIC); 
     recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); 
     recorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_LOW)); 

//when removing these comments I get an exception on my 4.2.2 device when calling start() on the recorder. 
/*  recorder.setVideoFrameRate(24); 
     recorder.setVideoSize(480, 360); 

*/  
     recorder.setOrientationHint(90); 
     file = FileUtils.getFileName(FileTypes.VIDEO); 
     if (!file.exists()) { 
      try { 
       file.createNewFile(); 
      } catch (IOException e) { 
       e.printStackTrace(); 
      } 
     } 
     recorder.setOutputFile(FileUtils.getFileName(FileTypes.VIDEO).toString()); 
     recorder.setMaxDuration(45000); 
+0

我有相同的代码,它工作正常。 – Lucifer 2013-04-23 13:16:11

+0

@Lucifer你使用的是什么android版本?它是最新的4.2.2吗? – user1940676 2013-04-23 13:17:06

+0

Android 2.3.3至4.0.4 – Lucifer 2013-04-23 13:17:28

回答

2

试试这个。虽然这看起来与您的代码相同,但它适用于我。为CamcorderProfile创建单独的实例并将记录器配置文件设置为此实例。

CamcorderProfile cprofileLow = CamcorderProfile 
      .get(CamcorderProfile.QUALITY_LOW); 
    recorder.setProfile(cprofileLow); 
    recorder.setOutputFile("/sdcard/videocapture_example.mp4"); 
    recorder.setMaxDuration(50000); // 50 seconds 
    recorder.setMaxFileSize(3000000); // Approximately 3 megabytes 

请你,你有一个高端设备(因为你是4.2.2)的通知,你可能会提供了一个很好的comparitively分辨率,它是在你的设备尽可能低的分辨率。

+0

那么它不适合我 – user1940676 2013-04-28 14:35:15