Skip to main content

OpenCV - Show Video Properties with python

Hi Guyz,

In this tutorial, I will discuss the video properties and how to view the video properties of any video file using OpenCV. 

A video file contains different types of properties like width, height, frames, etc. Sometimes it is required to take out these basic video details. In order to make this work, easy OpenCV comes with built-in properties to ease out the work for developers.

video = cv.VideoCapture("video.mp4")video.get(0)

OpenCV has a function named get(propId).
Which takes property Identifier as an argument.

There are total 22 property identifiers that OpenCV supports. 

List of Property Identifiers

One can also modify the properties of video file using set function.

This function takes two arguments.

 1. Index
 2. Property Identifier

In case, You want to modify the width and height of the video file.

video.set(3,320) # Width
video.set(4,480) # Height

Program

#import cv2 moduleimport cv2 as cv#This function shows the properties of a video filedef showProperties():    print('Current position - '+str(video.get(0)))    print('Frames POS - '+str(video.get(1)))    print('Ratio - '+str(video.get(2)))    print('Width - '+str(video.get(3)))    print('Height - '+str(video.get(4)))    print('FPS - '+str(video.get(5)))    print('FOURCC - '+str(video.get(6)))    print('Frame Count - '+str(video.get(7)))    print('Format - '+str(video.get(8)))    print('Mode - '+str(video.get(9)))    print('Brightness - '+str(video.get(10)))    print('Contrast - '+str(video.get(11)))    print('Saturation - '+str(video.get(12)))    print('Hue - '+str(video.get(13)))    print('Gain - '+str(video.get(14)))    print('Exposure - '+str(video.get(15)))    print('Convert RGB - '+str(video.get(16)))    print('White Balance U - '+str(video.get(17)))    print('White Balance V - '+str(video.get(18)))    print('Rectification - '+str(video.get(19)))    print('ISO SPEED - '+str(video.get(20)))    print('Buffer Size - '+str(video.get(21)))            while True:    ret,frame = video.read()    cv.imshow('video',frame)    if cv.waitKey(30) & 0xFF == ord('q'):        #Click q key will trigger this function.        showProperties()        breakvideo.release()cv.destroyAllWindows()

Don’t forget to check my other OpenCV Tutorials

Thanks for reading 🙂 🙂

Comments

Popular posts from this blog

3D ANALYZER SETTINGS

Settings for Prince of Persia Sands of Time Works with this game, u can try wid others also which are not in above list Performance section: -force zBuffer Hardware limits: -emulate HW TnL caps -emulate Pixel shader caps ANTI-DETECT MODE section: -shaders Z-buffer section: -24 bit zbuffer(with stencil) DirectX DeviceID’s section: NVIDIA GeForce Ti4600 Configuration: VendorID : 4318 Device ID :592 Works well in the following or higher configuration -Intel 865GSA motherboard, -512 MB RAM, -Pentium D dual core 2.66 GHz processor, -No graphics card required…….. have fun.

SMACKDOWN HERE COMES THE PAIN PCSX2 SETTINGS

Smack Down Here Comes The Pain Configuration: GRAPHICS-GSDX 1600(MSVC 15.00 SSSE3)0.1.15 CONTROLLERS-LILLY PAD 0.10.0 CDVDROM-EPP POLLING CDVD DRIVER 0.4.0 USB-USB NULL DRIVER 0.6.0 SOUND-SPU2-X1.1.0 SECOND CONTROLLER-LILLY PAD 0.10.0 DEV9-DEV9NULL DRIVER-0.4.0 FIRE WIRE-FWNULL DRIVER 0.5.0 BIOS-EUROPE V01.60(04/10/2001)CONSOLE SYSTEM REQUIREMENTS FOR PCSX2- MINIMUM - * Windows/Linux OS * CPU: Any that supports SSE2 (Pentium 4 and up, Athlon64 and up) * GPU: Any that supports Pixel Shader model 2.0, except Nvidia FX series (broken SM2.0, too slow anyway) * 512mb RAM (note Vista needs at least 2gb to run reliably) RECOMMENDED - * Windows Vista 32bit/64bit with the latest DirectX * CPU: Intel Core 2 Duo @ 3.2ghz or better * GPU: 8600gt or better (for Direct3D10 support) * RAM: 1gb on Linux/Windows XP, 2gb or more on Vista MY SYSTEM REQUIREMENTS WINDOWS XP SP3 PENTIUM DUAL CORE 2.6GHZ (E5300) 2GB RAM ZOTAC 8400GS 512MB DIRECT-X 9...

list of games runs on 3d analyser

18 Wheels of Steel : Extreme Trucker (Use addgame. reg tweak and select DirectX in the game's settings window. Tested on win7) A Africa Corps vs. Desert Rats ( XP ONLY) Age of Empires II The Age of Kings + The Conquero rs Expansio n Age of Empires III + The Warchief s + The Asian Dynastie s Age of Mytholog y + Titans Expansio n Aggressi on: Reign Over Europe (Using 3DAnalyz er: all textures work but too slow. FPS is unplayab le status. Try Swiftwsh ader) Aion Online AirStrik e 3D II Alpha Prime Alien Shooter Alien Shooter 2 America's Secret Operatio ns Anno 1404 Dawn Of Discover y (3D Analyzer-Emulate Hardware Tnl) Area 51 (Version 1.2 patch) Armies of Exigo (Works with Medium Settings with Swiftsha der) ASHES Cricket 2009 - Demo (Windows 7 with modded driver and 'addgame. reg' Tweak) Audiosur f Avencast-Rise of the mage Armed and Dangerou s (3DAnalyz e) Attack on Pearl Harbor ( Dogfight game, playable at pretty high setting) B ...