How do you retrieve the four-character codec code from a VideoCapture object in OpenCV 4? When I try to inspect it I get a float:
import cv2
movie_name = 'fubar.mp4'
movie = cv2.VideoCapture(movie_path)
codec_code = movie.get(cv2.CAP_PROP_FOURCC)
print(codec_code)
This prints out something like 828601953.0. There are lots of threads about how to create a codec code, but I haven't found any on how to extract and read one out from an arbitrary VideoCapture object in Python.
I know the name of the file is informative (mp4) but that doesn't really specify the exact four-character encoding that I'm after (say, if I want to resave as a new movie after some processing, or just display the code to the user as metadata).
Related Thread
There is a thread on how to do this in C++ if anyone can translate to Python that would be the answer I suppose:
Qt or OpenCV: print out the codec of a video file