25

I have seen several other related questions but they all seem to be related to grabbing a still shot every X number of seconds. How can I grab 1 image when the command is run.

I was trying

ffmpeg -y -i rtsp://admin:admin@192.168.10.113:554/live -f image2 -updatefirst 1 do.jpg
sealfab
  • 489
  • 2
  • 6
  • 10
  • Why the `-f image2 -updatefirst 1`. You only want one output. – Gyan Jan 20 '16 at 16:00
  • when I run it without I get `[image2 @ 0x2886980] Could not get frame filename number 2 from pattern 'do.jpg' (either set updatefirst or use a pattern like %03d within the filename pattern) av_interleaved_write_frame(): Invalid argument ` – sealfab Jan 20 '16 at 16:37

5 Answers5

36

Try

ffmpeg -y -i rtsp://admin:admin@192.168.10.113:554/live -vframes 1 do.jpg
Gyan
  • 85,394
  • 9
  • 169
  • 201
  • 5
    i've used this command for a while, but about 20% of the time I get a corrupted frame – user230910 Jul 29 '18 at 02:47
  • 3
    RTSP, if via UDP, can drop packets. Try TCP. – Gyan Jul 29 '18 at 04:42
  • 11
    For those wondering, to use TCP with the above command add: `-rtsp_transport tcp` – Pathead Apr 17 '19 at 12:38
  • 5
    For those who struggled over this as much as I did, 2 pro tips: `-rtsp_transport tcp` option must be placed *before* `-i ...`option, and `-vframes` is an now an obsolete alias for `-frames:v` (use the latter instead of the former) – ttous Nov 12 '19 at 09:50
  • While this works on my Mac, it hangs on windows after listing the library names ending with libpostproc – Frak Dec 12 '20 at 20:21
2

I've been using variations to use my Ubiquiti cameras to give me a Weather Underground JPG.

The tcp transport addition fixed everything. The modified command follows.

E $FFMPEG -y -loglevel fatal -rtsp_transport tcp -i $URL1 -frames:v 2 -r 1 -s 320x240 $TMPFILE
Nishant Rajput
  • 2,053
  • 16
  • 28
1

My take on this command, but its not perfect, about 20% of the time I get a corrupted (as in incomplete, or glitchy) image over a bad link:

avconv -rtsp_transport tcp -y -i rtsp://user:pass@192.168.0.1:554/live -vframes 1 do.jpg
user230910
  • 2,353
  • 2
  • 28
  • 50
0

Firstly you need download ffmpeg.exe file to your computer and unzip, Secondly, open Windows Terminal or PowerShell or CMD in your unzipped path and enter the bin directory,enter the following command:

.\ffmpeg -i rtsp://username:password@192.168.1.1:554/media/video0 -ss 1 -f image2 C:\Users\Desktop\1.jpg
Vinson
  • 31
  • 5
0

You also can use a "proxy" app like https://github.com/gallofeliz/snapshot-proxy-cam that handle fallbacks and centralize your cams