• Announcements

Archived

This topic is now archived and is closed to further replies.

AVI File Seperator Utility

Recommended Posts

I''m trying to write a short little console based program that; loads an avi file cuts that avi file every 4 seconds and outputs that 4 seconds to a different file something like while(1) { int time; while( !inputfile.eof() ) { if( time == 4 ) { output 4 seconds to new file } } } or something.. Faet

Share on other sites
Goto wotsit and download some docs on AVI. You''ll want a basic understanding of the avi header (Number and names of streams, as well as the framerate), next learn the basics of the stream chunk, all you''ll need to know is how to identify a chunk and read its length value. Finally you''ll have to full understand the index chunk (at the end of the avi).

Here are the basics of the code you''ll need:
Read header and get framerateCalculate number of frames in 4 secondsfor each output file   write a copy of the header   copy the number of chunks (frames) need for 4 seconds   read the data from the index block (which indentifies keyframes) and write it to the end of the fileYou could also try looking at the win32 api function for reading and writing avi''s (start at AVIFILEOPEN) but I don''t think those functions will let you do direct stream copying, they''ll decompress and then recompress the file.One last solution is just to download virtualdub (search google, its freeware and available all over the place) which supports job scripts. You could simply make a prog that generates a script for virtualdub to cut and save the file, the use ShellExecute with parameters to run it.

• Partner Spotlight

• Forum Statistics

• Total Topics
627651
• Total Posts
2978406

• 10
• 12
• 22
• 13
• 33