Reputation: 862
I would like a routine that systematically extracts and saves the frames from webcam footage to a local directory on my personal computer.
Specifically, I am trying to save frames from the webcam at Old Faithful geyser in Yellowstone Natl. Park. (https://www.nps.gov/yell/customcf/geyser_webcam_updated.htm)
Ideally, I would like to:
Despite point 3 above, I've tried simply taking a screenshot in R using the package webshot:
library(webshot)
i=1
while(i<=2) {
webshot('https://www.nps.gov/yell/customcf/geyser_webcam_updated.htm',delay=60,paste(i,'.png',sep=""))
i=i+1
}
However, from the above code I get these two images:
Despite the delay in the webshot() function (60 seconds) the two images are the same not to mention the obvious play button in the middle. This method also seems a bit of a hack as it is saving a snapshot of the website and not the frames themselves.
I am certainly open to to using more appropriate command line tools (I am just unsure of what they are). Any help is greatly appreciated!
Upvotes: 1
Views: 381
Reputation: 93008
The source code of the URL shows, under the video tag
<source type="application/x-mpegurl" src="//56cf3370d8dd3.streamlock.net:1935/nps/faithful.stream/playlist.m3u8">
The src identifies a HLS playlist. So, you can then run ffmpeg periodically to get an image output like this:
ffmpeg -i https://56cf3370d8dd3.streamlock.net:1935/nps/faithful.stream/playlist.m3u8 -vframes 1 out.png
Upvotes: 2