Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
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.
Posted
Updated 10-Feb-12 11:39am
v2
Comments
Varun Sareen 3-Feb-12 4:01am    
Dear Friend,

Please try this solution:- http://www.c-sharpcorner.com/uploadfile/sonuraj/merge-two-files-with-C-Sharp/

Thanks
Philippe Mori 10-Feb-12 19:00pm    
Humm... the code is too simple to works properly. First, there is probably an header at the beginning of each file. Second, you must ensure that both files use a compatible format (and rate) or do appropriate convertion. Finally, you must probably update header information with things like new length. And you might also have to take into account somee alignment issues.

1 solution

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

Part 1:

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


Part 2:

under:
C#
public Form1()
        {
            InitializeComponent();
        }

enter code:
C#
[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


Part 3:

C#
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);


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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900