I need some help. I have created an app that will search a folder for given file extensions. ie jpg
My app will then list these files in a grid in column 1. ie C:\Somefolder\Somepic 001.jpg
each file is then read to extract the date of creation.
I then use this info to populate the 2nd column to where i want to move files ie F:\Newfolder\2018\November\Somepic 001 23-11-2018 14-12-12.jpg
as you can see i use the creation date to rename file.
As there are quite a lot of files to check, if say i get 1/4 of way through list and i cancel the scan. I can then run the copy to
copy files to new location. ( at this point i am not deleting the source files)
Now this is where i need help/advise.
I want to be able to save a list of what i have done , so when i scan again, i can skip files that have already been moved.
or list the files already moved without having to read in the dates again as each files takes approx 1 sec to extract info.
What data do you think i need to save/compare and how would i go about reloading into list.
Not sure i have explained it well enough, but hope someone gets the gist.
well I would move the Files first to the new Location, and then Rename them.
this is a simpe way of moving and writing waht you moved to a Textfile
Code:
Private Sub Command3_Click()
Dim command As String
'Move Files::
command = "move E:\filesplit\*.* E:\MoveBackup\"
'write to Textfile what was moved
Shell "cmd.exe /c " & command & "> ""E:\MovedFiles.txt"""
End Sub
perhaps you should look into API's for File move/ copy etc...
regards
Chris
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
well I would move the Files first to the new Location, and then Rename them.
this is a simpe way of moving and writing waht you moved to a Textfile
Code:
Private Sub Command3_Click()
Dim command As String
'Move Files::
command = "move E:\filesplit\*.* E:\MoveBackup\"
'write to Textfile what was moved
Shell "cmd.exe /c " & command & "> ""E:\MovedFiles.txt"""
End Sub
perhaps you should look into API's for File move/ copy etc...
regards
Chris
thanks for reply chris. However, i already have the movement of files etc working.
Just looking for advise/help with a snapshot of what has already been moved so that when/if i rescan a folder
i know where i was and carry on moving files etc.
As suggested in #2, you should maintain an addtional reference/lookup file, may be a text file so that you can store what has successfully copied from the source locaiton.
Now, when you look at the same source location again for scanning and reloading, just compare and consider the files excluding what is in your reference file.
So update/append and maintain the reference file for each successful file copy until you copy all the files.
At the end you can delete the reference file.
--------------------------------
Another possibility, only if you do not care about modifying your source file attributes is, change the default file attribute to "system" once you successfully copied a file. Next time, you can only consider the files without "System" attribute in the source location.
As suggested in #2, you should maintain an addtional reference/lookup file, may be a text file so that you can store what has successfully copied from the source locaiton.
Now, when you look at the same source location again for scanning and reloading, just compare and consider the files excluding what is in your reference file.
So update/append and maintain the reference file for each successful file copy until you copy all the files.
At the end you can delete the reference file.
--------------------------------
Another possibility, only if you do not care about modifying your source file attributes is, change the default file attribute to "system" once you successfully copied a file. Next time, you can only consider the files without "System" attribute in the source location.
OK, regarding the reference/lookup file. what would be the best format/file type or create my own. I would need to check the reference file for each file to see if its in reference file and if
it has been processed.
would i be best to read the file on the fly or load in to an array or collection. Bearing in mind the amount of files i am looking to process are in the region
of 25,000.
My app works in 2 processes.
1. Scan each image file and get creation date. Use the creation date to create a new file name and location.
ie. Column1 - Source = C:\Somefolder\Some Image.jpg Column2 - Destination F:\Newfolder\<Year>\<Month>\Some Image <Date Time>.jpg
This is the process that takes time and this is where the reference file will be needed.
If i cancel scan at say 9000 of 25,000. I now have option to Copy files to new location. ie Step 2.
2. Now i have my 2 columns Source & Destination. I can then click a Run button that will process this list to move the files.
If i scanned 9000 and then copied these to new location , next scan i would need a fast way to check 9000 files that i have copied and only scan/process from there on wards.
Its like an Incremental backup. If new images get added to the C:\Somefolder\ I dont want to scan/process the 9000 that i have already dealt with.
I want to be able to save a list of what i have done , so when i scan again, i can skip files that have already been moved.
or list the files already moved without having to read in the dates again as each files takes approx 1 sec to extract info.
Wow. What are you doing that takes that long? What info are you retrieving besides the file name and creation date?
This seems pretty quick. It doesn't do any moving but it has a "moved" attribute you can set by double-clicking it for an item. Of course it runs faster on a second run, probably due to caching in Windows.
When it exits it rolls out all of the "moved" items to a persisted fabricated Recordset. Then when it starts again and finds the persisted Recordset it loads and displays those "moved" rows, and does a fresh scan for files. Any files already in the "moved" list are not added a second time.
I suspect that the modified/last write timestamp would make more sense though. Usually you copy photo files around from some source and the creation will reflect when the file was copied, not really when it was created.
Or are you extracting "creation" from within the photo's EXIF data instead of from the filesystem?
The Shell Extended Property System.Photo.DateTaken can retrieve that if you need it, but it will slow things down to retrieve it.
If you want to look at the persisted data change .Save SAVED_MOVES, adPersistADTG to adPersistXML and change SAVED_MOVES to something like "saved.xml" or even "save.txt" so you can open it with Notepad. XML is bulkier and slower but at least it is plain text.
Oh, the name "Scantastic" wasn't bragging but self-deprecating sarcasm. This was just a quick and dirty example based on code I already had on hand so it may be full of bugs around edge cases and general silliness. It definitely needs more testing, so don't hesitate to mention problems you find.
I already found a comment near the top of DirW.cls about Currency vs. FILETIME that should have been deleted because this version of DirW does use the FILETIME now.
Last edited by dilettante; Nov 11th, 2018 at 03:56 AM.
Wow. What are you doing that takes that long? What info are you retrieving besides the file name and creation date?
This seems pretty quick. It doesn't do any moving but it has a "moved" attribute you can set by double-clicking it for an item. Of course it runs faster on a second run, probably due to caching in Windows.
When it exits it rolls out all of the "moved" items to a persisted fabricated Recordset. Then when it starts again and finds the persisted Recordset it loads and displays those "moved" rows, and does a fresh scan for files. Any files already in the "moved" list are not added a second time.
I suspect that the modified/last write timestamp would make more sense though. Usually you copy photo files around from some source and the creation will reflect when the file was copied, not really when it was created.
Or are you extracting "creation" from within the photo's EXIF data instead of from the filesystem?
The Shell Extended Property System.Photo.DateTaken can retrieve that if you need it, but it will slow things down to retrieve it.
Hi dilettante
thanks for response. I use Freeimage.dll to get the creation date/time. this is what takes the 1 second to read each file.
I am looking to save a reference file with info from a scan. If i got so far through and it does take time, to cancel scan.
I then either have the option to copy files so far or exit app.
On a new scan of same folder, I don't want to re-scan all these files. I would want to load back in what i have scanned so far
ie Source in col 1 , Destination in column 2 and then carry on scanning from where i left off.
I would poss check that source is still there ready to copy but also check destination to see if its already been copied.
The help i need is, I just need to find the best/quickest way to create the reference file and best/quickest way to read file.
Do i create my own file format or use an existing method that is really quick. pls advise if other method known.
Do i load the ref file to an array or a collection or something else and check file details against a New scan.
I use Freeimage.dll to get the creation date/time. this is what takes the 1 second to read each file.
I am looking to save a reference file with info from a scan. If i got so far through and it does take time, to cancel scan.
Ouch.
I made another version that fetches the LastWrite ("modified") timestamp from the filesystem which is probably going to be more useful than Creation anyway. It then uses Shell32's ExtendedProperty() method to retrieve the DateTaken.
This takes far less than 1 second per file. Also not every JPEG has a DateTaken inside it, so when creating your renamed move/copy file name you could use LastWrite instead when there is no DateTaken EXIF data.
Originally Posted by k_zeon
On a new scan of same folder, I don't want to re-scan all these files. I would want to load back in what i have scanned so far
ie Source in col 1 , Destination in column 2 and then carry on scanning from where i left off.
Since there isn't any practical way to "carry on scanning from where you left off" you may need to rethink that.
That's why I had opted to only save the files that had been "moved" (or copied in your initial non-destructive testing). A full scan must still be done but for those saved and marked as "moved" they can be skipped and the DateTaken doesn't need to be looked up yet again.
Originally Posted by k_zeon
The help i need is, I just need to find the best/quickest way to create the reference file and best/quickest way to read file.
Do i create my own file format or use an existing method that is really quick. pls advise if other method known.
Do i load the ref file to an array or a collection or something else and check file details against a New scan.
As I said, I'm not sure it makes any sense to save all of the files scanned before you "cancel." That's because you can't start a directory search somewhere in the middle anyway.
You would probably need to save the moved/copied status of any files already moved/copied to prevent moving/copying them again.
My example above already does that, and in a way that already answers the questions about a storage data structure (ADO Recordset) and fast save/load persistence file format (ADO's ADTG or XML, your choice).
Here is the new version, and yes it runs more slowly but perhaps not so slow that you need to cancel scans:
Of course you still could cancel them if you wanted to.
Note that some files do not have a "Taken" field value because there wasn't one within the file.
Weird, but the LastWrite timestamp is within 1 second or so of the DateTaken from the EXIF metadata in the file. At least for all of the files I eyeballed.
I suppose when the camera write them to the SD card they got a timestamp there and when I copied it to the PC that timestamp got carried across. I'm not so sure you need the high overhead of fetching EXIF data unless you fiddle with images a lot and set a new DateTaken when you save them.
I'd probably use LastWrite and call it good enough. The scan runs 20 times as fast that way for me but I have older slow hard drives. It would probably be even more significant if you are scanning a network share or an SD card.
I would go with tha Datetaken also, unless you really need some other Date
here a Filter to return only Files > a certain Date
in a Modul
Code:
Option Explicit
Private Declare Function SendMessageStr Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As String) As Long
Private Const LB_DIR = &H18D
Private Const DDL_READWRITE As Long = &H0
Public Function GetFilesFromFolder(Parentform As Form, ByVal Path As String, _
LastUpdate As Date) As Collection
Dim Result As Long, i As Long
Dim s As String
Dim d As Date
Dim myLbox As ListBox
Dim Col As Collection
Set Col = New Collection
'Listbox anlegen
s = "myLbox"
i = Int(Rnd * 10000 + 10000)
On Error Resume Next
Do
s = s & i
Set myLbox = Parentform.Controls.Add("VB.ListBox", s)
If Err.Number = 0 Then
Exit Do
End If
i = i + 1
Loop
On Error GoTo 0
If Right(Path, 1) <> "\" Then
Path = Path & "\"
End If
'abrufen Files
Result = SendMessageStr(myLbox.hwnd, LB_DIR, DDL_READWRITE, Path & "*.*")
'wenn was gefunden wurde
If Result > 0 Then
For i = 0 To myLbox.ListCount - 1
d = FileDateTime(Path & myLbox.List(i))
If d >= LastUpdate Then
Col.Add myLbox.List(i)
End If
Next
End If
Set myLbox = Nothing
Set GetFilesFromFolder = Col
End Function
in a Form..
Code:
Option Explicit
Private Sub Command1_Click()
Dim Col As Collection
Dim Path As String
Dim d As Date
Dim i As Long
Path = "E:\tester"
d = CDate("01.11.2018") ' get files created after 01.11.2018
Set Col = GetFilesFromFolder(Me, Path, d)
For i = 1 To Col.Count
' Debug.Print Col(i)
List1.AddItem Col(i)
Next
End Sub
regards
Chris
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
Weird, but the LastWrite timestamp is within 1 second or so of the DateTaken from the EXIF metadata in the file. At least for all of the files I eyeballed.
I suppose when the camera write them to the SD card they got a timestamp there and when I copied it to the PC that timestamp got carried across. I'm not so sure you need the high overhead of fetching EXIF data unless you fiddle with images a lot and set a new DateTaken when you save them.
I'd probably use LastWrite and call it good enough. The scan runs 20 times as fast that way for me but I have older slow hard drives. It would probably be even more significant if you are scanning a network share or an SD card.
Hi dilettante
i have used from your example
Code:
With Shell32.NameSpace(ssfDESKTOP).ParseName(item)
ItemTaken = .ExtendedProperty("System.Photo.DateTaken")
End With
and this is a lot quicker. did not know this existed. Does the extended also have a video.datetaken as i also use Mediainfo.dll do copy files as well and this
also takes a lot of time.
Last edited by k_zeon; Nov 11th, 2018 at 06:43 AM.
Does the extended also have a video.datetaken as i also use Mediainfo.dll do copy files as well and this
also takes a lot of time.
I'm not seeing one.
You might try System.ItemDate, because the comments say:
Code:
// Name: System.ItemDate -- PKEY_ItemDate
// Type: DateTime -- VT_FILETIME (For variants: VT_DATE)
// FormatID: {F7DB74B4-4287-4103-AFBA-F1B13DCD75CF}, 100
//
// This is the main date for an item. The date of interest.
//
// For example, for photos this maps to System.Photo.DateTaken.
These values are listed in the propkey.h file from the Windows SDK and also at Windows Properties.
Ouch. Never do this. It breaks if your program is run with different regional and language settings:
Originally Posted by ChrisE
Code:
d = CDate("01.11.2018") ' get files created after 01.11.2018
Instead use a proper date literal, even if you insist on some provincial format in a comment:
Code:
d = #11/1/2018# ' get files created after 01.11.2018
Date literals in VB, Jet SQL, etc. use Earth Standard format and will compile the same value no matter what settings the user has. Trying to hack around it using String literals is risky business.
Ouch. Never do this. It breaks if your program is run with different regional and language settings:
Instead use a proper date literal, even if you insist on some provincial format in a comment:
Code:
d = #11/1/2018# ' get files created after 01.11.2018
Date literals in VB, Jet SQL, etc. use Earth Standard format and will compile the same value no matter what settings the user has. Trying to hack around it using String literals is risky business.
yes your right
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
It would be nice if it wasn't this way but it is what it is.
Before long China may take the lead in software and we'll have all new conventions to work with. Maybe programming languages will run vertically instead of horizontally and we'll scroll " down" by scrolling right.
It would be nice if it wasn't this way but it is what it is.
Before long China may take the lead in software and we'll have all new conventions to work with. Maybe programming languages will run vertically instead of horizontally and we'll scroll " down" by scrolling right.
let's hope it will not come to that....
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
You might try System.ItemDate, because the comments say:
Code:
// Name: System.ItemDate -- PKEY_ItemDate
// Type: DateTime -- VT_FILETIME (For variants: VT_DATE)
// FormatID: {F7DB74B4-4287-4103-AFBA-F1B13DCD75CF}, 100
//
// This is the main date for an item. The date of interest.
//
// For example, for photos this maps to System.Photo.DateTaken.
These values are listed in the propkey.h file from the Windows SDK and also at Windows Properties.
tried System.ItemDate but got nothing returned. I have been on internet all day and found quite a few bits.
I now am looking for a way to convert a Media Guid to Media Type String
This is the compression type used on a video.
ie {E06D8026-DB46-11CF-B4D1-00805F6CBBEA} to a readable media type WMMEDIASUBTYPE_MPEG2_VIDEO
I thought i could use StringFromGUID2 but don't seem to be able to make it work.
I could put all guids in an array and check , but if new guids appear i would need to update my array.
I would rather get it direct from the system.
Well I think you get there faster via the FourCC of the compression, but I can't find anything in Windows for translating those to descriptions.
I cobbled up FourCCs.txt from stuff on Microsoft web pages, but it isn't complete and may have flaws. The way I use it here is also flawed because I do a case-insensitive search, but you could fix that if you find there are colliding values.
Code:
Option Explicit
Private Const MEDIA_FILE_1 As String = "D:\Videos\small.wmv"
Private Const MEDIA_FILE_2 As String = "D:\Videos\When bunnies ESCAPE.mp4"
Private Const ssfDESKTOP = 0 'Root of the filesystem.
Private Const CONN As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Mode=Share Deny Write;Data Source='.';" _
& "Extended Properties='Text;CSVDelimited=True;Hdr=True'"
Private Declare Sub PutMem4 Lib "msvbvm60" (ByVal pVar As Long, ByVal NewVal As Long)
Private Sub Form_Load()
Dim Shell32Root As Object
Dim FourCCs As ADODB.Recordset
Dim FourCC As String
Set Shell32Root = CreateObject("Shell.Application").NameSpace(ssfDESKTOP)
Set FourCCs = New ADODB.Recordset
With FourCCs
.CursorLocation = adUseClient
.Open "FourCCs.txt", CONN, adOpenStatic, adLockReadOnly, adCmdTableDirect
.Fields.Item("FourCC").Properties!Optimize.Value = True
'Look up and display MEDIA_FILE_1:
FourCC = Space$(2) 'Space for 4 ANSI characters.
PutMem4 StrPtr(FourCC), _
Shell32Root.ParseName(MEDIA_FILE_1).ExtendedProperty("System.Video.FourCC")
FourCC = StrConv(FourCC, vbUnicode)
Print MEDIA_FILE_1
Print
Print , FourCC; " = ";
.Find "[FourCC]='" & FourCC & "'", , adSearchForward, adBookmarkFirst
If .EOF Then
Print "*unknown*"
Else
Print .Fields.Item("Description").Value
End If
Print
'Look up and display MEDIA_FILE_2:
FourCC = Space$(2) 'Space for 4 ANSI characters.
PutMem4 StrPtr(FourCC), _
Shell32Root.ParseName(MEDIA_FILE_2).ExtendedProperty("System.Video.FourCC")
FourCC = StrConv(FourCC, vbUnicode)
Print MEDIA_FILE_2
Print
Print , FourCC; " = ";
.Find "[FourCC]='" & FourCC & "'", , adSearchForward, adBookmarkFirst
If .EOF Then
Print "*unknown*"
Else
Print .Fields.Item("Description").Value
End If
.Close
End With
End Sub
Date literals in VB, Jet SQL, etc. use Earth Standard format...
Nah, IMO that's as far from "earth-standard" as it gets...
it's just another "provincial format" which was choosen there (by MS).
Most other tools, SQL-Dialects and languages use in the meantime the standardized ISO-format for Date-Literals
(even the MS-SQLServer allows such literals in TSQL)
And VB6 has no problem to initialize Date-Variables from such StringLiteral-IsoDates in a locale-independent manner either...
E.g.
Code:
Const D1 As Date = "2018-11-01" 'date-value (short)
Const D2 As Date = "2018-11-01 13:30:00" 'date-time-value
@ChrisE
So, if you want to "change the way you write Date-Literals", then I'd suggest sticking to the ISO-standard instead -
because you'll find it "everywhere else".
Nah, IMO that's as far from "earth-standard" as it gets...
it's just another "provincial format" which was choosen there (by MS).
Most other tools, SQL-Dialects and languages use in the meantime the standardized ISO-format for Date-Literals
(even the MS-SQLServer allows such literals in TSQL)
And VB6 has no problem to initialize Date-Variables from such StringLiteral-IsoDates in a locale-independent manner either...
E.g.
Code:
Const D1 As Date = "2018-11-01" 'date-value (short)
Const D2 As Date = "2018-11-01 13:30:00" 'date-time-value
@ChrisE
So, if you want to "change the way you write Date-Literals", then I'd suggest sticking to the ISO-standard instead -
because you'll find it "everywhere else".
Olaf
@Olaf
Dates are a PAIN, funny that all the minds in the World couldn't agree on a Format
they all agreed on the shape of Underpants
regards
Chris
to hunt a species to extinction is not logical !
since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.
Well I think you get there faster via the FourCC of the compression, but I can't find anything in Windows for translating those to descriptions.
I cobbled up FourCCs.txt from stuff on Microsoft web pages, but it isn't complete and may have flaws. The way I use it here is also flawed because I do a case-insensitive search, but you could fix that if you find there are colliding values.
Thanks dilettante
That's twice now i have learnt some new coding.
so if i find an unknown value, i can search internet , find the file type and give it a description and add to the list.
Or is there a list some where that gets updated that i can check from time to time.
And apparently the VB6/VBA-String-To-Date conversion-routines do support this standard -
(even in the Pre-Compiling-stage, which resolves "static Const-expressions").
So - in this case, there's no reason (for a VB6-developer), to "follow the proprietary vendor-recommendation".
It looks like the closest you can get to when a video was "taken" is the "System.Media.DateEncoded" Shell extended property. In the file Properties dialog's Details pane this timestamp is called "Media created."
Whether there is a value here depends on whether or not the original recording device wrote one and whether or not any video editing software used to post-process the video retained or perhaps updated it.
It appears that this always returns a VT_DATE value, but if the timestamp wasn't present this will be 0# (i.e. 12:00:00 AM with no date part) rather than Null or Empty. When not 0# this is a UTC value, so you'd probably want to adjust this to local time for display or use, as I do here:
Since I was re-purposing code on hand already I included fetching and scaling thumbnails just for grins.
Last edited by dilettante; Nov 13th, 2018 at 02:49 PM.
Reason: Cleaned up Chronos.cls, new attachment
so if i find an unknown value, i can search internet , find the file type and give it a description and add to the list.
Or is there a list some where that gets updated that i can check from time to time.
Not that I found, but I didn't do an exhaustive search either. As it was I had to go to the Wayback Machine archive site to fetch some old MSDN pages that are no longer online.
It looks like the closest you can get to when a video was "taken" is the "System.Media.DateEncoded" Shell extended property. In the file Properties dialog's Details pane this timestamp is called "Media created."
Whether there is a value here depends on whether or not the original recording device wrote one and whether or not any video editing software used to post-process the video retained or perhaps updated it.
It appears that this always returns a VT_DATE value, but if the timestamp wasn't present this will be 0# (i.e. 12:00:00 AM with no date part) rather than Null or Empty. When not 0# this is a UTC value, so you'd probably want to adjust this to local time for display or use, as I do here:
Since I was re-purposing code on hand already I included fetching and scaling thumbnails just for grins.
Many thanks for all your help. i have really learnt quite a bit just from your examples.
Sorry, I see I had used an older version of Chronos.cls in this Project (post #27 above). Reposted with a newer, clean up version. The old one worked fine as far as I can tell but this one is a little bit faster and neater.
Note that you really want:
Code:
#Const NTONLY = 1
Only use 0 for that if you must run on a Win9x OS like Windows Me, 98, or 95 which do not support the SystemTimeToTzSpecificLocalTime() and TzSpecificLocalTimeToSystemTime() API calls.
Hi dilettante. I need your expertise again.
I am now looking to get the Orientation of a Video file, so that when i view a thumbnail image
i can make sure it is displayed correctly.
I have tried .ExtendedProperty("System.Media.Rotation") and .ExtendedProperty("Rotation") and .ExtendedProperty("Orientation")
but can not get any data back.
I know its ID 245 ie ( Debug.Print .GetDetailsOf(shFolderItem, 245) ) on Win7 64bit but i cannot get any data back.
I then used MediaInfo.dll and it get a value back of 90.00
Well System.Video.Orientation returns a VT_UI4 value in degrees.
lngValue = CLng(varValue) ought to work just fine since the values are always positive anyway and shouldn't overflow into bit 31.
Sadly I couldn't find any videos on hand that didn't report 0° so I even tried a couple of online video rotators, but no dice. It seems as if this metadata value either isn't supported in common video container formats or else most software that does rotations doesn't bother to set the actual value.
You might give it a try if you have a video file that does have this value set.
Well System.Video.Orientation returns a VT_UI4 value in degrees.
lngValue = CLng(varValue) ought to work just fine since the values are always positive anyway and shouldn't overflow into bit 31.
Sadly I couldn't find any videos on hand that didn't report 0° so I even tried a couple of online video rotators, but no dice. It seems as if this metadata value either isn't supported in common video container formats or else most software that does rotations doesn't bother to set the actual value.
You might give it a try if you have a video file that does have this value set.
I have been trying all methods to get a video orientation but everything i have tried returns empty.
I eventually used Mediainfo.dll and this does get the video orientation. (not the best solution , but it works) I read somewhere that if i installed Icaras this
might help reset the references etc. haven't tried it yet.
code i have tried
.ExtendedProperty("System.Video.Orientation")
.ExtendedProperty("System.Media.Orientation")
.GetDetailsOf(shFolderItem, 245
If i list all properties of an MP4 file i get no option for Oriantation. Any ideas
Couldn't it be, that "Orientation" is just an "indirectly derived" Property -
depending on, whether FrameWidth / FrameHeight > 1 or not?
And why is that so important?
Olaf
Hi Olaf.
The reason its important is that when i show details & the thumbnail from a video , the image
is displayed either correct way up or rotated left.
If rotated left, i would redraw the image the correct way up. ( only cosmetic )
I dont know how phones, camcorders etc know when they are right way up, i thought i had to get the orientation.
If not , then would FrameWidth / FrameHeight > 1 for all videos etc
The reason its important is that when i show details & the thumbnail from a video , the image
is displayed either correct way up or rotated left.
If rotated left, i would redraw the image the correct way up. ( only cosmetic )
So, what exactly *is* the ratio of FrameWidth / FrameHeight for those Video-Files,
where you would have to apply a correction (thumbnail-wise) in a second step?
Is it < 1 or > 1?
So, what exactly *is* the ratio of FrameWidth / FrameHeight for those Video-Files,
where you would have to apply a correction (thumbnail-wise) in a second step?
Is it < 1 or > 1?
Olaf
I have a video that is 1920 wide / 1080 high. On Win7pro 64bit in Explorer , the image in the properties is showing an image 90deg to left.
In my app when i use extendedproperty for thumbnail my image is also 90 deg turned left.
I am looking to get/read orientation using extendedproperty but have not got any results.
As said i have used Mediainfo.dll and this does read the correct orientation but i wanted
to use extendedproperty to keep code the same for all properties.
If not then i will use Mediainfo.dll.
thanks for taking the time to help
Last edited by k_zeon; Nov 18th, 2018 at 12:50 PM.