使用C#合并两个视频文件时出现问题 [英] Problem in joining two video files using C#

查看:61
本文介绍了使用C#合并两个视频文件时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用Filestream加入两个是三个视频.我将视频文件路径存储在DataTable Video中.视频正在加入.但是问题是,第一个视频正常运行,其他视频运行得非常快.就像我们快进一样.

Hi,
I am using filestream to join two are three videos. I stored the video files path in DataTable Video. The Video is joining. But the Problem is first video running normally, other videos are moving very fast. Like we given in fast forward.

FileStream fsSource = new FileStream("C:\\vide.mpg", FileMode.Append);
                    for (int i = 0; i < video.Rows.Count; i++)
                    {
                        FileInfo fi = new FileInfo(video.Rows[i][0].ToString());
                        Byte[] bytePart = System.IO.File.ReadAllBytes(fi.FullName);
                        fsSource.Write(bytePart, 0, bytePart.Length);                      
                    }
           fsSource.Close();



任何人都知道解决方案,请帮助我.谢谢.



Any one know the solution please help me. Thank you.

推荐答案

如果要同时播放2个视频,则需要输入3个代码部分:

第1部分:

If you want to play 2 videos at the same time you need to enter 3 parts of code:

Part 1:

using System.Runtime.InteropServices; //with this code you are able to import dll files



第2部分:

下:



Part 2:

under:

public Form1()
        {
            InitializeComponent();
        }


输入代码:


enter code:

[DllImport("winmm.dll")]
        private static extern long mciSendString(
            string command,
            StringBuilder returnValue,
            int returnLength,
            IntPtr winHandle);//imports a dll file and creates a new command



第3部分:



Part 3:

string filename1 = "";//position of first file
string filename2 = "";//position of second file
mciSendString("close mf1", null, 0, IntPtr.Zero);
mciSendString("close mf2", null, 0, IntPtr.Zero);
mciSendString("open \"" + filename1 + "\" type mpegvideo alias mf1 style child parent " + pictureBox1.Handle.ToString(), null, 0, IntPtr.Zero);
mciSendString("open \"" + filename2 + "\" type mpegvideo alias mf2 style child parent " + pictureBox2.Handle.ToString(), null, 0, IntPtr.Zero);
mciSendString("put mf1 window at 0 0 " + pictureBox1.Width.ToString() + " " + pictureBox2.Height.ToString(), null, 0, IntPtr.Zero);
mciSendString("put mf2 window at 0 0 " + pictureBox2.Width.ToString() + " " + pictureBox2.Height.ToString(), null, 0, IntPtr.Zero);
mciSendString("play mf1", null, 0, IntPtr.Zero);
mciSendString("play mf2", null, 0, IntPtr.Zero);



这对我有用;如果您想了解更多有关此代码的信息,请搜索MCI(媒体控制界面)



this worked for me;if you want to know more about this code search for MCI(Media Control Interface)


这篇关于使用C#合并两个视频文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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