2013-07-02 6 views
7

मैं एआर ऐप में एक वीडियो कैप्चर फ़ंक्शन जोड़ने की कोशिश कर रहा हूं। मूल रूप से स्क्रीन पर क्या हो रहा है रिकॉर्डिंग, और इसे वीडियो के रूप में सहेजें (उपयोगकर्ता इसे साझा करने की इजाजत देता है)। एआर एपीपी वोफोरिया-यूनिटी एसडीके के साथ लिखा गया है। हमने आईओएस मंच पर सफलतापूर्वक इसे हासिल किया है।एंड्रॉइड प्लेटफार्म में एकता के साथ एआर (वुफोरिया) पर वीडियो कैप्चर

हालांकि, हमें एंड्रॉइड मंच पर एक ही चीज़ करने में बड़ी कठिनाइयां हैं।

  1. कैमरा Vuforia कार्यक्रम द्वारा ocuppied है, मैं वीडियो स्ट्रीम के लिए उपयोग नहीं कर सकते हैं: (हम बाहर डिवाइस पक्ष के साथ इस लक्ष्य को हासिल करने की उम्मीद कर रहे हैं)

    निम्नलिखित हमारी प्रगति है।

  2. मैंने प्रत्येक फ्रेम के एक स्क्रैशॉट को कैप्चर करने का प्रयास किया है, और फिर उन्हें कुछ वीडियो आउटपुट में जोड़ दिया है; लेकिन framerate extreamly गरीब (1 एफपीएस से कम) है। स्क्रीन शॉट कैप्चर करने में 700ms लगते हैं।

क्या मैं गलत दिशा से सोच रहा हूं? किसी भी मदद की सराहना की जाएगी! बहुत धन्यवाद!

public void acquireScreenshot() { 
    DisplayMetrics metrics = new DisplayMetrics(); 
    WindowManager WM = (WindowManager) MainActivity.this.getSystemService(Context.WINDOW_SERVICE); 
    Display display = WM.getDefaultDisplay(); 
    display.getMetrics(metrics); 
    int height = metrics.heightPixels; // screen height 
    int width = metrics.widthPixels; // screen width 
    int pixelformat = display.getPixelFormat(); 
    PixelFormat localPixelFormat1 = new PixelFormat(); 
    PixelFormat.getPixelFormatInfo(pixelformat, localPixelFormat1); 
    int deepth = localPixelFormat1.bytesPerPixel; 

    byte[] arrayOfByte = new byte[height* width* deepth]; 
    long tmp = System.currentTimeMillis(); 
    try { 
     for(int i = 0 ; i < 10 ; i++){ 
      InputStream localInputStream = readAsRoot(); 
      DataInputStream localDataInputStream = new DataInputStream(
        localInputStream); 
      android.util.Log.e("mytest", "-----read start-------"); 
      localDataInputStream.readFully(arrayOfByte); 
      android.util.Log.e("mytest", "-----read end-------time = " + (System.currentTimeMillis() -tmp)); 
      localInputStream.close(); 

      File mid = new File("/mnt/sdcard/AAA"); 

      if(!mid.exists()){ 
       mid.mkdir(); 
      } 

      FileOutputStream out = new FileOutputStream(new File(
        "/mnt/sdcard/AAA/"+System.currentTimeMillis()+".png")); 
      int[] tmpColor = new int[width * height]; 
      int r, g, b; 
      tmp = System.currentTimeMillis(); 
      android.util.Log.e("mytest", "-----bitmap start-------"); 
      for (int j = 0; j < width * height * deepth; j+=deepth) { 
       b = arrayOfByte[j]&0xff; 
       g = arrayOfByte[j+1]&0xff; 
       r = arrayOfByte[j+2]&0xff; 
       tmpColor[j/deepth] = (r << 16) | (g << 8) | b |(0xff000000); 
      } 
      Bitmap tmpMap = Bitmap.createBitmap(tmpColor, width, height, 
        Bitmap.Config.ARGB_8888); 
      android.util.Log.e("mytest", "-----bitmap end-------time = " + (System.currentTimeMillis() -tmp)); 

      tmp = System.currentTimeMillis(); 
      android.util.Log.e("mytest", "-----compress start-------"); 
      tmpMap.compress(Bitmap.CompressFormat.PNG, 100, out); 
      android.util.Log.e("mytest", "-----compress end-------time = " + (System.currentTimeMillis() -tmp)); 
      out.close(); 
      Thread.sleep(40); 
     } 


    } catch (Exception e) { 
     android.util.Log.e("mytest", "Exception"); 
     e.printStackTrace(); 
    } 

} 
+0

किसी भी मौके से आपको समाधान मिला :) –

+0

अभी तक नहीं ....... < – user2542563

+0

कोई प्रगति? मैं अब तक कोई भाग्य नहीं कर रहा हूं। – vmachacek

उत्तर

0

हम कैमरा रिकॉर्ड प्राप्त करने के लिए कुछ इंटेल प्लगइन का उपयोग करते थे: इसहाक

के बाद मेरे परीक्षण कोड है।

Video Capturing for Unity3d* Applications on Android*

यह काफी लागू करने के लिए सरल है। आशा है कि आप उन्हें उपयोगी पाएंगे।

+0

ऐसा लगता है कि यह अब समर्थित नहीं है। क्या आप अभी भी इस या किसी अन्य समाधान का उपयोग कर रहे हैं? –

संबंधित मुद्दे