• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

wowza

Wowza 4.8.0 Scripts

February 22, 2020

Here are the start and stop scripts for the lastest Wowza version 4.8.0.

Start scripts

sudo service WowzaStreamingEngine start
# or
/etc/init.d/WowzaStreamingEngine start

sudo service WowzaStreamingEngine start # or /etc/init.d/WowzaStreamingEngine start

Stop scripts

sudo service WowzaStreamingEngine stop
# or
/etc/init.d/WowzaStreamingEngine stop

sudo service WowzaStreamingEngine stop # or /etc/init.d/WowzaStreamingEngine stop

Filed Under: Cloud Tagged With: 4.8.0, script, start, stop, wowza

RTMP of MP4 via FFMPEG

October 27, 2019

FFMPEG is the jack of all trades utility for both audio and video files. You can record, convert, and even live stream an audio or video file in just about any file format. In this example, I will be sending a RTMP stream of a MP4 file to a Wowza streaming server. I can easily send the same stream to YouTube, Facebook or any streaming server that accepts a RTMP source. In this example, I created simple Bash script called play.sh, with all the options needed to live stream to Wowza Streaming server.

Here are the options in play.sh.

ffmpeg -re -i $1 -acodec libmp3lame -ar 44100 -b:a 128k \
-pix_fmt yuv420p -profile:v baseline -s 1280x720 -bufsize 6000k \
-vb 1200k -maxrate 1500k -deinterlace -vcodec libx264           \
-preset veryfast -g 30 -r 30 -f flv                            \
-flvflags no_duration_filesize                                 \
"rtmp://username:password@yourserver:1935/live/backup"

ffmpeg -re -i $1 -acodec libmp3lame -ar 44100 -b:a 128k \ -pix_fmt yuv420p -profile:v baseline -s 1280x720 -bufsize 6000k \ -vb 1200k -maxrate 1500k -deinterlace -vcodec libx264 \ -preset veryfast -g 30 -r 30 -f flv \ -flvflags no_duration_filesize \ "rtmp://username:password@yourserver:1935/live/backup"

To launch, run the script.

bash play.sh filename.mp4

bash play.sh filename.mp4

Filed Under: Linux Tagged With: ffmpeg, flv, livestream, mp4, rtmp, wowza

Online RTMP Players

April 20, 2019

Here are several online RTMP players:

  • Wowza Flash Player
  • Wowza Test Player
  • HLSTester
  • HLSPlayer

I prefer the Wowza test players. The last two has annoying ads.

Filed Under: Cloud, Linux Tagged With: flash, online, player, rtmp, wowza

StatsMaker

March 26, 2019

A couple of personal statistics scripts.

# create stats. can be run from cron.
/var/www/statsmaker/create.sh
# fix. must supply date.
/var/www/statsmaker/fix.sh 190201

# create stats. can be run from cron. /var/www/statsmaker/create.sh # fix. must supply date. /var/www/statsmaker/fix.sh 190201

Filed Under: Linux Tagged With: automation, create, stats, wowza

Parsing Wowza Logs

March 19, 2019

I’ve been wanting to look at Wowza logs for a very long time. I just spent a couple of hours writing a Bash script that generates a stats report. It parses the Wowza log file for the IP addresses, and runs them and against a site called ipinfo.io to get the viewer’s geo location. The output is filtered, sorted, takes a count, and finally generates a webpage. Here’s the Bash script.

# Can be placed in cron to run.
create-wowza-report.sh wowzastreamingengine_access.log

# Can be placed in cron to run. create-wowza-report.sh wowzastreamingengine_access.log

#!/bin/bash
 
# check for missing argument
if [ -z "$1" ]
  then
    echo "No arguments supplied. Format: create-wowza-report.sh wowzastreamingengine_access.log"
    exit 1
fi
 
# get the ips from the wowza log file
awk '{print $17}' $1 > output1.txt
 
# exclude invalid ips 
grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' output1.txt > output2.txt
 
# sort unique ips
cat output2.txt | sort -u | uniq > ips.txt
 
# pause for 1s
sleep 1s
 
# empty file just in case
> output3.txt
 
# set filename
filename="ips.txt"
 
# read filename and get geo info
while read -r ipaddress; do
  curl ipinfo.io/"$ipaddress" 2>/dev/null | awk -F'"' '$2=="city"{printf("%s, ", $4)}$2=="region"{print $4}' >> output3.txt
done < "$filename"
 
# cleanup empty geo locations
grep -v '^,' output3.txt > output4.txt
 
# sort output alphabetically
cat output4.txt | sort > output5.txt
 
# get a count of connections
count=$(wc -l < output5.txt)
 
# get today's date
filename=$(date +%Y%m%d)
date=`date +'%A %B %d, %Y'`
 
# rename file
mv output5.txt $filename.txt
 
# generate web page
cat <<EOF > $filename.php
<html>
<head>
<title>Wowza Streaming Stats on $date</title>
</head>
<body>
<h1>Live Streaming Stats</h1>
<p>Number of connections on $date: $count</p>
<?php include('$filename.txt');?>
</body>
</html>
EOF
 
# move files to web directory
cp $filename.* /var/www/html
 
# cleanup files
rm output*.txt
rm ips.txt

#!/bin/bash # check for missing argument if [ -z "$1" ] then echo "No arguments supplied. Format: create-wowza-report.sh wowzastreamingengine_access.log" exit 1 fi # get the ips from the wowza log file awk '{print $17}' $1 > output1.txt # exclude invalid ips grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' output1.txt > output2.txt # sort unique ips cat output2.txt | sort -u | uniq > ips.txt # pause for 1s sleep 1s # empty file just in case > output3.txt # set filename filename="ips.txt" # read filename and get geo info while read -r ipaddress; do curl ipinfo.io/"$ipaddress" 2>/dev/null | awk -F'"' '$2=="city"{printf("%s, ", $4)}$2=="region"{print $4}' >> output3.txt done < "$filename" # cleanup empty geo locations grep -v '^,' output3.txt > output4.txt # sort output alphabetically cat output4.txt | sort > output5.txt # get a count of connections count=$(wc -l < output5.txt) # get today's date filename=$(date +%Y%m%d) date=`date +'%A %B %d, %Y'` # rename file mv output5.txt $filename.txt # generate web page cat <<EOF > $filename.php <html> <head> <title>Wowza Streaming Stats on $date</title> </head> <body> <h1>Live Streaming Stats</h1> <p>Number of connections on $date: $count</p> <?php include('$filename.txt');?> </body> </html> EOF # move files to web directory cp $filename.* /var/www/html # cleanup files rm output*.txt rm ips.txt

Filed Under: Linux Tagged With: bash, live streaming, logs, stats, wowza

  • Home
  • About
  • Archives

Copyright © 2023