[FFmpeg-user] Alternative to Dynamic Text
a.nielsen at shikadi.net
Sun Nov 7 05:00:15 EET 2021
> Btw, I think following approach may help (or may not, I have no windows
> system by hand to test it myself). Let's say I want to atomically
> replace file a.txt with file b.txt
> mklink /h wrk.txt a.txt
> open wrk.txt with ffmpeg
> update b.txt as needed
> mklink /h next.txt b.txt
> move /y next.txt wrk.txt
> now update a.txt as needed or may delete a, b and create new b.
> hardlink again and move again
> and so on in loop
From what I read, the 'move' command under Windows is not atomic. It
works by deleting the original file then renaming the new one, so if
ffmpeg tries to read it between the delete and the rename, ffmpeg will
abort with an error saying it can't find the file.
The Win32 API function MoveFileTransacted() appears to be the only way
to do it under Windows.
I think probably the best solution is to change ffmpeg so that if the
textfile parameter cannot read the file, it displays a blank or just
uses the previous data. That way it no longer becomes critical to
update the file atomically.
More information about the ffmpeg-user