/// <summary>Get the first video stream - usually there is only one video stream</summary> /// <returns>VideoStream object for the stream</returns> public VideoStream GetVideoStream() { IntPtr aviStream; int result = Avi.AVIFileGetStream( aviFile, out aviStream, Avi.streamtypeVIDEO, 0); if(result != 0){ throw new Exception("Exception in AVIFileGetStream: "+result.ToString()); } VideoStream stream = new VideoStream(aviFile, aviStream); streams.Add(stream); return stream; }
/// <summary>Add an empty video stream to the file</summary> /// <param name="isCompressed">true: Create a compressed stream before adding frames</param> /// <param name="frameRate">Frames per second</param> /// <param name="firstFrame">Image to write into the stream as the first frame</param> /// <returns>VideoStream object for the new stream</returns> public VideoStream AddVideoStream(bool isCompressed, double frameRate, Bitmap firstFrame) { VideoStream stream = new VideoStream(aviFile, isCompressed, frameRate, firstFrame); streams.Add(stream); return stream; }
/// <summary>Add an empty video stream to the file</summary> /// <param name="isCompressed">true: Create a compressed stream before adding frames</param> /// <param name="frameRate">Frames per second</param> /// <param name="frameSize">Size of one frame in bytes</param> /// <param name="width">Width of each image</param> /// <param name="height">Height of each image</param> /// <param name="format">PixelFormat of the images</param> /// <returns>VideoStream object for the new stream</returns> public VideoStream AddVideoStream(bool isCompressed, double frameRate, int frameSize, int width, int height, PixelFormat format) { VideoStream stream = new VideoStream(aviFile, isCompressed, frameRate, frameSize, width, height, format); streams.Add(stream); return stream; }
/// <summary>Add an empty video stream to the file</summary> /// <remarks>Compresses the stream without showing the codecs dialog</remarks> /// <param name="compressOptions">Compression options</param> /// <param name="frameRate">Frames per second</param> /// <param name="firstFrame">Image to write into the stream as the first frame</param> /// <returns>VideoStream object for the new stream</returns> public VideoStream AddVideoStream(Avi.AVICOMPRESSOPTIONS compressOptions, double frameRate, Bitmap firstFrame) { VideoStream stream = new VideoStream(aviFile, compressOptions, frameRate, firstFrame); streams.Add(stream); return stream; }
/// <summary>Copy all frames into a new file</summary> /// <param name="fileName">Name of the new file</param> /// <param name="recompress">true: Compress the new stream</param> /// <returns>AviManager for the new file</returns> /// <remarks>Use this method if you want to append frames to an existing, compressed stream</remarks> public AviManager DecompressToNewFile(String fileName, bool recompress, out VideoStream newStream2) { AviManager newFile = new AviManager(fileName, false); this.GetFrameOpen(); Bitmap frame = GetBitmap(0); VideoStream newStream = newFile.AddVideoStream(recompress, frameRate, frame); frame.Dispose(); for(int n=1; n<countFrames; n++){ frame = GetBitmap(n); newStream.AddFrame(frame); frame.Dispose(); } this.GetFrameClose(); newStream2 = newStream; return newFile; }