android 视频转字节,如何将视频文件(.mp4)格式转换为android中的二进制格式?...
我想在網絡服務器上傳視頻。我得到了我想要以二進制格式傳遞文件的服務,我該怎么做?如何將視頻文件(.mp4)格式轉換為android中的二進制格式?
我試圖通過base64將視頻文件轉換為二進制格式..?
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
您的網站服務是在哪種技術中開發的? –
+0
windows server 2008 –
+0
如何將我的視頻文件轉換為二進制格式發送請求到服務器來保存文件..? –
總結
以上是生活随笔為你收集整理的android 视频转字节,如何将视频文件(.mp4)格式转换为android中的二进制格式?...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Codeforces Round #69
- 下一篇: 过拟合(overfitting)和欠拟合