[FFmpeg-user] watch a folder for new images

Michael Koch astroelectronic at t-online.de
Sun Jan 30 10:49:36 EET 2022


Am 30.01.2022 um 05:28 schrieb Gyan Doshi:
>
>
> 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.
>

I did create a symlink which is pointing to a PNG image. When I double 
click on the symlink, the image is shown.
But something must be wrong in my FFmpeg command line.

ffmpeg -framerate 1 -stream_loop -1 -i symlink.lnk -window_x 0 -window_y 
0 -f sdl2 -

I get this error message:
symlink.lnk: Invalid data found when processing input

The console output is below.

Michael


C:\Users\astro\Desktop\reload>ffmpeg -framerate 1 -stream_loop -1 -i 
symlink.lnk -window_x 0 -window_y 0 -f sdl2 -
ffmpeg version 2022-01-24-git-0a83ecbf48-essentials_build-www.gyan.dev 
Copyright (c) 2000-2022 the FFmpeg developers
   built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
   configuration: --enable-gpl --enable-version3 --enable-static 
--disable-w32threads --disable-autodetect --enable-fontconfig 
--enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp 
--enable-bzlib --enable-lzma --enable-zlib --enable-libsrt 
--enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid 
--enable-libaom --enable-libopenjpeg --enable-libvpx 
--enable-mediafoundation --enable-libass --enable-libfreetype 
--enable-libfribidi --enable-libvidstab --enable-libvmaf 
--enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid 
--enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va 
--enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt 
--enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora 
--enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb 
--enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
   libavutil      57. 18.100 / 57. 18.100
   libavcodec     59. 20.100 / 59. 20.100
   libavformat    59. 17.101 / 59. 17.101
   libavdevice    59.  5.100 / 59.  5.100
   libavfilter     8. 26.101 /  8. 26.101
   libswscale      6.  5.100 /  6.  5.100
   libswresample   4.  4.100 /  4.  4.100
   libpostproc    56.  4.100 / 56.  4.100
symlink.lnk: Invalid data found when processing input




More information about the ffmpeg-user mailing list