Click here to Skip to main content
11,705,212 members (51,556 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Video
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);

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 5-Feb-13 21:00pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 525
1 OriginalGriff 244
2 ppolymorphe 126
3 F-ES Sitecore 110
4 Andy Lanng 85
0 OriginalGriff 8,988
1 Sergey Alexandrovich Kryukov 8,272
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,606

Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 6 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100