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?

1 Answer 1

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

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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