c# - "Parameter is not valid" When getting a frame from an avi file. -
so have code here pulls out frames avi file, makes clone of them, , stores them in array. after few hundred times, error saying "parameter not valid." i've searched around answers, answers when works once, doesn't work again. 1 on average executes these lines 490 times before error occurs. wondering if 1 of tell me what's wrong here? also, file = null changed later down in code have value, in case think that's got error.
help: i'm using aforge.video.vfw; aviwriter , reader, , i'm calling void in different thread.
sorry if isn't enough. first question i've ever asked on here.
aviwriter writer = new aviwriter("wmv3"); avireader reader = new avireader(); string file = null; bitmap[] aviimages = new bitmap[1]; int imagesprocessed = 0; double progressvalue = 0; private void getimages() { reader.open(file); while (reader.position - reader.start < reader.length) { application.doevents(); aviimages[imagesprocessed] = (bitmap)reader.getnextframe().clone(); imagesprocessed++; progressvalue = (int)((double)imagesprocessed / (double)reader.length * 100); array.resize(ref aviimages, imagesprocessed + 1); thread.sleep(10); } reader.close(); picwaiting.visible = false; lblwaiting.text = "done!"; timeupdateprogressbar.stop(); }
c# "parameter not valid." creating new bitmap
seems why happens memory wasted on bitmaps, can't store bitmaps @ 1 time.
you create 490 bitmaps.. figure out limit , either stop there or start overwriting old bitmaps
Comments
Post a Comment