lIlIIlIllIIIIlI Posted Thursday at 03:34 AM Posted Thursday at 03:34 AM (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 Thursday at 04:05 AM by lIlIIlIllIIIIlI rewording
Solution InnI Posted Thursday at 10:48 AM Solution Posted Thursday at 10:48 AM Try to update file before get size FileClose(FileOpen($path)) $Size = FileGetSize($path)
Werty Posted Thursday at 11:26 AM Posted Thursday at 11:26 AM 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 Thursday at 01:04 PM Posted Thursday at 01:04 PM (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 Thursday at 01:21 PM 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 Multi-Threading Made Easy
InnI Posted Thursday at 01:33 PM Posted Thursday at 01:33 PM 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 Thursday at 04:22 PM Posted Thursday at 04:22 PM (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 Thursday at 04:23 PM 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 Multi-Threading Made Easy
lIlIIlIllIIIIlI Posted Thursday at 10:03 PM Author Posted Thursday at 10:03 PM 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