title: How to convert video to base64 data
body: <p>I have an app that take video from camera or gallery and convert it into base64 data and that data send to server but the problem is whenever I convert base64 data it will be not correct data in videodata variable. for this I used below code : </p>
  
  <pre><code>FileInputStream objFileIS = null;
  try
  {
      System.out.println("file = &gt;&gt;&gt;&gt; &lt;&lt;&lt;&lt;&lt;" + selectedImagePath);
      objFileIS = new FileInputStream(selectedImagePath);
  } 
  catch (FileNotFoundException e) 
  {
      e.printStackTrace();
  }
  ByteArrayOutputStream objByteArrayOS = new ByteArrayOutputStream();
  byte[] byteBufferString = new byte[1024];
  try
  {
      for (int readNum; (readNum = objFileIS.read(byteBufferString)) != -1;) 
      {
          objByteArrayOS.write(byteBufferString, 0, readNum);
          System.out.println("read " + readNum + " bytes,");
      }
  } 
  catch (IOException e)
  {
      e.printStackTrace();
  }                    
  
  videodata = Base64.encodeToString(byteBufferString, Base64.DEFAULT);
  Log.d("VideoData**&gt;  " , videodata);
  </code></pre>
  
  <p>Please make it correct...</p>