Click here to Skip to main content
Rate this: bad
good
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);
    }
    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 5-Feb-13 22:00pm

1 solution

Rate this: bad
good
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.
  Permalink  

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 575
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,476
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,917


Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 6 Feb 2013
Copyright © CodeProject, 1999-2014
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