Skip to content Skip to sidebar Skip to footer

How To Convert Video File(.mp4, .3gp) Format Into Binary Format In Android

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

Solution 1:

I converted my image files and pdf file with the following method, try this with your requirement

BundleobjBundle= objResult.getExtras();
UriuriString= Uri.parse(objBundle.get("").toString());
Filefile=newFile(uriString.getPath());
FileInputStreamobjFileIS=newFileInputStream(file);
ByteArrayOutputStreamobjByteArrayOS=newByteArrayOutputStream();
byte[] byteBufferString = newbyte[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 = newString(byteBinaryData);

This may help you

Post a Comment for "How To Convert Video File(.mp4, .3gp) Format Into Binary Format In Android"