如何将音频/视频转换为二进制,反之亦然 [英] How to convert Audio/Video to binary and vice verse

查看:357
本文介绍了如何将音频/视频转换为二进制,反之亦然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能帮我吗?我想将媒体文件(图像/音频/视频)转换为字节数组,反之亦然.我制作了图像转换器,但仍然是视频和音频..的想法是..将媒体文件发送为零和一,然后将其重新转换为原始文件.

在此先感谢您.

Could you kindly help me? I want to convert a media file (image/audio/video) to an array of bytes and vice verse. I made the image converter but still the video and audio .. the idea of that is .. to send the media file as zeros and ones then reconvert it to original file.

Thanks in advance.

推荐答案

计算机上存储的所有文件都是二进制文件.因此,我认为您可能需要编辑您的问题,以使您想做的事情更清楚.
All files stored on a computer are binary. So I think that you might need to edit your question to make it clearer what it is that you want to do.


看看这个:

MSDN杂志 [
Take a look at this:

MSDN Magazine[^]


Dim sql As String =" INSERT INTO student VALUES(@Photo )"
昏暗的cmd作为新的SqlCommand(Sql,con)
昏暗的毫秒作为新的MemoryStream()
PictureBox1.Image.Save(ms,PictureBox1.Image.RawFormat)
昏暗的数据为Byte()= ms.GetBuffer()
将Dim p设置为新的SqlParameter("@ photo",SqlDbType.Image)
p.Value =数据
cmd.Parameters.Add(p)
cmd.ExecuteNonQuery()
MessageBox.Show(记录已保存",保存",MessageBoxButtons.OK)

我也将搜索将视频转换为字节的视频.但我有您想知道的解决方案之一.它仅在图像文件上.您将数据类型设置为图像".
Dim sql As String = "INSERT INTO student VALUES(@Photo)"
Dim cmd As New SqlCommand(Sql, con)
Dim ms As New MemoryStream()
PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat)
Dim data As Byte() = ms.GetBuffer()
Dim p As New SqlParameter("@photo", SqlDbType.Image)
p.Value = data
cmd.Parameters.Add(p)
cmd.ExecuteNonQuery()
MessageBox.Show("record has been saved", "Save", MessageBoxButtons.OK)

i will searching too for the video converting to byte. but i have one of the solution you want to know. it only on the image file. you will set your data type to "image".


这篇关于如何将音频/视频转换为二进制,反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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