Skip to content

Instantly share code, notes, and snippets.

@mekya
Last active July 4, 2021 08:52
Show Gist options
  • Save mekya/20a99ec07c208e03027e3221bf100029 to your computer and use it in GitHub Desktop.
Save mekya/20a99ec07c208e03027e3221bf100029 to your computer and use it in GitHub Desktop.
Give RTMP load to the Ant Media Server
#!/bin/bash
##
## This script sends number of Big Buck Bunny video(2119 Kbps 1280x720) to the Ant Media Server via RTMP for load testing.
## first parameter is the number of rtmp stream to send the server
## second parameter is the server address to send that rtmp streams
##
## Sample usage
## ./load_rtmp.sh 100 172.99.22.33
## Above script send 100 RTMP streams to the Ant Media Server running in 172.99.22.33
LOAD=$1
SERVER_ADDR=$2
FILE=BigBuckBunny.mp4
if [ ! -f "$FILE" ]; then
echo "$Download does not exist."
wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4
fi
for i in $( eval echo {1..$LOAD} )
do
echo "Load $i"
ffmpeg -re -i $FILE -codec copy -f flv rtmp://$SERVER_ADDR/WebRTCAppEE/stream$i &
sleep .2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment