开发者

converting byte array to video file

How can I 开发者_运维知识库convert a byte array to a video file? like mp4 Given the following code

dbConnection connection=new dbConnection(getApplicationContext());
                    SQLiteDatabase db=connection.getReadableDatabase();
                    unhideCursor=db.query(dbConnection.TABLE_VIDEOS, new String[]{dbConnection.VIDEO_DATA}, dbConnection.VIDEO_TITLE+"=?", new String[]{videoTitle}, null, null,null);
                    byte[]videoData=unhideCursor.getBlob(unhideCursor.getColumnIndex(dbConnection.VIDEO_DATA));


If the byte array is already a video stream, simply serialize it to the disk with the extension mp4. (If it's an MP4 encoded stream).

Java

FileOutputStream out = new FileOutputStream("video.mp4");
out.write(videoData);
out.close();

C#

Stream t = new FileStream("video.mp4", FileMode.Create);
BinaryWriter b = new BinaryWriter(t);
b.Write(videoData);
t.Close();

Hope this helps!

Jeffrey Kevin Pry

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜