Skip to content

Instantly share code, notes, and snippets.

@stoyanovgeorge
Last active January 3, 2022 16:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stoyanovgeorge/ba2559a158b0f876f2915c29467aa7e8 to your computer and use it in GitHub Desktop.
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
#!/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