Motioneye - Audio

I know motioneye doesn’t capture or output audio at all, but it’s there in the RTSP stream, so can motioneye be adapted to capture audio?

A question you would need to ask the Motion project

No, Motioneye is not designed to do that, it ignores any Audio.

But you could use ffmpg to capture the audio of the stream (or even the whole stream with video and audio) with a command like:

ffmpeg -i rtsp://user:pass@camera/stream -c copy -map 0 out.mkv

Thank you Jappe, it worked.

I have 7 cameras, all with their own individual folders. How can I run this for all the cameras to start at the same time. Then tomorrow, create a new folder (date based folder structure), then create a new file in that folder? Very similar to how MotionEye currently works?

But thanks, it does work.

Do they need a new folder or can you not just create a new file in the folder with the date of the day or something like this?

Anyways, you can create a bash script and then let it run via cron (see: https://dietpi.com/docs/dietpi_tools/system_configuration/#dietpi-cron)

Or use systemd timers. It’s a time based activation of systemd services.

Here is an example bash script for 7 cameras:

Script
#!/bin/bash

BASE_DIR="/path/to/backups"

DATE=$(date '+%Y-%m-%d')

CAMERAS=(
    "rtsp://user:pass@camera1/stream"
    "rtsp://user:pass@camera2/stream"
    "rtsp://user:pass@camera3/stream"
    "rtsp://user:pass@camera4/stream"
    "rtsp://user:pass@camera5/stream"
    "rtsp://user:pass@camera6/stream"
    "rtsp://user:pass@camera7/stream"
)

mkdir -p "$BASE_DIR/$DATE"

for i in "${!CAMERAS[@]}"; do
    CAM_DIR="$BASE_DIR/$DATE/cam_$((i+1))"
    mkdir -p "$CAM_DIR"
    OUTPUT_FILE="$CAM_DIR/stream.mkv"
    
    ffmpeg -i "${CAMERAS[$i]}" -c copy -map 0 "$OUTPUT_FILE" &
done

wait

Do you know how to use cron or systemd services and timers?