how can i get the min/max brightness in every frame of a recorded video?

i want to get the value of min/max every frame of recorded video?
what should i use?
how it works?