I want to split my videos (my videos from 10GB To 100GB) to smaller part by size (not time). For example, convert a 20GB video to 10 * 2GB Video And each of these videos can be played and used.
I used this example but the videos made are not playable
private static void ReadFile(string filePath)
{
const int MAX_BUFFER = 1048576; //1MB
byte[] buffer = new byte[MAX_BUFFER];
int bytesRead;
int noOfFiles = 0;
using (FileStream fs = File.Open(filePath, FileMode.Open, FileAccess.Read))
using (BufferedStream bs = new BufferedStream(fs))
{
while ((bytesRead = bs.Read(buffer, 0, MAX_BUFFER)) != 0) //reading 1mb chunks at a time
{
noOfFiles++;
//Let's create a small size file using the data. Or Pass this data for any further processing.
File.WriteAllBytes($"Test{noOfFiles}.txt", buffer);
}
}
}
I also saw this: Splitting a video in four files in C# but this cut a video by time/sec.
So how can I do this with C# ?