您好。我得到一个字节流,我使用查询。接下来,我想将此流保存为文件作为视频。我使用File.WriteAllBytes,其中bytes [] - 这是我从流中得到的,但是当我打开视频时,只显示第一帧。重新编码后,视频将正常播放。我应该将哪些信息添加到文件中,以便我可以在录制后立即观看视频?
Hello. I get a stream of bytes, I use the query. Next, I want to save this stream to a file as a video. I use File.WriteAllBytes, where bytes[] - it's what i got from stream, but when I open the video, only the first frame is always displayed. After recoding, the video will be played normally. What information should I add to the file so that I can watch the video right after the recording?
推荐答案
嗨lgorGalimski,
Hi lgorGalimski,
感谢您在此发帖。
如果您有任何问题,请尝试以下代码。
For your question, please try the code below.
我使用的是windows media播放器从字节播放mp4视频。
I use windows media player to play the mp4 video from bytes.
右键单击所有Windows窗体>选择项目。选择Windows Media Player,单击"确定"。
Right click All Windows Form> Choose Items. Select Windows Media Player, click OK.
之后,您可以在工具箱中添加Windows Media控件。
After that, you could add Windows Media control in Toolbox.
这是代码。
private void button1_Click(object sender, EventArgs e) { string filename = "sample.mp4"; byte[] byteArray = Encoding.ASCII.GetBytes(filename); string file = Encoding.ASCII.GetString(byteArray); axWindowsMediaPlayer1.URL = file; }
最好的问候,
Wendy
更多推荐
纠正MJPEG流量记录
发布评论