PHP Parse HLS M3U8 TS Links








function parseHLS($file, $tag=".ts") {
$return = array();
$i = 0;
$handle = fopen($file, "r");
if($handle) {
while(($line = fgets($handle)) !== FALSE) {
if(strpos($line,"EXT-X-STREAM-INF") !== FALSE) {
if ($c=preg_match_all ("/.*?(BANDWIDTH)(.*?)(,)(RESOLUTION)(.*?)(,)/is", $line, $matches)) {
$return['data'][$i]['bandwidth'] = str_replace("=","",$matches[2][0]);
$return['data'][$i]['resolution'] = str_replace("=","",$matches[5][0]);

if($tag==".ts") {
if(strpos($line,".ts") !== FALSE) {
$return['data'][$i]['url'] = str_replace(array("\r","\n"),"",$line);

if($tag==".key") {
if(strpos($line,".key") !== FALSE) {  

preg_match( '/URI="([^"]*)"/i', $line, $array );
//print_r( $array[1] ) ;

//$return['data'][$i]['url'] = str_replace(array("\r","\n"),"",$line);
$return['data'][$i]['url'] = str_replace(array("\r","\n"),"",$array[1]);


if($tag==".m3u8") {
if(strpos($line,".m3u8") !== FALSE) {
$return['data'][$i]['url'] = str_replace(array("\r","\n"),"",$line);

return $return;

echo "<pre>";

// Get other m3u8 files from m3u8 master manifest 
$u = parseHLS("encoded-03-31-16-thu-jun-2017.m3u8", ".m3u8");


// Get TS segment files from m3u8 manifest 
$u = parseHLS("encoded-03-31-16-thu-jun-2017.360.m3u8", ".ts");


// Get key file from m3u8 manifest 
$u = parseHLS("encoded-03-31-16-thu-jun-2017.360.m3u8", ".key");


echo "</pre>";



[data] => Array
[0] => Array
[bandwidth] => 654000
[resolution] => 568x320
[url] => 1080p/encoded-03-31-16-thu-jun-2017.m3u8

[1] => Array
[bandwidth] => 2849000
[resolution] => 568x320
[url] => 720p/encoded-03-31-16-thu-jun-2017.m3u8

[2] => Array
[bandwidth] => 1033000
[resolution] => 568x320
[url] => 360p/encoded-03-31-16-thu-jun-2017.m3u8



[data] => Array
[0] => Array
[url] => encoded-03-31-16-thu-jun-201700000.ts

[1] => Array
[url] => encoded-03-31-16-thu-jun-201700001.ts

[2] => Array
[url] => encoded-03-31-16-thu-jun-201700002.ts

[3] => Array
[url] => encoded-03-31-16-thu-jun-201700003.ts

[data] => Array
[0] => Array
[url] => encoded-03-31-16-thu-jun-2017.key



Record Live Streaming Radio to MP3

Sometime you want to record Live Radio Stream to MP3 file, you can find many online linux tools for recording radio stream to server and then download to your local computer.

You can use Linux “wget” or “curl”


# curl -sS -o stream.mp3 –max-time 150 http://Radio-Server:Port/stream
Bitrate: 128 kb/s [it will make approx 2MB MP3 file]

# curl -sS -o stream.mp3 –max-time 150 http://Radio-Server:Port/stream
Bitrate: 64 kb/s [it will make approx 1MB MP3 file]


# ffmpeg -y -i http://Radio-Server:Port/stream stream.mp3

# ffmpeg -i http://Radio-Server:Port/stream -t 00:00:40 -acodec copy stream.mp3
[It will record MP3 file stream.mp3 of duration of 40 sec with same Radio Stream Codec Info & Bitrate]


# mplayer ‘http://Radio-Server:Port/stream’ -endpos ’00:01:00′ -vo null -ao pcm:waveheader:file=stream.wav &> /dev/null
# lame stream.wav stream.mp3 &> /dev/null


# wget -O stream.mp3 “http://Radio-Server:Port/stream”

How to Build Recognition as a Web Designer in 2017

With the mass number of web designers available online, it’s hard to get recognized for your work and expertise. It often takes web designers years to build a following and start getting recognized as a trusted authority in the industry. However, there are many things that you can do to get ahead and build recognition quicker in 2017. Here are some strategies that you can use to get your name out there and become a leading industry expert.

1. Create and Distribute Quality Content

The best way to show your expertise is to teach other people what you know through your content. Quality content will go a long way whether it’s something simple as a web hosting setup video or something more challenging like a header design tutorial. You want to publish content that targets your ideal client as well as your peers in the industry. That will help you bring in more business while helping you connect with other industry leaders and influencers.

But you have to do more than publish great content. You want to promote your content using social media, guest blog posts, viral campaigns, giveaways, etc. Content marketing tactics like infographics, contests and web design template giveaways can really give you the exposure you need to build an audience for your site and stand out in the crowded space.

2. Create Case Studies

A case study is one of the best ways to establish your expertise. What you want to do with your case studies is to do a ‘before and after’ example of a website design project. Show the reader what the website looked like before you worked on it and show what it looked like after you’ve made your changes. Case studies are popular because people often look for real life web design projects they can model.

You want to make these case studies as detailed as possible. Include photos, screenshots, rough drafts, test results and anything else that can explain your thought process. You want to walk readers through the problems and challenges of the original website and talk in-depth about how you resolved them. This kind of content tends to do well as it often gets shared by enthusiasts, influencers and experts who’ve found it to be helpful.

3. Build an Extensive and Diverse Portfolio

You’re probably already aware of the importance of having a portfolio on your website. Your portfolio shows potential clients what you’re capable of and is often essential to landing the job. The problem is that many web designers have a portfolio but don’t put up enough of their past work to showcase their talents. You want to display a respectable amount of work to show potential clients that you’ve had an extensive work experience.

Another problem is that many web designers focus on the same types of websites/projects and their portfolio is very two dimensional. You want to show that you can handle many different types of projects as you never know what the client is looking for. If you don’t have experience with different projects, then branch out and try to get projects that are outside of your comfort zone. It’ll give you the experience you need while also helping you diversify your portfolio.

4. Diversify Your Expertise

At this day and age, you need to more than design websites. If your knowledge only extends to designing a great looking site and setting up web hosting, you need to gain other web design/development skills. This can include anything from user experience design, SEO, storytelling oriented design, web branding, to responsive design. Having expertise in other aspects of web design helps you set yourself apart from other everyday designers and conveys that you bring more to the table for your clients.

One expertise that is often sought after is conversion rate optimization. People often need help getting their site to convert more traffic into leads or sales. By honing your skills in conversion rate optimization, you can attract clients that are looking for conversion focused design and even charge for additional services.

5. Collaborate with Industry Influencers and Leaders

One of the best ways to quickly get your name out there is to associate yourself with established influencers and industry leaders. There are a wide variety of ways you can work with other professionals. This can include anything from podcasts, interviews, content exchanges, to speaking at industry events.

You want to be on the look for opportunities to get involved with the community and other professionals in the industry. When somebody reaches out to you, don’t turn down the offer because it isn’t compensated. Use it is a platform to get your name out there. At the same time, don’t wait for people to reach out to you. Come up with creative ways you can work with others in your industry.

6. Aggressive Marketing

Nothing cures slow sales like marketing. You have to make sure that you invest a good amount of your time and money into marketing. There are many ways to market yourself as a web designer including content marketing, social media, display advertising, site sponsorships, to offline events. You have to be aggressive with your marketing if you want to grow.

At the same time, you need to be focused with your marketing. You want to focus on one strategy until you’ve figured out a way to make it work. For example, if you’re working on content marketing, figure out how to get results from your efforts rather than trying to working on other strategies simultaneously or jumping ship if you don’t see results quickly enough.

This is a short list of some of the most solid strategies to get your name recognized as a web designer in 2017. The process can be challenging but you’ll start to get some traction and leverage that into results with enough persistence.

jPlayer playbackRate Audio Speed Control for Podcast Player

Today one of my customer need Audio PlayBack Speed Control for HTML5 Audio Player. His requirement is that many people speak too slow on
podcasts. He wants to speed up the playback so that he don’t have to take so much time to listen to the podcast.

He actually wants button for speed [ 0.5x, 1x, 1.5x, 2x, 2.5x ] on HTML5 Audio using jPlayer.

jPlayer playbackRate

jPlayer playbackRate
Number : (Default: 1) : Defines the playback rate. Recommend that the jPlayer({defaultPlaybackRate}) matches this value during initilization.

jQuery(“#jplayer”).jPlayer(“option”,”playbackRate”, 1.5);

jQuery(“#jplayer”).jPlayer(“options”,{defaultPlaybackRate : 1.5});

<script type="text/javascript">

var currentSpeedIdx = 1;  
var speeds = [ 0.5, 1, 1.5, 2, 2.5 ];

function jpSpeedControl()

currentSpeedIdx = currentSpeedIdx + 1 < speeds.length ? currentSpeedIdx + 1 : 0;

jQuery("#jplayer").jPlayer("option","playbackRate", speeds[currentSpeedIdx]);

jQuery("#jpSpeedControl").html( speeds[currentSpeedIdx] + 'x' );



<div id="jpSpeedControl" title="Speed" style="cursor:pointer;" onclick="jpSpeedControl();">1x</div>

Live Transcoder for Nimble Streamer

WMSPanel’s Transcoder for Nimble Streamer is a premium add-on for Nimble Streamer which can decode, transform and encode live streaming media.

The Transcoder use H.264, MPEG2 video and AAC, MP3, MP2, Speex audio as Input. It support RTMP pulled and published, RTSP pulled and announced, MPEG-TS via HTTP and UDP as input protocols.

The Transcoder use H.264/AAC with pass-through support as Output. It support HLS, MPEG-DASH, RTMP and RTSP playback and re-publish, MPEG-TS playback and multicast as output protocols.

Transcoder for Nimble Streamer apply existing FFmpeg filters to the processed content.

– FFMPEG Filters are applied without streams interruption
– 4 different strategies for adding key frames alignment
– Resize / crop to create multiple resolutions
– Graphic overlays, picture-in-picture video
– Make filtering chains without additional decoding
– Audio transrating, e.g. 256Kbps to 192Kbps
– Audio re-sampling, e.g. 44KHz to 22KHz
– Mix several audio sources
– Add any custom or third-party filter

The Transcoder is provided per monthly subscription with an affordable pricing. With Nimble Streamer your total cost of ownership will be as low as possible.

Setup SHOUTcast Radio server on Linux

Download and install SHOUTcast DNAS server software

Create new user for running SHOUTCast:

# useradd shoutcast

Download Shoutcast DNAS package:

# wget

Extract SHOUTcast files:

# mkdir sc
# tar -xvf sc_serv2_linux_x64-latest.tar.gz -C sc

Change the ownership from root to the SHOUTcast user:

# chown -R shoutcast:shoutcast sc

Configuring SHOUTcast Server

# cd sc
# nano sc_serv.conf

Copy below content to file sc_serv.conf


Start SHOUTcast server

# ./sc_serv sc_serv.conf


Please make sure shoutcast port must be open in server firewall

Manage SHOUTcast Server and Create Daemon script

# ps aux | grep sc_serv ## Get Server PID
# killall sc_serv ## Stop server

# vi /usr/local/bin/shoutcast

Content of /usr/local/bin/shoutcast

case $1 in
cd /root/sc/
./sc_serv &
killall sc_serv
cd /root/sc/
./sc_serv daemon
echo “Usage shoutcast start|stop”

# chmod +x /usr/local/bin/shoutcast
# /usr/local/bin/shoutcast start
# /usr/local/bin/shoutcast stop

Automatically start the Shoutcast server after server reboot
# echo “/usr/local/bin/shoutcast start_daemon” >> ~/.bashrc

Wowza Live Stream thumbnail images with HTTP Provider

To get thumbnail images from Wowza Transcoder with an HTTP Provider Wowza Media Server 3 or later is required.

Config file to edit for Wowza Live Stream Thumbnails



PHP code

//No Authentication
exec(‘curl “http://[wowza-ip-address]:8086/transcoderthumbnail?application=[application-name]&streamname=[stream-name]&format=[jpeg or png]&size=[widthxheight]”‘);

//With Authentication
exec(‘curl – -digest -u [wowza-admin-user]:[wowza-admin-password] “http://[wowza-ip-address]:8086/transcoderthumbnail?application=[application-name]&streamname=[stream-name]&format=[jpeg or png]&size=[widthxheight]”‘);

[wowza-ip-address]: The IP address of the server running the Wowza media server
[application-name]: The application name the stream is running live
[stream-name]: The stream name of the live source stream.
[format]: Format of the image: either jpeg or png
[size]: Size of the thumbnail image.


HTTPTranscoderThumbnail.onHTTPRequest[live/_definst_/[stream-name]]: Live stream encoder not found

Make sure Wowza is configured for Transcoding of live streams with Transcoder Addons.


You will see some live encoded wowza streams based on selected transcoding template


Install Red5 Media Server on Ubuntu / Debian

Red5 is free media server based on Java and other open source frameworks. It support FLV, F4V, MP4, 3GP, MP3, F4A, M4A, AAC and protocols like RTMP, RTMPT, RTMPS, RTMPE.

Install Red5 Media server
# apt-get install red5-server

Red5 Need below ports open in firewall / iptable
RTMP: 1935
Debug proxy: 1936
HTTP servlet: 5080
RTMPT: 8088

Red5 Installed location

Red5 application in the location

Install demo Red5 Applications
# wget
# mkdir red5/
# cd red5
# unzip ../
# cd red5-server-1.0/
# cp -R webapps/root/demos /var/lib/red5/webapps/root/demos
# cp -R webapps/installer /var/lib/red5/webapps/installer
# find /var/lib/red5/webapps/ -type d -exec chown _red5 {} \;
# /etc/init.d/red5-server restart

Red5 Installer

Red5 Demo

MistServer PHP API for Live Stream

MistServer is a highly versatile, lightweight, customizable open-source multi-standard multimedia server. MistServer configuration is easy to use for full CDN solutions applications. Hope you already read our article to Install MistServer

Mistserver Manager Login

MistServer API provides a Server API and a Management API.

You can find MistServer PHP API Examples Here

Note: Make sure port 4242 used for MistServer is open on your web hosting firewall where you run MistServer PHP API for Live Stream

MistServer PHP API for Live Stream will try to put/get data using PHP CURL in port 4242

$server = new Mistserver();
$server->login(‘http://server-ip:4242/api’, ‘username’, ‘password’);

// you can add a live stream:
$server->add_stream( STREAM_NAME, push://@SOURCE, BUFFER_TIME);


Your channel has been successfully created. Use the details below to broadcast:
Download: Download Flash Media Live Encoder 3.2
FMS URL: rtmp://server-ip:1935/live
Stream Name: churchstream


As you get Live Media Stream details you can use our article to make your event live…
Live video stream event for online Temple or Church

API Call Reference:

Install Red5 1.0.1 on CentOS release 6.5 (Final) 64-Bit

Contact us for Red5 HLS Plugin

Red5 MySQL Authentication Plugin

Wowza MySQL Authentication Plugin

1. Install Java

# yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

2. Install Ant

# cd /usr/local/src
# wget
# tar zxvf apache-ant-1.8.2-bin.tar.gz
# mv apache-ant-1.8.2 /usr/local/ant

3. Export path for Ant and Java

# export ANT_HOME=/usr/local/ant
# export JAVA_HOME=/usr/lib/jvm/java
# export PATH=$PATH:/usr/local/ant/bin
# export CLASSPATH=.:$JAVA_HOME/lib/

Also add these lines in /etc/bashrc at last to available every-time logged in to SSH

# echo ‘export ANT_HOME=/usr/local/ant’ >> /etc/bashrc
# echo ‘export JAVA_HOME=/usr/lib/jvm/java’ >> /etc/bashrc
# echo ‘export PATH=$PATH:/usr/local/ant/bin’ >> /etc/bashrc
# echo ‘export CLASSPATH=.:$JAVA_HOME/lib/’ >> /etc/bashrc

4. Install RED5 Server

# cd /usr/local/src
# wget
# tar zxvf red5-1.0.1.tar.gz
# mv /usr/local/src/red5-server-1.0 /usr/local/red5

5. Create a service for Red5 to start and stop

# wget -O /etc/init.d/red5
# chmod +x /etc/init.d/red5

6. Allow port 5080 and 1935 to your server firewall

# iptables -A INPUT -p tcp -m tcp –dport 5080 -j ACCEPT
# iptables -A INPUT -p tcp -m tcp –dport 1935 -j ACCEPT

make sure you have double hyphen no space (- -) in dport option

OR allow from WHM


7. Red5 Server Command

# /etc/init.d/red5 start
# /etc/init.d/red5 stop
# /etc/init.d/red5 status

# netstat -anp | grep 5080
# ps aux | grep red5

Go to to test Red5 Server Videos over RTMP