字节数组转换为视频文件 [英] converting byte array to video file

查看:685
本文介绍了字节数组转换为视频文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能转换成字节数组视频文件?如MP4
鉴于以下code

 的DbConnection连接=新的DbConnection(getApplicationContext());
                    SQLiteDatabase分贝= connection.getReadableDatabase();
                    unhideCursor = db.query(dbConnection.TABLE_VIDEOS,新的String [] {} dbConnection.VIDEO_DATA,dbConnection.VIDEO_TITLE +=?,新的String [] {} videoTitle,NULL,NULL,NULL);
                    字节[] =可视数据unhideCursor.getBlob(unhideCursor.getColumnIndex(dbConnection.VIDEO_DATA));


解决方案

如果字节数组已经是一个视频流,只需将其序列化到扩展MP4的磁盘。 (如果它是一个MP4连接codeD流)。

Java的

 的FileOutputStream出=新的FileOutputStream(video.mp4);
out.write(可视数据);
out.close();

C#

 流T =新的FileStream(video.mp4,FileMode.Create);
的BinaryWriter B =新的BinaryWriter(T);
b.Write(可视数据);
t.Close();

希望这有助于!

杰弗里·凯文撬

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

这篇关于字节数组转换为视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆