Monday, August 4, 2014

Automated live recording using Wowza Streaming Engine 4

Currently MyKLIK team record the video from live sources manually. Because the video need to be edited like trim those TV commercials.

We can't do much for the editing part, it still needs human to do it, but for recording part, we plan to use our Wowza server.

RTM news will be aired 3 times daily, 1PM-1:45PM, 8PM to 9PM and 11:30PM to 12AM. So we can write a program to record the video from live source at specific time on daily basis.

For Wowza Streaming Engine 4, they have this feature which we can record the live source from the web browser.

What we want is automatic recording, which leads us to Linux CRON job sto start and stop the recording. I'm using PHP CLI script to automate the recording from command line. 

The script only do 2 things, start and stop the recording. The default parameters need to be set out before calling out the script. By default, Wowza will use MP4 format ( our livestream encoded in H264/AAC ) so this is good. And by default Wowza will split the videos for every hours. ( We changeds that to 4 hours per video ) and we change the default location.

Just run the script :
1) /usr/bin/php -q record.php start ( start the recording )
1) /usr/bin/php -q record.php stop ( stop the recording )

To check whether our command line works, just open your browser to http://<wowza server>:8086/livestreamrecord.

recorded files

Check out the files in the recording destination too. Finally, make sure to turn off Wowza Admin Digest for livestreamrecord in /usr/local/WowzaStreamingEngine/conf/VHosts.conf

cronjob | crontab -e

Sample recording in HLS : 


  1. Hi,

    great idea to do a cronjob. Will you provide me a download link for the script, so i can test it? Or can i write down the code from the screenshot? I'm not very firm with php.

    kind regards


  2. Here the script :

  3. works great, thanks a lot.



  4. great job, please note if you use livestreamrecord with none as the AuthenicationMethod, it is a security hole. Lock down with firewall rules to limit access, even it is localhost. Only allow localhost to access that port.

  5. How could I pass the authentication in your script? It would be possible?