[FFmpeg-user] watch a folder for new images

Gyan Doshi ffmpeg at gyani.pro
Sun Jan 30 06:28:02 EET 2022



On 2022-01-30 02:11 am, Michael Koch wrote:
> Am 29.01.2022 um 20:36 schrieb Michael Koch:
>> Hello,
>>
>> is it possible to watch a folder for new images (like 
>> fileSystemWatcher in C#), and if a new image appears, then load it in 
>> FFmpeg? The question is for Windows.
>> Very large PNG images (about 30 Megapixels) are written to the folder 
>> every 5 seconds. I want to load these images, extract the four 
>> corners, enlarge them by a factor 10, stack the four images together 
>> and show the result on the screen, until the next image appears. The 
>> filtering is no problem, the question is only how to watch the folder 
>> for new images.
>
> I did try to read the same image again and again with this command line:
>
> ffmpeg -loop 1 -i input.png -window_x 0 -window_y 0 -f sdl2 -
>
> I was hoping that I could overwrite the input image by another image, 
> but that doesn't work. Access denied, because the file is open in FFmpeg.

Use -stream_loop -1 instead of loop.  Update the image atomically i.e. 
not during a read window.. Best way to update is to create a symlink and 
use that as input. Repoint the symlink when the new image file is ready.

Regards,
Gyan


More information about the ffmpeg-user mailing list