Both these url's:
rtsp://admin:password@192.168.1.167/h264Preview_01_main
rtsp://admin:password@192.168.1.167/h265Preview_01_main
did output in h265.
Changing the codec to MJPEG didn't help either for viewing. The only thing I could see was the first and last second of the recording, nothing in between. On the other hand, the sub stream recordings were coming as h264 and played properly in the browser. So I decided to come up with this hack where I convert the h265 recordings to h264 via a cron job and then they seem to work fine in the browser via the ZM console.
The shell script for the cron is as follows:
Code: Select all
#!/bin/bash
cd /var/cache/zoneminder/events/2
find -cmin -10 -cmin +2 -name '*.mp4' -print0 | while IFS= read -r -d '' file;
do
DIR=$(dirname "$file")
echo "$DIR"
CODEC=$(ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$file")
if [ "$CODEC" == "hevc" ]
then
ffmpeg -i "$file" -map 0 -c:v libx264 -crf 18 -c:a copy "$DIR/output.mp4" < /dev/null
rm "$file"
mv "$DIR/output.mp4" "$file"
chown "www-data" "$file"
chgrp "www-data" "$file"
fi
done
This is on Ubuntu 22.04. Hope it can be of use to someone.
JAG