tonbor wrote: ↑Wednesday 20 February 2019 15:56It
Works
Hello, I try your code but I have many errors:
videokuldo.sh: line 3: $'\r': command not found
videokuldo.sh: line 10: $'\r': command not found
rtsp://*****:*********@192.168.10.9:554/ISAPI/Streaming/channels/101
746563875:AAHdcYfA
stat: cannot stat ‘/var/tmp/frontdoorcam.mp4’: No such file or directory
ffmpeg version 2.7.1 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.3 (crosstool-NG 1.20.0) 20150311 (prerelease)
configuration: --prefix=/usr --incdir='${prefix}/include/ffmpeg' --arch=i686 --target-os=linux --cross-prefix=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- --enable-cross-compile --enable-optimizations --enable-pic --enable-gpl --enable-shared --disable-static --enable-version3 --enable-nonfree --enable-libfaac --enable-encoders --enable-pthreads --disable-bzlib --disable-protocol=rtp --disable-muxer=image2 --disable-muxer=image2pipe --disable-swscale-alpha --disable-ffserver --disable-ffplay --disable-devices --disable-bzlib --disable-altivec --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --disable-vaapi --disable-decoder=amrnb --disable-decoder=ac3 --disable-decoder=ac3_fixed --disable-encoder=zmbv --disable-encoder=dca --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-decoder=dca --disable-decoder=eac3 --disable-decoder=truehd --cc=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-ccache-gcc --enable-yasm --enable-libx264 --enable-encoder=libx264
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
rtsp://**********:**********@192.168.10.9:554/ISAPI/Streaming/channels/101: Protocol not found
curl: no URL specified!
curl: try 'curl --help' for more information
: No such file or directoryps://api.telegram.org/bot746563875:AAHdc/sendVideo
videokuldo.sh: line 19: $'\r': command not found
videokuldo.sh: line 20: $'else\r': command not found
There was another try within 10 seconds:
videokuldo.sh: line 22: $'fi\r': command not found
I hope you can help me. RTSP url good, because VLC can play.
The code:
#!/bin/sh
now=$(date +"%T")
SnapFile="/var/tmp/frontdoorcam.mp4" # Temp name of the video, change it when using this script for multiple cams
VideoLength=5 # Seconds to record
WaitTime=10 # Seconds the script waits before it sends another video
User="admin" # Username which has access to the RTSP stream
Password="*********" # Password for above provided user
rtspUrl="rtsp://admin:***************@192.168.10.9:554/ISAPI/Streaming/channels/101" # Use
https://sourceforge.net/projects/onvifdm/ to find your correct RTSP stream url
echo $rtspUrl
ChatID=-10011 # Telegram chat ID See
https://www.domoticz.com/wiki/Installin ... ion_System for setup instructions
TelegramAPIToken="746563875:AAHdcYfA1s" # Telegram API token
echo $TelegramAPIToken
filedate=`stat -L --format %Y $SnapFile`
ffmpeg -y -i $rtspUrl -r 30 -vcodec copy -an -t $VideoLength $SnapFile
curl -s -F chat_id=$ChatID -F video="@$SnapFile" -F caption="$now Deurbel klinkt.."
https://api.telegram.org/bot$TelegramAPIToken/sendVideo
else
echo There was another try within $WaitTime seconds: $sec
fi