Schedule a daily snapshot from http stream..?

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
Phylth
New Cone
New Cone
Posts: 9
Joined: 23 Sep 2008 15:21

Schedule a daily snapshot from http stream..?

Postby Phylth » 23 Sep 2008 15:32

I'm looking for a way to schedule VLC MP to open a streaming mjpg from a http network address, take a snapshot, then close again at regular intervals. I don't want to record the stream, just grab a frame.

By way of background, a friend has streaming mjpg video from his cottage overlooking a lake. I would like to grab a still from the feed regularly, maybe daily, for a year, then cobble the snapshots together to make a time-lapse video. I have this feeling that VLC can be set-up do that, perhaps by a command-line batch file or something, but haven't yet figured anything out.

Grateful in advance for any help the forum can offer.

Dave

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: Schedule a daily snapshot from http stream..?

Postby dionoea » 23 Sep 2008 15:46

Something like this should work in the 0.9.x releases:

Code: Select all

vlc -I dummy http://example.com/the/video -V image --image-out-ratio 10000 --run-time 1 vlc://quit
Check "vlc -p image --advanced --help-verbose" for more options.
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

Phylth
New Cone
New Cone
Posts: 9
Joined: 23 Sep 2008 15:21

Re: Schedule a daily snapshot from http stream..?

Postby Phylth » 23 Sep 2008 16:52

Thanks for the quick reply Dionoea.

I gave that a try but got an error within the dummy. It looks to be something like this:

Fontconfig error: cannot load default config file
[00000485] main subpicture error: blending J420 to J420 failed

I'm not sure if it was the same error every time -- the prompt window closed before I could see it in several attempts but I got this one when it finally crashed altogether and Windows intervened.

Lil help?

Dave

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: Schedule a daily snapshot from http stream..?

Postby dionoea » 23 Sep 2008 17:15

Could you append -vvv to the command line and paste the output here?
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

Phylth
New Cone
New Cone
Posts: 9
Joined: 23 Sep 2008 15:21

Re: Schedule a daily snapshot from http stream..?

Postby Phylth » 23 Sep 2008 17:58

Hi Antoine --

When I append "-vvv" and run the string the output appears in a new window, which closes immediately upon completing. I can see that it's generating more information but it does not seem to create a log file or remain on-screen for me to copy it.

Dave

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: Schedule a daily snapshot from http stream..?

Postby dionoea » 23 Sep 2008 19:14

ah, you're on windows? Then you'll need to add --file-logging too. It will save the debug output to vlc-log.txt
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

Phylth
New Cone
New Cone
Posts: 9
Joined: 23 Sep 2008 15:21

Re: Schedule a daily snapshot from http stream..?

Postby Phylth » 23 Sep 2008 19:59

OK -- with that assistance I've managed to generate a log: http://users.eastlink.ca/~leahdave/vlc-log.txt.

Grateful for your observations.

Dave

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Re: Schedule a daily snapshot from http stream..?

Postby The DJ » 23 Sep 2008 20:48

main debug: connection: Resource temporarily unavailable
main debug: connection succeeded (socket = 4792)
access_http debug: protocol 'HTTP' answer code 404
access_http error: error: HTTP/1.1 404 Not Found
access_http debug: switching to HTTP version 1.0
main debug: net: connecting to anstrutherlake.axiscam.net port 8201
main debug: connection: Resource temporarily unavailable
main debug: connection succeeded (socket = 4932)

So for this particular try, it's logical that it didn't work. The server would not respond.
Don't use PMs for support questions.

Phylth
New Cone
New Cone
Posts: 9
Joined: 23 Sep 2008 15:21

Re: Schedule a daily snapshot from http stream..?

Postby Phylth » 23 Sep 2008 21:53

Strangely though, if I simply open the stream in VLC it does just fine (although sometimes with a bit of delay).

Phylth
New Cone
New Cone
Posts: 9
Joined: 23 Sep 2008 15:21

Re: Schedule a daily snapshot from http stream..?

Postby Phylth » 24 Sep 2008 16:28

I think I'm getting close and would be grateful if someone could help me get to the bottom of this.

I now have the following command string opening my source stream for 5 seconds and closing it again:

Code: Select all

"c:\program files\videoLAN\VLC\vlc.exe" vlc -I dummy http://xxx.xxx.xxx:8201/mjpg/video.mjpg image --image-out-ratio=10000 --run-time=5 vlc://quit
I assume my problems earlier were related to the speed of the stream server, since this is very similar to your original advice. It does not, however, seem to be saving an image anywhere -- or at least anywhere I can find. I have searched my file system for output images, and the Wiki and documentation for an indication of the default output folder, without any luck. Are you able to tell me where to find the output png images, or how to define an output location?

[EDIT] -- here's a log from executing the above command line (adding a -vvv): http://users.eastlink.ca/~leahdave/vlc-log2.txt

Thanks.

Dave
Last edited by Phylth on 30 Sep 2008 14:55, edited 1 time in total.

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Re: Schedule a daily snapshot from http stream..?

Postby The DJ » 24 Sep 2008 17:34

I think I'm getting close and would be grateful if someone could help me get to the bottom of this.

I now have the following command string opening my source stream for 5 seconds and closing it again:

Code: Select all

"c:\program files\videoLAN\VLC\vlc.exe" vlc -I dummy http://anstrutherlake.axiscam.net:8201/mjpg/video.mjpg image --image-out-ratio=10000 --run-time=5 vlc://quit

Code: Select all

"c:\program files\videoLAN\VLC\vlc.exe" vlc -I dummy --run-time=5 http://anstrutherlake.axiscam.net:8201/mjpg/video.mjpg :sout="#image{out-ratio=10000}" vlc://quit
Something like this seems more logical to me.
Don't use PMs for support questions.

Phylth
New Cone
New Cone
Posts: 9
Joined: 23 Sep 2008 15:21

Re: Schedule a daily snapshot from http stream..?

Postby Phylth » 24 Sep 2008 18:34

Hi DJ -- I have just tried some variations of the code you suggested, still without success. If I take out the colon before sout then it behaves the same as the earlier code, opening a new window titled "Hardware YUV overlay DirectX" and showing my video stream for about 5 seconds, but either not saving individual images or not telling me where to find them. For what it's worth I'm running a Windows XP Pro machine.

If I knew where to look for saved images or how VLC is supposed to perform it may help me get this figured out. Can you tell me the default location of saved images? If behaving normally, would the images open in an editor or otherwise tell me when they have been saved?

Dave

Phylth
New Cone
New Cone
Posts: 9
Joined: 23 Sep 2008 15:21

Re: Schedule a daily snapshot from http stream..?

Postby Phylth » 30 Sep 2008 14:55

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...!


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 24 guests