lIlIIlIllIIIIlI Posted February 20 Posted February 20 (edited) I have a camera recording video via ffmpeg, but the video's file size doesn't seem to update when periodically checked via FileGetSize($path). It does update when I manually right click > property and check the file size, or when I reopen the folder containing the video and interact with it in some way. It's like windows isn't actually check when autoit asks, but it does check it when I manually inspect it... if that makes sense? Do you have to somehow modify the file or trick windows into re-checking the file, before calling FileGetSize()? Edit: To be more clear, a video file that is periodically written to by ffmpeg, which should be increasing in file size, does not display any increase in file size when checked with autoit. But checking manually in windows I can see the file size increasing. Edited February 20 by lIlIIlIllIIIIlI rewording
Solution InnI Posted February 20 Solution Posted February 20 Try to update file before get size FileClose(FileOpen($path)) $Size = FileGetSize($path)
Werty Posted February 20 Posted February 20 7 hours ago, lIlIIlIllIIIIlI said: FileGetSize() Try with _WinAPI_GetFileSizeEx(), maybe there's a difference. Some guy's script + some other guy's script = my script!
Nine Posted February 20 Posted February 20 (edited) Try this code : ConsoleWrite(GetSize(@ScriptDir, "Relax.mp4") & @CRLF) Func GetSize($sDir, $sFile) Local $oShellApp = ObjCreate("shell.application") Local $oDir = $oShellApp.NameSpace($sDir) Local $oFile = $oDir.Parsename($sFile) Return $oFile.size EndFunc or simply : ConsoleWrite(GetSize(@ScriptDir, "Relax.mp4") & @CRLF) Func GetSize($sDir, $sFile) Local $oShellApp = ObjCreate("shell.application") Return $oShellApp.NameSpace($sDir).Parsename($sFile).size EndFunc Edited February 20 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
InnI Posted February 20 Posted February 20 Script1 (add data to file) $b = DllStructGetData(DllStructCreate("byte[1024]"), 1) $f = FileOpen("test.txt", 2 + 16) For $i = 0 To 99 Sleep(500) FileWrite($f, $b) Next FileClose($f) Run this script during script execution Script1 (file size does not change without open/close file) $path = "test.txt" For $i = 0 To 99 Sleep(500) ; FileClose(FileOpen($path)) ConsoleWrite(FileGetSize($path) & ":" & GetSize(@ScriptDir, "test.txt") & @CRLF) Next Func GetSize($sDir, $sFile) Local $oShellApp = ObjCreate("shell.application") Local $oDir = $oShellApp.NameSpace($sDir) Local $oFile = $oDir.Parsename($sFile) Return $oFile.size EndFunc
Nine Posted February 20 Posted February 20 (edited) 2 hours ago, InnI said: file size does not change without open/close file You are right. I tested on a nvidia recorder and it does not change unless you access the file. FileClose(FileOpen("file")) does make it work. Edited February 20 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
lIlIIlIllIIIIlI Posted February 20 Author Posted February 20 I did some reading and apparently file size metadata does not typically update from video recording software, until it is finished recording. Opening and closing the file prior seems to work just fine though, thanks!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now