Reputation: 21
Sorry for my english (i'm rus)
I save MJPEG stream from IP-camera with wget
wget -O 2010-01-12_01.mjpeg http://172.16.1.220:8070/video.mjpg
I need limit saving by hour (every hour is a another file - 2010-01-12_[XX])
What is the bast way to do it ? 1) starting and killing by cron ? 2) for .. do in script, how ? ...
thanks for answers
Upvotes: 0
Views: 3940
Reputation: 415
You can use the timeout utility:
timeout 3600 wget -O `date +%Y-%m-%d_%T`.mjpeg http://172.16.1.220:8070/video.mjpg
Upvotes: 2
Reputation: 1862
Just an alternate method to wget
while [ "true" ]; do
ffmpeg -t 3600 -i http://172.16.1.220:8070/video.mjpg -vcodec mjpeg /path/to/storage/$(date +%Y-%m-%d_%H).mjpg
done
Upvotes: 0
Reputation: 8989
sweet as bash kludge
wget whatever &
sleep 60 && kill $$ 2>/dev/null
Upvotes: 0