11

I'm trying to make a bash script that grabs a still shot from an IP camera and than emails it.

Using

ffmpeg -i http://admin:Stupidpassword1@10.12.10.40/Streaming/channels/1/picture \
  -f image2 -updatefirst 1 doorbell.jpg 

From what I have read this should work but the output file name is still doorbell.jpg How can I make the filename TIMESTAMPdoorbell.jpg?

William Miller
  • 9,839
  • 3
  • 25
  • 46
sealfab
  • 489
  • 2
  • 6
  • 10

1 Answers1

15

Use the "strftime" feature:

ffmpeg -i http://admin:Stupidpassword1@10.12.10.40/Streaming/channels/1/picture -vframes 1 -f image2 -strftime 1 "%Y-%m-%d_%H-%M-%S_doorbell.jpg"

"-vframes 1" will cause it to only process the first frame that it receives.

You can change the date/time format using a strftime compatible string: http://man7.org/linux/man-pages/man3/strftime.3.html

Further documentation/examples: https://www.ffmpeg.org/ffmpeg-formats.html#image2-2

Brian
  • 1,200
  • 6
  • 8
  • 2
    The strftime feature does not work unless also using a muxer: https://stackoverflow.com/a/61874916/2394945 – Moby Disk Jan 17 '22 at 21:33