How to check RTMP source stream is live or not?

Hits: 22164  
RTMP Source Check RTMP Source RTMP Live Stream

Dear Friends,
You can check RTMP Source is live or not using socket programming, but that will not give you exact output. Today I have tried Linux utility “rtmpdump” to test & check RTMP Source it produced quite interesting results on command line….

# rtmpdump -v -r rtmp:// -o /tmp/rtmp-checker.log

RTMP Output

 * RTMPChecker - by S V N L A B S () (
 * You can use and modify this code as long as the above reference to me still exists 😉

if(isset($_REQUEST['stream']) && $_REQUEST['stream']!="")

  exec("/usr/bin/rtmpdump -V  -v -r '".$_REQUEST['stream']."' -o /tmp/rtmp-checker.log 2>&1", $pp);
  echo implode("<br>", $pp);


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Check RTMP is live or not?</title>

<form name="rtmp" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="stream" value="rtmp://" /><br />
<input type="submit" name="check" value="check" />


Output may be…

Night is longer than day for those who dream & Day is longer than nights for those who MAKE their DREAMS come true…

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch

8 thoughts on “How to check RTMP source stream is live or not?”

  1. Thank you!!! You are my knight in shining armour 🙂

    I have changed the script a bit, because need to give it a stop time otherwise rtmpdump keeps on running. I’ve also removed the whole interactive part and made it run on its own.

    Reason being is that I integrated this with the check_http plugin of Nagios and now I FINALLY get notifications for my rtmp feeds 🙂

    Thank you!

  2.  You fool !
    There is a big vuln !

    .$_REQUEST[‘stream’] is unfiltered !!!

    if i would post ?stream= bla | id i would get a remote execution !


  3. Hi Sandeep,

    Please provide me step by step procedure to monitor RTMP video stream link.

  4. No, publishers should make an effort to provide secure code examples so their readers don’t get caught out and hacked.

  5. That’s surely true. Internet is full of copy-paste-cats who 1. Don’t know what security is. 2. Will copy code as shown.
    “It’s their fault, so why bother?”. Because by giving good’n’secure example, you make web a safer place :). If someone uses unsecured example. Even the author may get attacked by server with invulnerability if someone uses his code :P.

  6. Does your site have a contact page? I’m having a tough time locating it but, I’d like to shoot you an email.

    I’ve got some recommendations for your blog you might be interested in hearing.

    Either way, great website and I look forward to seeing it develop over time.

Leave a Reply

Your email address will not be published.