none
Save byte[] as video RRS feed

  • Question

  • Hello! I'm getting video stream as byte[]. How can i save this array to video file?
    Wednesday, February 14, 2018 7:00 PM

All replies

  • What is that base of that Video File. Stream it simply back in that format to disk in the opposite way as you got the array. 

    Success
    Cor

    Wednesday, February 14, 2018 7:12 PM
  • If all of the bytes were loaded, then try File.WriteAllBytes specifying a suitable file extension.

    Wednesday, February 14, 2018 7:29 PM
  • Hi lgorGalimski,

    By my search, I also just find save byte[] as video like Viorel_'s post, and it could not be opened by some video tool, it shows that "This file isn't playable. That might be because the file type is unsupported, the file extension is incorrect, or the file is corrupt."

    byte[] buffer = new byte[4096];
            private void button1_Click(object sender, EventArgs e)
            {             
                using (Stream video = File.OpenRead(@"D:\Audio File\minions.mp4"))
                {                          
                    int bytesRead = video.Read(buffer, 0, buffer.Length);                                         
                }
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                File.WriteAllBytes(@"D:\Audio File\Test1.wmv", buffer);
                       
            }

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, February 15, 2018 7:14 AM