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!!!!
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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