private void makeVideo(string bmpDir, string distFile) { double Rate = 10; Avi.AVICOMPRESSOPTIONS aviformat = new Avi.AVICOMPRESSOPTIONS(); aviformat.cbFormat = 0; aviformat.cbParms = 4; aviformat.dwFlags = 8; aviformat.dwQuality = 7500; aviformat.fccHandler = 1668707181; AviManager aviManager = new AviManager(distFile, false); Bitmap bitmap0 = (Bitmap)Image.FromFile(@bmpDir + "0.bmp"); VideoStream aviStream = aviManager.AddVideoStream(aviformat, Rate, bitmap0); string[] bmpFiles = Directory.GetFiles(bmpDir, "*.bmp"); for (Int32 i = 1; i < bmpFiles.Length; i++) { Bitmap bitmap = (Bitmap)Bitmap.FromFile(bmpFiles[i]); aviStream.AddFrame(bitmap); bitmap.Dispose(); System.Threading.Thread.Sleep(5); } aviManager.Close(); }
public void DoCompressionWork() { AviManager videoManager = new AviManager(tempFilePath, true); VideoStream stream = videoManager.GetVideoStream(); Exception exception = null; VideoStream newStream = null; AviManager newManager = null; try { newManager = stream.DecompressToNewFile(finalFilePath, true, out newStream); } catch (Exception e) { exception = e; } finally { try { videoManager.Close(); } catch (Exception) { } try { newManager.Close(); } catch (Exception) { } } InvokeCompressionCompleteEvents(exception); isCompressionRunning = false; }
public VideoFrames(string fileLocation) { if (fileLocation == null) { _mode = Mode.None; return; } string lower = fileLocation.ToLower(); fileloc = fileLocation; if (lower.EndsWith(".avi")) { _aviManager = new AviManager(fileLocation, true); _aviStream = _aviManager.GetVideoStream(); _aviStream.GetFrameOpen(); _mode = Mode.Video; } else if (lower.EndsWith(".png")) { _singleFrame = new System.Drawing.Bitmap(fileLocation); _mode = Mode.SingleFrame; } else { _mode = Mode.None; } }
/// <summary> /// 将内存中的BitMap存为avi文件 /// </summary> /// <param name="filePath"></param> /// <param name="bm"></param> /// <returns></returns> public static bool MakeAviFile(string filePath, Bitmap bm) { try { int frameRate = BaseDefine.VIDEO_FRAME_RATE; AviManager aviMgr = new AviManager(filePath, false); VideoStream aviStream = aviMgr.AddVideoStream(false, frameRate, bm); for (int i = 1; i < frameRate; i++) { aviStream.AddFrame(bm); } aviMgr.Close(); } catch (Exception e) { Log.GetLogger().ErrorFormat("catch an error : {0}", e.Message); return(false); } if (!IsExistFile(filePath)) { Log.GetLogger().ErrorFormat("MakeAviFile 没有生成 avi 文件,filepath={0}", filePath); return(false); } //Log.GetLogger().DebugFormat("MakeAviFile end, filepath = {0}", filePath); return(true); }
public void Close() { if (aviManager != null) { try { lock (syncRoot) { aviManager.Close(); if (!string.IsNullOrEmpty(currentStoreName)) { store.Save(currentStoreName); } } } catch (Exception ex) { //todo } finally { aviManager = null; videoStream = null; } } }
public void StartVideo(String filePath, int frameRate, int width, int height, System.Drawing.Imaging.PixelFormat pixelFormat, int bytesPerPixel, bool isCompressed) { if (isVideoCaptureRunning || isCompressionRunning) { throw new Exception("Another video is currently being recorded or processed"); } compressThread = null; this.isCompressed = isCompressed; GetVideoFileNames(filePath, out this.finalFilePath, out this.tempFilePath); isVideoCaptureRunning = true; isCompressionRunning = false; String videoFilePath = finalFilePath; if (isCompressed) { videoFilePath = tempFilePath; } videoManager = new AviManager(videoFilePath, false); stream = videoManager.AddVideoStream(false, frameRate, width * height * bytesPerPixel, width, height, pixelFormat); }
private void btnWriteCompress_Click(object sender, System.EventArgs e) { FrameRateForm dlg = new FrameRateForm(); if (dlg.ShowDialog() == DialogResult.OK) { //load the first image Bitmap bitmap = (Bitmap)Image.FromFile(txtFileNames.Lines[0]); //create a new AVI file AviManager aviManager = new AviManager(@"..\..\testdata\new.avi", false); //add a new video stream and one frame to the new file VideoStream aviStream = aviManager.AddVideoStream(true, dlg.Rate, bitmap); int count = 0; for (int n = 1; n < txtFileNames.Lines.Length; n++) { if (txtFileNames.Lines[n].Trim().Length > 0) { bitmap = (Bitmap)Bitmap.FromFile(txtFileNames.Lines[n]); aviStream.AddFrame(bitmap); bitmap.Dispose(); count++; } } aviManager.Close(); } }
private static void EmbedAudio(string sourcePath) { String fileName = sourcePath + "\\2006 Bentley Continental Fly.wav"; using (var stream = File.Create(fileName)) { var speechEngine = new SpeechSynthesizer { Rate = 1, Volume = 100 }; speechEngine.SelectVoice(speechEngine.GetInstalledVoices()[0].VoiceInfo.Name); speechEngine.SetOutputToWaveStream(stream); var description = "Welcome to Newport Coast Auto. This's 2006 Bentley Continental Fly. "; description += "Amazing highly rated value carfax certified car with previous Beverley Hills owner. Great options available on the cars. Newport Coast Auto Invites You To Call 949-515-0800. With Any Questions Or To Schedule A Test Drive. The Entire Staff At Newport Coast Auto Are Dedicated And Experienced. We Always Strive To Provide A Level Of Service That Is Unsurpassed In Today's Busy And Automated World. Newport Coast Auto Offers Quality Pre-owned Vehicles At Competitive Prices. We Also Offer Extended Warranties, Financing, And Unmatched Customer Service. We Invite Trade-ins As Well"; speechEngine.Speak(description.Replace("***", ".").Replace("###", ".").Replace("*", "").Replace("#", "")); stream.Flush(); } var aviManager = new AviManager(sourcePath + "\\2006 Bentley Continental Fly.avi", true); aviManager.AddAudioStream(fileName, 1); //aviManager.AddAudioStream(sourcePath + "\\Test.wav", 1); aviManager.Close(); //var aviManager = new AviManager(sourcePath + "\\2006 Bentley Continental Fly.avi", true); ////aviManager.AddAudioStream(fileName, 1); //aviManager.AddAudioStream(sourcePath + "\\sound.wav", 1); //aviManager.Close(); }
private void btnAppend_Click(object sender, System.EventArgs e) { //open file Bitmap bmp = (Bitmap)Image.FromFile(txtFileNames.Lines[0]); AviManager aviManager = new AviManager(txtAviFileName.Text, true); VideoStream aviStream = aviManager.GetVideoStream(); //streams cannot be edited - copy to a new file VideoStream newStream; AviManager newManager = aviStream.DecompressToNewFile(@"..\..\testdata\temp.avi", true, out newStream); aviStream = newStream; //newManager.GetOpenStream(0); //add images Bitmap bitmap; for (int n = 0; n < txtFileNames.Lines.Length; n++) { if (txtFileNames.Lines[n].Trim().Length > 0) { bitmap = (Bitmap)Bitmap.FromFile(txtFileNames.Lines[n]); aviStream.AddFrame(bitmap); bitmap.Dispose(); } } //close old file aviManager.Close(); //save and close new file newManager.Close(); //delete old file, replace with new file System.IO.File.Delete(txtAviFileName.Text); System.IO.File.Move(@"..\..\testdata\temp.avi", txtAviFileName.Text); }
public void ExportToAVI(string file, bool createPal = false) { var frames = this.GetFrames(true); if (frames == null || frames.Length <= 0) { return; } if (createPal) { SavePalPalette(Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file) + ".pal")); } var avi = new AviManager(file, false); var bitdat = frames[0].LockBits(new Rectangle(0, 0, frames[0].Width, frames[0].Height), ImageLockMode.ReadOnly, PixelFormat.Format16bppArgb1555); var size = bitdat.Stride * frames[0].Height; frames[0].UnlockBits(bitdat); var stream = avi.AddVideoStream(false, 10.0, size, frames[0].Width, frames[0].Height, PixelFormat.Format16bppArgb1555); foreach (var frame in frames) { stream.AddFrame(frame); } avi.Close(); }
private void btnOpen_Click(object sender, EventArgs e) { if (editableStream != null) { editableStream.Close(); } AviManager file = new AviManager(txtAviFileName.Text, true); VideoStream stream = file.GetVideoStream(); editableStream = new EditableVideoStream(stream); file.Close(); numFirst.Maximum = editableStream.CountFrames - 1; numFirst.Value = 0; numPastePositionStream.Maximum = editableStream.CountFrames - 1; numPastePositionStream.Value = 0; numLast.Maximum = editableStream.CountFrames - 1; numLast.Value = editableStream.CountFrames - 1; if (numFrameRate.Maximum < (decimal)editableStream.FrameRate) { numFrameRate.Maximum = (decimal)editableStream.FrameRate; } numFrameRate.Value = (decimal)editableStream.FrameRate; panelEditor.Enabled = true; }
public void BuildArray_DoWork(object sender, DoWorkEventArgs e) { int temp = 0; if (arrayCounter <= 300) { FrameArray[arrayCounter] = NewFrame; Resume.Set(); arrayCounter++; } if (SaveVideo == true && SaveEnabled == true && arrayCounter == 301) { SaveEnabled = false; //User and program must re-request a video before saving again SaveVideo = false; AviManager aviManager = new AviManager(filePath + string.Format("{0:yyyy-MM-dd_hh-mm-ss-tt}", DateTime.Now) + "INTRUDER.avi", false); VideoStream aviStream = aviManager.AddVideoStream(true, 30, FrameArray[0]); while (temp < arrayCounter) { aviStream.AddFrame(FrameArray[temp]); temp++; } //aviStream.Close(); aviManager.Close(); Dispose(); } }
public void makeAvi() { FrameRateForm dlg = new FrameRateForm(); if (DialogResult.OK == dlg.ShowDialog()) { int framelength = 0; SaveFileDialog saveAvi = new SaveFileDialog(); Bitmap bmp = null; if (saveAvi.ShowDialog() == DialogResult.OK) { bmp = (Bitmap)Image.FromFile(pathBox.Items[0].ToString()); AviManager manageAVIFile = new AviManager(saveAvi.FileName.ToString() + ".avi", false); aviStream = manageAVIFile.AddVideoStream(true, dlg.Rate, bmp); Bitmap bitmap; for (framelength = 1; framelength < pathBox.Items.Count - 1; framelength++) { bitmap = (Bitmap)Bitmap.FromFile(pathBox.Items[framelength].ToString()); aviStream.AddFrame(bitmap); bitmap.Dispose(); } manageAVIFile.Close(); } } }
private void btnAddSound_Click(object sender, System.EventArgs e) { String fileName = GetFileName("Sounds (*.wav)|*.wav"); if (fileName != null) { txtReportSound.Text = "Adding to sound.wav to " + txtAviFileName.Text + "...\r\n"; AviManager aviManager = new AviManager(txtAviFileName.Text, true); try { int countFrames = aviManager.GetVideoStream().CountFrames; if (countFrames > numInsertWavePosition.Value) { aviManager.AddAudioStream(fileName, (int)numInsertWavePosition.Value); } else { MessageBox.Show(this, "Frame " + numInsertWavePosition.Value + " does not exists. The video stream contains frame from 0 to " + (countFrames - 1) + "."); } } catch (Exception ex) { MessageBox.Show(this, "The file does not accept the new wave audio stream.\r\n" + ex.ToString(), "Error"); } aviManager.Close(); txtReportSound.Text += "...finished."; } }
private void btnWrite_Click(object sender, System.EventArgs e) { FrameRateForm dlg = new FrameRateForm(); if (dlg.ShowDialog() == DialogResult.OK) { Bitmap bmp = (Bitmap)Image.FromFile(txtFileNames.Lines[0]); AviManager aviManager = new AviManager(@"..\..\testdata\new.avi", false); VideoStream aviStream = aviManager.AddVideoStream(false, dlg.Rate, bmp); Bitmap bitmap; int count = 0; for (int n = 1; n < txtFileNames.Lines.Length; n++) { if (txtFileNames.Lines[n].Trim().Length > 0) { bitmap = (Bitmap)Bitmap.FromFile(txtFileNames.Lines[n]); aviStream.AddFrame(bitmap); bitmap.Dispose(); count++; } } aviManager.Close(); } }
private void doExporting(string tmpFilePath, DirectoryInfo folder) { AviManager aviManager = new AviManager(tmpFilePath, false); bool first = true; Bitmap bitmap = null; VideoStream aviStream = null; foreach (FileInfo file in folder.GetFiles("*.dcm")) { DicomElement currentDicomElement = new DicomElement(file.FullName); if (first) { bitmap = currentDicomElement.Bitmap; aviStream = aviManager.AddVideoStream(createCompressedOptions(), Settings.Default.Fps, bitmap); first = false; } bitmap = currentDicomElement.Bitmap; aviStream.AddFrame(bitmap); } if (bitmap != null) { bitmap.Dispose(); } aviManager.Close(); }
private static void CombineAndSaveAv() { var manager = new AviManager("test.avi", true); manager.AddAudioStream("test.wav", 0); manager.Close(); }
private void BUT_start_Click(object sender, EventArgs e) { saveconfig(); try { m_mediaCtrl.Stop(); } catch { } try { frame = framecount; th.Abort(); } catch { } newManager = new AviManager(System.IO.Path.GetDirectoryName(txtAviFileName.Text) + System.IO.Path.DirectorySeparatorChar + System.IO.Path.GetFileNameWithoutExtension(txtAviFileName.Text) + "-overlay.avi", false); //newManager.Close(); startup(); this.MaximumSize = this.Size; this.MinimumSize = this.Size; }
private void btnExtractVideo_Click(object sender, System.EventArgs e) { txtReportCopy.Text = "Extracting " + txtAviFileName.Text + " to video.avi...\r\n"; AviManager aviManager = new AviManager(txtAviFileName.Text, true); VideoStream videoStream = aviManager.GetVideoStream(); videoStream.ExportStream(@"..\..\testdata\video.avi"); aviManager.Close(); txtReportCopy.Text += "...finished."; }
/// <summary> /// Создание анимации из файла *.avi (при этом палитра если возможно берется из одноименного файла *.pal) (TODO: поддрежка формата *.gif) /// </summary> /// <param name="file"></param> public void ImportFromFile(string file) { if (!File.Exists(file)) { return; } //Palette = new ushort[0x100]; //Frames = new List<FrameEdit>(); //idxextra = 0x00000000; // хз ClearFrames(); switch (Path.GetExtension(file)) { case ".avi": var filename = Path.Combine(Path.GetDirectoryName(file), Path.GetFileNameWithoutExtension(file)); var avi = new AviManager(filename + ".avi", true); var stream = avi.GetVideoStream(); stream.GetFrameOpen(); var frames = new Bitmap[stream.CountFrames]; for (int pos = 0; pos < stream.CountFrames; ++pos) { frames[pos] = stream.GetBitmap(pos); } stream.GetFrameClose(); avi.Close(); if (File.Exists(filename + ".pal")) { this.GetPalPalette(filename + ".pal"); } else { this.GetImagePalette(frames); } if (Frames == null) { Frames = new List <FrameEdit>(); } foreach (var frame in frames) { Frames.Add(new FrameEdit(frame, FrameEdit.GetSingleRect(frame), Palette, frame.Width / 2, -frame.Height / 4)); } //this.AddFrame(frame); break; case ".gif": throw new NotImplementedException(); break; default: throw new FileFormatException(); } }
public VideoTexture(SceneManager scm, float width, float height, string aviFileName) { AviManager aviMgr = new AviManager(aviFileName, true); Stream = aviMgr.GetVideoStream(); TexturePtr VideoTexture = TextureManager.Singleton.CreateManual( "Video", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, TextureType.TEX_TYPE_2D, Convert.ToUInt32(Stream.Width), Convert.ToUInt32(Stream.Height), 0, PixelFormat.PF_R8G8B8A8, (int)TextureUsage.TU_DYNAMIC_WRITE_ONLY_DISCARDABLE); MaterialPtr VideoMat = MaterialManager.Singleton.Create( "VideoMat", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); VideoMat.GetTechnique(0).GetPass(0).LightingEnabled = false; VideoMat.GetTechnique(0).GetPass(0).CreateTextureUnitState("Video"); PixelBuffer = VideoTexture.GetBuffer(); screen = scm.CreateManualObject("Screen"); screen.Dynamic = true; screen.Begin("VideoMat", RenderOperation.OperationTypes.OT_TRIANGLE_LIST); screen.Position(0, 0, 0); screen.TextureCoord(0, 0); screen.Position(width, 0, 0); screen.TextureCoord(1, 0); screen.Position(width, height, 0); screen.TextureCoord(1, 1); screen.Triangle(0, 1, 2); screen.Position(0, 0, 0); screen.TextureCoord(0, 0); screen.Position(width, height, 0); screen.TextureCoord(1, 1); screen.Position(0, height, 0); screen.TextureCoord(0, 1); screen.Triangle(3, 4, 5); screen.End(); SceneNode node = scm.RootSceneNode.CreateChildSceneNode(); node.Position = new Vector3(0, 0, 0); node.AttachObject(screen); Stream.GetFrameOpen(); FrameNum = 0; }
private void StopVideoCapture() { VideoSource.SignalToStop(); VideoSource.NewFrame -= NewVideoFrame; VideoSource.VideoSourceError -= VideoError; VideoSource = null; AviManager.Close(); AviManager = null; _aviStream = null; stopAll -= StopVideoCapture; }
private void btnSave_Click(object sender, EventArgs e) { SaveFileDialog dlg = new SaveFileDialog(); dlg.Filter = "Videos (*.avi)|*.avi;"; if (dlg.ShowDialog() == DialogResult.OK) { AviManager.MakeFileFromStream(dlg.FileName, editableStream); editableStream.Close(); editableStream = null; panelEditor.Enabled = false; } }
private void CopyFile(String newName, bool compress) { //open compressed file AviManager aviManager = new AviManager(txtAviFileName.Text, true); VideoStream aviStream = aviManager.GetVideoStream(); //create un-/re-compressed file VideoStream newStream; AviManager newManager = aviStream.DecompressToNewFile(newName, compress, out newStream); //close compressed file aviManager.Close(); //save and close un-/re-compressed file newManager.Close(); }
private void btnExtractWave_Click(object sender, System.EventArgs e) { txtReportSound.Text = "Extracting " + txtAviFileName.Text + " to sound.wav...\r\n"; AviManager aviManager = new AviManager(txtAviFileName.Text, true); try { AudioStream audioStream = aviManager.GetWaveStream(); audioStream.ExportStream(@"..\..\testdata\sound.wav"); aviManager.Close(); txtReportSound.Text += "...finished."; } catch (Exception ex) { MessageBox.Show(this, "The file does not contain a wave audio stream, or it cannot be opened.\r\n" + ex.ToString(), "No Stream Found"); } }
private static void GenerateVideoByAviManager(string sourcePath, string extension) { var dirInfo = new DirectoryInfo(sourcePath); var jpgFileList = new List <string>(); if (dirInfo.Exists) { jpgFileList.AddRange(dirInfo.GetFiles().Where(f => f.Extension.Equals(extension)).OrderBy(f => f.LastWriteTime).Take(30).Select(fileToUpload => sourcePath + "\\" + fileToUpload.Name)); } var bitmap = (Bitmap)Image.FromFile(jpgFileList.First()); var aviManager = new AviManager(sourcePath + "\\2006 Bentley Continental Fly.avi", false); var aviStream = aviManager.AddVideoStream(false, 0.2, bitmap); //aviStream = aviManager.AddVideoStream(false, 0.2, 400, 640, 360, PixelFormat.Format24bppRgb); jpgFileList.Skip(1).ToList().ForEach(file => { bitmap = (Bitmap)Bitmap.FromFile(file); aviStream.AddFrame(bitmap); bitmap.Dispose(); }); aviManager.Close(); String fileName = sourcePath + "\\2006 Bentley Continental Fly.wav"; using (var stream = File.Create(fileName)) { var speechEngine = new SpeechSynthesizer(); speechEngine.Rate = -1; speechEngine.Volume = 90; speechEngine.SelectVoice(speechEngine.GetInstalledVoices()[0].VoiceInfo.Name); speechEngine.SetOutputToWaveStream(stream); var description = "*** BEVERLY HILLS OWNED *** CARFAX CERTIFIED SUPPORTING A HIGHER RATED VALUE *** NEVER ANY NEGATIVE HISTORY *** CONVENIENCE PACKAGE WITH PRIVACY HANDSET AND BLUETOOTH *** MASSAGE SEATS *** MULTI-FUNCTION STEERING WHEEL *** 19\" 5-SPOKE SPORT ALLOY WHEELS AND NEW TIRES *** FRONT AND REAR HEATED AND COOLED SEATS * FRONT AND REAR 4-ZONE CLIMATE CONTROL * REAR PASSENGER SIDE WINDOW DEFROST * REAR PASSENGER POWER LUMBAR SEATS * DUAL MULTI ADJUST FRONT SEATS WITH LUMBAR AND LEG EXTENSION * FRONT AND REAR PARKING SENSORS * PREMIUM AUDIO WITH 6-DISC CD CHANGER * NAVIGATION * SOFT CLOSE DOORS * POWER REAR SUNSHADE * POWER BOOT/TRUNK OPEN AND CLOSE * XENON HEADLIGHTS * REAR TRUNK PASS-THROUGH * 2-TONE COLORED MULTI-FUNCTION STEERING WHEEL * REMOTE GARAGE DOOR OPENER * ALL BOOKS/OWNERS MANUALS AND KEYS (2)* Newport Coast Auto Invites You To Call 949-515-0800 Or Email [email protected] With Any Questions Or To Schedule A Test Drive. The Entire Staff At Newport Coast Auto Are Dedicated And Experienced. We Always Strive To Provide A Level Of Service That Is Unsurpassed In Today's Busy And Automated World. Newport Coast Auto Offers Quality Pre-owned Vehicles At Competitive Prices. We Also Offer Extended Warranties, Financing, And Unmatched Customer Service. We Invite Trade-ins As Well. *** *** SERVICED TO DATE AND COMPLETELY INSPECTED *** NEVER ANY ACCIDENTS OR NEGATIVE HISTORY *** ####### FREE CERTIFIED CARFAX ON EVERY VEHICLE JUST BY VISITING NEWPORTCOASTAUTO.COM ####### 1.99% APR FINANCING ON APPROVED CREDIT ######## Newport Coast Auto Invites You to Call 949-515-0800 or Email [email protected]"; speechEngine.Speak(description.Replace("***", ".").Replace("###", ".").Replace("*", "").Replace("#", "")); stream.Flush(); } aviManager = new AviManager(sourcePath + "\\2006 Bentley Continental Fly.avi", true); //int countFrames = aviManager.GetVideoStream().CountFrames; //for (int i = 1; i < countFrames; i += 50) //{ // aviManager.AddAudioStream(fileName, i); //} aviManager.AddAudioStream(fileName, 1); aviManager.Close(); }
/** Metoda care se foloseste de bibliotecile AviManager pentru a * crea un stream video dintr-o lista de imagini format bitmap. **/ private void createMovie(String fileName, List <Bitmap> images) { AviManager aviManager = new AviManager(fileName, false); VideoStream videoStream = aviManager.AddVideoStream(false, 30, images.ElementAt(0)); foreach (var image in images) { if (finalFrames.IndexOf(image) != 0) { videoStream.AddFrame(image); } } aviManager.Close(); }
private void persistableOutput_ImageCaptured(object sender, ImageCapturedEventArgs e) { if (record) { aviManager = new AviManager(e.ImageNames.FullSize, false); stream = aviManager.AddVideoStream(true, 10, (Bitmap)e.FullSizeImage); recordTimer.Start(); } else { recordTimer.Stop(); aviManager.Close(); } }
private void startToConvert_Click(object sender, EventArgs e) { AviManager aviManager = new AviManager(fileNameText.Text, true); VideoStream stream = aviManager.GetVideoStream(); stream.GetFrameOpen(); fileName = fileNameText.Text; int length = fileName.Length, j; for (j = length - 1; j > 0; j--) { if (fileName[j] != '\\') { newfileName += fileName[j]; } else { break; } } fileName = ""; for (j = newfileName.Length - 1; j >= 0; j--) { fileName += newfileName[j]; } fileName = fileName.ToLower(); j = 0; path = ""; for (j = 0; j < fileNameText.Text.Length - fileName.Length; j++) { path += fileNameText.Text[j]; } int startFrame = Convert.ToInt32(startPointTrackerText.Text); int endFrame = Convert.ToInt32(endPointTrackerText.Text); string bmpname = ""; int ali = 0; for (int n = startFrame; n < endFrame; n++) { bmpname = ali.ToString(); stream.ExportBitmap(n, "c:/temp/" + bmpname + ".bmp"); pathBox.Items.Add("c:/temp/" + bmpname + ".bmp"); ali++; startPointTracker.Value = n; textBox3.Text = n.ToString(); } stream.GetFrameClose(); aviManager.Close(); makeAvi(); }
public CaptureThread(string saveLoc) { _saveLoc = saveLoc; _aviManager = new AviManager(saveLoc, false); _windowCapture = new WindowStreamCapture(); _exitEvent = new AutoResetEvent(false); _pool = new BitmapPool(); _running = false; UsePrintWindow = true; frame_num = 0; }
/// <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; }