Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Maybe someone could help with the following problem. I need to write a viewer for Basler Usb cameras which will be able to write video to avi file using the selected codec. I'm using pylon sdk for creating application. And I faced the following problem - AviWriter object provided by pylon libraries doesn't write frames to avi file as effective as standard pylon viewer does. For testing I have chosen the following code sample which has been provided with pylon SDK:
internalstaticvoidMain(){int exitCode =0;int counter =0;try{using(Camera camera =newCamera()){
camera.Open();
camera.Parameters[PLCameraInstance.MaxNumBuffer].SetValue(1000);using(AviVideoWriter writer =newAviVideoWriter()){byte[] ar ={};
writer.Create("test.avi",35,PixelType.BGR8packed,1280,960,ImageOrientation.BottomUp,"msvc",100,0,1,ref ar,true,(IntPtr)null);
camera.StreamGrabber.Start(1000);//1000 frames are to be grabbedConsole.WriteLine("Please wait. Images are being grabbed.");while(camera.StreamGrabber.IsGrabbing){IGrabResult grabResult = camera.StreamGrabber.RetrieveResult(5000,TimeoutHandling.ThrowException);if(grabResult.GrabSucceeded){++counter;
writer.Write(grabResult);Console.WriteLine("------->images written"+ counter);Console.WriteLine("------->empty buffers"+ camera.Parameters[PLCameraInstance.NumEmptyBuffers].GetValue());//how many empty buffers left
grabResult.Dispose();}else{Console.WriteLine("Error: {0} {1}", grabResult.ErrorCode, grabResult.ErrorDescription);}}
camera.StreamGrabber.Stop();
writer.Close();}
camera.Close();}}catch(Exception e){Console.Error.WriteLine("Exception: {0}"
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that
you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice
sessions to improve your knowledge and scores.
manpreet
Best Answer
2 years ago
Maybe someone could help with the following problem. I need to write a viewer for Basler Usb cameras which will be able to write video to avi file using the selected codec. I'm using pylon sdk for creating application. And I faced the following problem - AviWriter object provided by pylon libraries doesn't write frames to avi file as effective as standard pylon viewer does. For testing I have chosen the following code sample which has been provided with pylon SDK: