0

I am trying to split a large AVI 2.0 (OpenDML format) file in smaller parts (under 1GB in my case) in order to be able to open the parts with VFW (avifil32.dll).

What is the best way to achieve this splitting (preferably in C#)?

One of the options is to copy it frame by frame. I found some examples on the net, which do the same. But most of these use VFW which can't read files above 2GB in general and AVI 2.0 files above 1GB because of the max RIFF part size of 1GB.

I would need DirectShow instead of VFW. I am pretty sure that I would also mess up the audio sync if I try to manually copy frames.

I am looking for something similar to what VirtualDub does with "direct stream copy" that doesn't affect the current compression, just splits the file and creates proper AVI indexes.

Oak Bytes
  • 4,649
  • 4
  • 36
  • 53
Vlad
  • 85
  • 1
  • 7
  • I found a good starting point using DirectShow and a simple filter file in -> avi splitter -> avi mux -> file out with no compression filter in between. For reference: http://social.msdn.microsoft.com/Forums/en-US/windowsdirectshowdevelopment/thread/ca127590-a35f-4928-a75f-785b4a4cae0f http://msdn.microsoft.com/en-us/library/ms779733%28VS.85%29.aspx – Vlad Nov 27 '09 at 10:38

2 Answers2

2

Avi files can be encoded in many different ways, depending on the codec used. Avi is a wrapper file, not an encoding method. This means there isn't really an easy generic way to split avi files using C#.

To do it in code from scratch would be a major undertaking. That said, you can cheat by using mencoder and calling it from c# - not ideal, but far easier and more reliable than trying to re-invent the wheel. Alternatively, there are a number of ffmpeg c# wrappers that will give you access the ffmpeg tools (but I haven't found one that isn't buggy as hell)

What are you trying to do, exactly? Why do you need avifil32.dll and how are you using it? If you are just trying to play a very large avi file, there are alternatives. Try aforge.net, for example.

Sugrue
  • 3,629
  • 5
  • 35
  • 53
  • 1
    Heh, it's been 2 years since I asked that question, in the meanwhile I started using ffmpeg and so don't need to split the files to get around VFW file size limitations. I've got my own ffmpeg wrapper but I see aforge.net also uses ffmpeg so I'll check it out to see if their implementation is better than what I got. Thanks for the hint. – Vlad Nov 18 '11 at 08:50
1

mencoder can split files for you. Another option is ffmpeg

John Paulett
  • 15,596
  • 4
  • 45
  • 38