1

I have a MPEG file which I have converted into a byte array. The intention is for a client to retrieve this byte array then save the MPEG file locally where it will be used in an WPF application.

I can convert the MPEG file to a byte array, but I don't know how to convert the byte array back to MPEG or save the byte array as an MPEG file.

How do I do this?

BTW any infomation about converting a byte array to any video format which WPF supports would be helpful.

8
  • 2
    An MPEG file is a byte-array. It's just on disk. Commented Jan 18, 2011 at 14:48
  • So, "I can convert the MPEG file to a byte array" - maybe show us how you do that. Commented Jan 18, 2011 at 15:00
  • Thats a very good point! I didn't test my code which converts from mpeg to byte array. And it isnt working! So how do I read the mpeg file into my own byte array within my function? Is this even possible? Commented Jan 18, 2011 at 15:12
  • The code which I have to convert any file to byte array isnt working when I give the function the path for the mpeg file. I am using the FileToByteArray function found here - digitalcoding.com/Code-Snippets/C-Sharp/… . I receive an IOException when I try to use FileStream to open the mpeg file for reading. Commented Jan 18, 2011 at 15:38
  • "Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied.\r\n" --- Its my local machine, so should definately be available -- on the other hand, I have no idea why access to the file would be denied?! Commented Jan 18, 2011 at 15:54

2 Answers 2

1

You can call File.WriteAllBytes to write a byte array to a file.

If the byte array contains a different format (eg, DivX), you'll need to transcode the file to MPEG, perhaps using ffmpeg.

Sign up to request clarification or add additional context in comments.

Comments

0

What about System.IO.File.WriteAllBytes(myFileName, mpegDataByteArray)?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.