Click here to Skip to main content
15,941,973 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am trying to develop a Video Split option. For that i used FileStream. The Video file is readed into byte array.

C#
Byte[] byteSource = System.IO.File.ReadAllBytes(FileInputPath);
   fsSource.Write(byteSource, 0, byteSource.Length);


And like to split the Video. It is working for .mpg format. But in avi from starting point to any point this video is cutting well. But can't cut in between like from "mint 2 to mint 4". Is there any other way or how to do this. Please help me.
Posted
Updated 28-May-12 23:04pm
v2
Comments
MarqW 29-May-12 11:07am    
I can't help you on how to do it, but you can't just "chop" an AVI file in half. An AVI is what's known as a container and contains information about the streams contained within it. Such as video dimensions, codecs, audio bitrate, and length (time). To split the stream you need to create a new AVI with a new header with the new information
ssyuvaraja 29-May-12 22:46pm    
But i can split the mpg file. Only avi can't be split. That also if i split from start point to any point it is working. But if i split between only the video is not playing like 2nd mint to 4th mint.
MarqW 30-May-12 2:44am    
Yes, I just told you why you can't just do what you're doing. Files need headers to tell the video players details such as codecs used, how many streams there are etc. You are just copying a chunk of data into a file, players will not know how to process that data.

Also, how are you knowing where each "minute" (I'm assuming that's what you mean by "mint") occurs? Are you just dividing the file size by the length of time?

You really need to read up on file structures, or just use download an application - there are plenty of free ones

1 solution

You can't split an AVI like this. Avi has a frame index in the begining of the file, which references all the frames in the video. Copy & Split your video with FFMPEG. It will work for almost anything.

Your methood works with mpeg, because it's a stream format, it does not have an index in the begining of the file.
 
Share this answer
 

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