I am trying to see what quality of videos I have on my computer.
Is there anything in VBA that will show me the Frame Height & Frame Width
My ultimate goal is to get a list of folders, file names, and their frame height/width so I can see if any are poor quality.
Thanks!
File Frame Height/Width
-
- 3StarLounger
- Posts: 263
- Joined: 01 Mar 2010, 17:34
- Location: Blue Springs, MO
File Frame Height/Width
Morgan
-
- Administrator
- Posts: 80237
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: File Frame Height/Width
Something to get you started. Set a reference (using Tools > References...) to the Microsoft Shell Controls and Automation library.
Sample output:
PXL_20220407_083700483.mp4 1920 1080
PXL_20220419_125707926.mp4 1920 1080
There are no doubt better ways.
Code: Select all
Sub Test()
Dim strFolder As String
Dim strFile As String
Dim arr
strFolder = "C:\Some Folder\" ' Change to a folder with videos
strFile = Dir(strFolder & "*.mp4")
Do While strFile <> ""
arr = GetHeightAndWidth(strFolder, strFile)
Debug.Print strFile, arr(0), arr(1)
strFile = Dir
Loop
End Sub
Function GetHeightAndWidth(strFolder As String, strFile As String)
Dim objShell As Shell32.Shell
Dim objFolder As Shell32.Folder
Dim objFile As Shell32.FolderItem
Dim varFrameHeight, varFrameWidth
Set objShell = New Shell32.Shell
Set objFolder = objShell.Namespace(strFolder)
Set objFile = objFolder.ParseName(strFile)
varFrameHeight = objFolder.GetDetailsOf(objFile, 316)
varFrameWidth = objFolder.GetDetailsOf(objFile, 314)
GetHeightAndWidth = Array(varFrameHeight, varFrameWidth)
End Function
PXL_20220407_083700483.mp4 1920 1080
PXL_20220419_125707926.mp4 1920 1080
There are no doubt better ways.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 754
- Joined: 27 Jun 2021, 10:46
Re: File Frame Height/Width
or ... set the same reference as advised by HansV,
but then use:
(and perhaps peek at https://eileenslounge.com/viewtopic.php ... 55#p313555 for some background ...)
but then use:
Code: Select all
Public Sub test()
Dim objShell As Shell
Dim objFolder As Folder
Set objShell = New Shell
Set objFolder = objShell.Namespace("D:\downloads\deletemesoon") 'folder
With objFolder.ParseName("annefrankCh.mp4") 'file
Debug.Print "Width: " & .ExtendedProperty("System.Video.FrameWidth")
Debug.Print "Height: " & .ExtendedProperty("System.Video.FrameHeight")
End With
End Sub
-
- 3StarLounger
- Posts: 263
- Joined: 01 Mar 2010, 17:34
- Location: Blue Springs, MO
-
- 5StarLounger
- Posts: 804
- Joined: 18 Jan 2022, 15:59
- Location: An Englishman, illegally re-routing rivers, in Hof, Beautiful Bavaria. Rule, Britannia!
Re: File Frame Height/Width
HiSpeakEasy wrote: ↑31 Mar 2024, 15:33(and perhaps peek at https://eileenslounge.com/viewtopic.php ... 55#p313555 for some background ...)
There is a lot there to get lost in at that Thread. Probably does not do any harm to read it all through. But for just the .Extended Property stuff, these would be the main posts
https://www.eileenslounge.com/viewtopic ... 61#p313961
https://www.eileenslounge.com/viewtopic ... 71#p313971
( https://www.excelfox.com/forum/showthre ... #post23971
https://www.excelfox.com/forum/showthre ... #post23972 )
Alan
Regards , Ālan , DocÆlstein
, 

