Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a security camera and I would like to take snapshots each 5-10 minutes using cron jobs, but I could fined any command line tools,

I tried the following:

avconv -i rtsp://ip:554/h264_2 -r 1 -s WxH -f image2 foo.jpeg

but the avconc doesn't support RTP/RTSP

[NULL @ 0x139d940] Interleaved RTP mode is not supported yet.Estimating duration from bitrate, this may be inaccurate
share|improve this question
What's the model number of your camera? – SirCharlo Aug 24 '12 at 14:13
LevelOne FCS-4041, using vlc I can view the video, I also wrote a program in python, to control the camera, here I can take snapshot, but in this case I need GUI, but I would like to take snapshot on a server. – OHLÁLÁ Aug 24 '12 at 14:22
up vote 1 down vote accepted

Note: I have absolutely no way of testing this. Mad props to "Ranger", the author of this code.

Try this:

ffmpeg -ss 2 -i rtsp://ip:554/h264_2 -y -f image2 -sameq -t 5 foo.jpeg

Here's a simple script named, for instance,, that captures an image and names it according to the date and time.

export DATETIME=`date +%Y%m%d%H%M`
export DATE=`date +%Y%m%d`
export MONT=`date +%Y%m`
mkdir -p /path/to/output/$MONT/$DATE

ffmpeg -ss 2 -i rtsp://ip:554/h264_2 -y -f image2 -sameq -t 5 /path/to/output/$MONT/$DATE/$DATETIME.jpeg

Add the following entry to your crontab to execute the script every five minutes:

*/5 * * * * sh /path/to/

Again, all credit for this goes to "Ranger" for this.

share|improve this answer
Unfortunately it's not working for me: Press ctrl-c to stop encoding [buffer @ 0x1a57e80] Buffering several frames is not supported. Please consume all available frames before adding a new one. Last message repeated 79 times -0kB time=10000000000.00 bitrate= -0.0kbits/s frame= 0 fps= 0 q=0.0 Lsize= -0kB time=10000000000.00 bitrate= -0.0kbits/s video:0kB audio:0kB global headers:0kB muxing overhead -inf% – OHLÁLÁ Aug 24 '12 at 15:29
Try again, with the revised command – SirCharlo Aug 24 '12 at 15:33
This worked for me (my ffmpeg version is 2.2): ffmpeg -ss 2 -i rtsp://ip:554/h264_2 -y -f image2 -qscale 0 -frames 1 /path/to/output/$MONT/$DATE/$DATETIME.jpeg – Walty Yeung Oct 14 '14 at 2:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.