I thought I would post again just to update the forum on the solution I came up with for this problem, with the help I got here, lots of reference to the Wiki, and trial and error.
I ultimately managed to schedule a daily frame grab from the http stream using VLC, dos, and Windows Scheduled Tasks.
First I found that the following code would reliably capture a frame or two from my feed (I've replaced the IP with xxx.xxx.xxx):
Code: Select all
"c:\program files\videoLAN\VLC\vlc.exe" vlc -I dummy --run-time=2 http://xxx.xxx.xxx:port/mjpg/video.mjpg -V image vlc://quit
No matter what I tried I could not get the '--image-out-ratio' command to work, so the solution was simply to run the clip for such a short run-time that only a couple of frames at most would come through. This code results in a series of images with file names img000000.png, img000001.png, img000002.png and so on; using a run-time of 2 means, however, that usually I only capture one or two images.
Next I had to deal with the fact that the output image files always have the same names. Strangely I could find nothing in VLC about specifying the names of output images. Leaving it as-is, VLC would overwrite previous images each time the command runs. After some googling I developed the following DOS command using "FOR" to rename the output file using the date and time:
Code: Select all
@ECHO OFF
FOR %%V IN (%1) DO FOR /F "tokens=1-5 delims=/: " %%J IN ("%%~tV") DO IF EXIST %%J%%K%%L_%%M%%N%%~xV (ECHO Cannot rename %%V) ELSE (Rename "%%V" %%J%%K%%L_%%M%%N%%~xV)
DEL img*.png
This code replaces the input file's name with the date and time it was created. The addition of the DEL command gets rid of any surplus images after the first one is renamed. I saved this as a BAT file called "datename.bat".
Then I created another BAT, "imagegrab.bat", to run both my VLC command and the renaming bat, as follows:
Code: Select all
"c:\program files\videoLAN\VLC\vlc.exe" vlc -I dummy --run-time=2 http://xxx.xxx.xxx:port/mjpg/video.mjpg -V image vlc://quit
datename img000000.png
With this code VLC grabs a frame or two, then the first in the series -- img000000.png -- is renamed with the date and time. The DEL command in datename.bat then gets rid of any png images that still start with the "img" prefix, leaving me with one image for that instance of the program.
Last, "Scheduled Tasks" in the Windows control panel is scheduled to execute imagegrab.bat every day at the same time.
In the end I have a folder on my computer with two batch files in it, and a series of daily images from the mjpg stream. Success!
I hope this helps anyone else trying to do something similar. None of this comes naturally to me so it took a long time...!