Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public void JoiningVideo()
{
    string j = @"D:/test2";

    string outputpath = @"D:/test3/beforeEventab1.wmv";
    DirectoryInfo di = new DirectoryInfo(j);
    FileStream fs;
    fs = new FileStream(outputpath, FileMode.Append);
    foreach (FileInfo fi in di.GetFiles(@"*.wmv"))
    {
        byte[] bytesource = System.IO.File.ReadAllBytes(fi.FullName);
        fs.Write(bytesource, 0, bytesource.Length);
    }
    fs.Close();
}



This following is a code to join two videos. When I run the program it joins two videos and puts joined video in a folder. The joined video size is correct as it should be.

But when I play the video it plays the first part of the video in WMP but when i play the video in VLC it plays the second part of video.
Posted

1 solution

You can't just bolt two files together and expect them to magically work out how to reorganise themselves!

Video files are complex objects, with multiple streams inside - to join two videos, you need to append the video streams together, and append the audio stream together separately. What you have done is weld a car onto the front of your existing car and expect it to magically become a stretched limousine!

If you want to join videos, then look at VirtualDubMod - it's open source (it doesn't join files very well but you can get the source). I use AviDemux[^] when I want to - it's source isn't available, but it's free and does a pretty good job.
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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