Reputation: 41
I had captured a video from camera and stored in sd card, now i need to convert that video file into binary format for my process. Can any one tell me how can i convert video files into binary format. Thanks in advance!!!!
Upvotes: 0
Views: 3632
Reputation: 3277
I converted my image files and pdf file with the following method, try this with your requirement
Bundle objBundle = objResult.getExtras();
Uri uriString = Uri.parse(objBundle.get("").toString());
File file = new File(uriString.getPath());
FileInputStream objFileIS = new FileInputStream(file);
ByteArrayOutputStream objByteArrayOS = new ByteArrayOutputStream();
byte[] byteBufferString = new byte[1024];
for (int readNum; (readNum = objFileIS.read(byteBufferString)) != -1;)
{
objByteArrayOS.write(byteBufferString, 0, readNum);
System.out.println("read " + readNum + " bytes,");
}
byte[] byteBinaryData = Base64.encode((objByteArrayOS.toByteArray()), Base64.DEFAULT);
strAttachmentCoded = new String(byteBinaryData);
This may help you
Upvotes: 1