简体   繁体   中英

C# byte array to video

Need to convert byte arrays of images and videos back to its origin. I know how to do it for images as shown below.

MemoryStream stream = new MemoryStream(byteArray);
Bitmap bitMap = (Bitmap)Bitmap.FromStream(stream);

But I haven't found a good way to do this conversion of byte arrays of videos. Was looking into the System.Drawing.Image namespace, but that namespace is only for images.

Any advice appreciated, thanks :-)

When you say "conversion of byte arrays of videos", what are you expecting, and why do you want a Video object, and what would you do with it?

The .NET Framework doesn't have an equivalent of Bitmap for video if your intention is to edit it. There are a lot of 3rd party APIs that can do that for you, or if you wanted you could work with something like DirectShow using the DXSlim wrapper around DirectX.

Your problem here is knowing the format of the video, making sure codecs are available, etc. It's not like a bitmap in which there is a universal standard.

You will probably want to start with the new Microsoft Media Foundation if you're trying to do editing or play something with an obscure codec. It's going to be a lot of work. You might do better to use Silverlight here if you're going to be streaming and if you have control over the format.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM