#2322
Capture RTSP image from Rpi and sent to Bloger (using Gmail account)
Mail config :
Unsecure app must be allowed on Gmail : https://myaccount.google.com/lesssecureapps
Install SSMTP and Mpack
sudo apt-get update sudo apt-get install -y ssmtp mpack
edit: /etc/ssmtp/ssmtp.conf
root=rpi3abc@gmail.com mailhub=smtp.gmail.com:465 FromLineOverride=YES AuthUser=rpi3abc@gmail.com AuthPass=testing123 UseTLS=YES
Send mail :
mpack -s subject picture.png mail.address@example.com
Capture Image from RTSP feed:
sudo apt-get update sudo apt-get install -y ffmpeg
ffmpeg -y -i rtsp://admin:admin@192.168.10.113:554/live -vframes 1 do.jpg
Script
#!/bin/bash ## ------------------- ## ## Vars ## ------------------- ## timestamp=`date +%Y%m%d-%H%M%S` humanReadableDate=`date "+%d/%m/%Y %H:%M"` recipient=aaa@blogger.com liveStreamUrl="rtsp://192.168.100.233:554/user=admin_password=OmvItLOM_channel=1_stream=0.sdp?real_stream" ## ------------------- ## ## Capture live stream ## ------------------- ## #ffmpeg -y -i $liveStreamUrl -vframes 1 "/tmp/${timestamp}.jpg" #ffmpeg -rtsp_transport tcp -y -i $liveStreamUrl -f image2 -vframes 1 "/tmp/${timestamp}.jpg" ffmpeg -rtsp_transport tcp -y -i $liveStreamUrl -vframes 1 "/tmp/${timestamp}.jpg" ## ------------------- ## ## Send Mail ## ------------------- ## mpack -s "${humanReadableDate}" "/tmp/${timestamp}.jpg" $recipient ## ------------------- ## ## Remove Picture ## ------------------- ## rm -Rf "/tmp/${timestamp}.jpg"
Cron
0 9,14 * * * /bin/bash /home/pi/sendImage.sh
Picture at 9:00 and 14:00 everyday
sudo service cron reload
[Artifactory] How-to Batocera 29 le retrogaming pour Raspberry Pi – Framboise 314, le Raspberry Pi à la sauce française….
If SSMTP is not working, use mstmp and mutt
vi ~/.muttrc
See also : https://hostpresto.com/community/tutorials/how-to-send-email-from-the-command-line-with-msmtp-and-mutt/
To upload pictures to google drive by mail :
https://zapier.com/learn/how-to/email-to-google-drive/
to add content to mutt :