Last active
January 3, 2022 16:40
-
-
Save stoyanovgeorge/ba2559a158b0f876f2915c29467aa7e8 to your computer and use it in GitHub Desktop.
Records 10 seconds of an UDP multicast stream and then it shows the stream settings using mediainfo. Requires medianfo and ffmpeg installed on the host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
stream="" | |
recording_dir=$HOME/recordings | |
while [[ ! $stream =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:[0-9] ]]; | |
do | |
echo "Please enter a valid multicast address and port in the format: IP.AD.DR.ESS:PORT after the script name!" | |
read -r stream | |
done | |
if [ ! -d "$recording_dir" ]; then | |
echo "Creating the new recording directory: $recording_dir" | |
mkdir -p "$recording_dir"; | |
fi | |
ffmpeg -v error -probesize 30M -analyzeduration 30M -fflags +genpts -re -i udp://"$stream"?fifo_size=1000000 -c copy -t 10 -y -f mpegts "$recording_dir"/"$stream".ts | |
mediainfo "$recording_dir"/"$stream".ts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment