Getting all the properties from the video capture object

First, we create the read_video_file_all_properties.py script to show all the properties. Some of these properties only work when we're working with cameras (not with video files). In these cases, a 0 value is returned. Additionally, we have created the decode_fourcc() function, which converts the value that's returned by capture.get(cv2.CAP_PROP_FOURCC) as a string value that contains the int representation of the codec. In this sense, this value should be converted into a four-byte char representation to output the codec properly. Therefore, the decode_fourcc() function copes with this.

The code of this function is given as follows:

def decode_fourcc(fourcc):    """Decodes the fourcc ...

Get Mastering OpenCV 4 with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.