android 视频转字节,如何将视频文件(.mp4)格式转换为android中的二进制格式?...
我想在網(wǎng)絡(luò)服務(wù)器上傳視頻。我得到了我想要以二進(jìn)制格式傳遞文件的服務(wù),我該怎么做?如何將視頻文件(.mp4)格式轉(zhuǎn)換為android中的二進(jìn)制格式?
我試圖通過base64將視頻文件轉(zhuǎn)換為二進(jìn)制格式..?
public class binaryformat extends Activity {
private String strAttachmentCoded;
Button b1;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
b1=(Button)findViewById(R.id.button1);
b1.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
File file = new File("/mnt/sdcard/C:/Program Files (x86)/Wowza Media Systems/Wowza Media Server 3.1.2/content/sample.mp4");
FileInputStream objFileIS = null;
try
{
objFileIS = new FileInputStream(file);
}
catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
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)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
byte[] byteBinaryData = Base64.encode((objByteArrayOS.toByteArray()), Base64.DEFAULT);
strAttachmentCoded = new String(byteBinaryData);
}
});
}
}
+1
您的網(wǎng)站服務(wù)是在哪種技術(shù)中開發(fā)的? –
+0
windows server 2008 –
+0
如何將我的視頻文件轉(zhuǎn)換為二進(jìn)制格式發(fā)送請(qǐng)求到服務(wù)器來保存文件..? –
總結(jié)
以上是生活随笔為你收集整理的android 视频转字节,如何将视频文件(.mp4)格式转换为android中的二进制格式?...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Codeforces Round #69
- 下一篇: 过拟合(overfitting)和欠拟合