conert videos

This commit is contained in:
Antonio J. Delgado 2023-03-20 23:23:38 +02:00
parent fbb724b12e
commit 7922f94ae1

View file

@ -230,24 +230,23 @@ if [ "${mail_alert}" == "true" ]; then
fi
if [ -n "${ntfy_server}" ]; then
if [ -n "${file}" ]; then
ntfy_data="{ \"topic\": \"motion_detection\", \"message\": \"Event ${event_type} on host ${motion_host} camera ${camera_name}\", \"filename\": \"${file}\" }"
else
ntfy_data="{ \"topic\": \"motion_detection\", \"message\": \"Event ${event_type} on host ${motion_host} camera ${camera_name}\"}"
fi
ntfy_password="$(cat "${ntfy_password_file}")"
message "Sending event to ntfy server '${ntfy_server}/motion_detection' ..."
message "Data: ${ntfy_data}"
if [ -n "${file}" ]; then
curl -s "${ntfy_server}" -u "${ntfy_user}:${ntfy_password}" -d "${ntfy_data}"
temp_file="$(mktemp /tmp/tmp.XXXXX.mkv)"
$(which ffmpeg) -filter_complex "[0:v] fps=12,scale=480:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" -i "${file}" "${temp_file}"
ntfy_data="{ \"topic\": \"motion_detection\", \"message\": \"Event ${event_type} on host ${motion_host} camera ${camera_name}\", \"filename\": \"${temp_file}\" }"
curl -s "${ntfy_server}" -T "${temp_file}" -u "${ntfy_user}:${ntfy_password}" -d "${ntfy_data}"
return_code=$?
else
curl -s "${ntfy_server}" -T "${file}" -u "${ntfy_user}:${ntfy_password}" -d "${ntfy_data}"
ntfy_data="{ \"topic\": \"motion_detection\", \"message\": \"Event ${event_type} on host ${motion_host} camera ${camera_name}\"}"
curl -s "${ntfy_server}" -u "${ntfy_user}:${ntfy_password}" -d "${ntfy_data}"
return_code=$?
fi
if [ $return_code != 0 ]; then
message "Error ${return_code} publishing in ntfy server '${ntfy}'"
fi
message "Data sent: ${ntfy_data}"
fi
if [ -n "${ha_url}" ]; then