Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Make test script destination optional

Gabe Kangas4d654bb30c07
diff --git a/test/ocTestStream.sh b/test/ocTestStream.sh
index 16181cc342..be014afd97 100755
--- a/test/ocTestStream.sh
+++ b/test/ocTestStream.sh
@@ -2,19 +2,32 @@
# A recent version of ffmpeg is required for the loop of the provided videos
# to repeat indefinitely.
+# Example: ./test/ocTestStream.sh ~/Downloads/*.mp4 rtmp://localhost/live/abc123
-if ! ([[ $1 ]] && [[ $2 ]])
+if ! ([[ $1 ]])
then
echo "ocTestStream is used for sending pre-recorded content to a RTMP server."
- echo "./ocTestStream.sh *.mp4 rtmp://desination.host/live/streamkey"
+ echo "Will default to localhost with the stream key of abc123 if one isn't provided."
+ echo "./ocTestStream.sh *.mp4 [RTMPDESINATION]"
exit
fi
-array=( $@ )
-ARGS_LEN=${#array[@]}
-CONTENT=${array[@]:0:$ARGS_LEN-1}
-DESTINATION_HOST=${@: -1}
-FILE_COUNT=$( expr ${#} - 1 )
+# Make the destination optional and point to localhost with default key
+if [[ ${@: -1} == *"rtmp://"* ]]; then
+ echo "RTMP is specified"
+ DESTINATION_HOST=${@: -1}
+ array=( $@ )
+ ARGS_LEN=${#array[@]}
+ CONTENT=${array[@]:0:$ARGS_LEN-1}
+ DESTINATION_HOST=${@: -1}
+ FILE_COUNT=$( expr ${#} - 1 )
+else
+ DESTINATION_HOST="rtmp://localhost/live/abc123"
+ array=( $@ )
+ ARGS_LEN=${#array[@]}
+ CONTENT=${array[@]:0:$ARGS_LEN}
+ FILE_COUNT=$( expr ${#} )
+fi
# Delete the old list of files if it exists
if test -f list.txt; then
@@ -28,4 +41,4 @@ done
echo "Streaming a loop of ${FILE_COUNT} videos to $DESTINATION_HOST... ctl+c to exit"
-ffmpeg -hide_banner -loglevel panic -stream_loop -1 -re -f concat -safe 0 -i list.txt -vcodec libx264 -profile:v main -sc_threshold 0 -b:v 1300k -preset ultrafast -acodec aac -b:a 192k -x264opts keyint=50 -g 25 -pix_fmt yuv420p -f flv $DESTINATION_HOST
+ffmpeg -hide_banner -loglevel panic -stream_loop -1 -re -f concat -safe 0 -i list.txt -vcodec libx264 -profile:v main -sc_threshold 0 -b:v 1300k -preset veryfast -acodec copy -f flv $DESTINATION_HOST