OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to detect if a video is progressive or interlaced?

  • Thread starter Thread starter Eelco
  • Start date Start date
E

Eelco

Guest
I'm writing some Python 3 code to analyze uploaded videos, but I'm unsure how to determine if the video is progressive or interlaced. It's probably somewhere in one of the cv2.CAP_PROP_.... properties, but I'm not sure which one. How can I detect if the video is progressive or interlaced?

Code:
cam: cv2.VideoCapture = cv2.VideoCapture(filename)

if cam.isOpened():
    video_codec: str = cam.get(cv2.CAP_PROP_FOURCC)
    video_fps: int = cam.get(cv2.CAP_PROP_FPS)
    video_height: int = cam.get(cv2.CAP_PROP_FRAME_HEIGHT)
    video_width: int = cam.get(cv2.CAP_PROP_FRAME_WIDTH)
    total_frames: int = cam.get(cv2.CAP_PROP_FRAME_COUNT)
    length: int = int(total_frames / video_fps)
    audio_samplerate: int = cam.get(cv2.CAP_PROP_AUDIO_SAMPLES_PER_SECOND)
    audio_channels: int = cam.get(cv2.CAP_PROP_AUDIO_TOTAL_CHANNELS)
<p>I'm writing some Python 3 code to analyze uploaded videos, but I'm unsure how to determine if the video is progressive or interlaced. It's probably somewhere in one of the <code>cv2.CAP_PROP_....</code> properties, but I'm not sure which one. How can I detect if the video is progressive or interlaced?</p>
<pre><code>cam: cv2.VideoCapture = cv2.VideoCapture(filename)

if cam.isOpened():
video_codec: str = cam.get(cv2.CAP_PROP_FOURCC)
video_fps: int = cam.get(cv2.CAP_PROP_FPS)
video_height: int = cam.get(cv2.CAP_PROP_FRAME_HEIGHT)
video_width: int = cam.get(cv2.CAP_PROP_FRAME_WIDTH)
total_frames: int = cam.get(cv2.CAP_PROP_FRAME_COUNT)
length: int = int(total_frames / video_fps)
audio_samplerate: int = cam.get(cv2.CAP_PROP_AUDIO_SAMPLES_PER_SECOND)
audio_channels: int = cam.get(cv2.CAP_PROP_AUDIO_TOTAL_CHANNELS)
</code></pre>
 
Top