Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7918423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:30:13+00:00 2026-06-03T15:30:13+00:00

I’ve used the exec() function a few times in the past to capture information

  • 0

I’ve used the exec() function a few times in the past to capture information from command line executables, and had intended to do this again with RTMPDump.exe. The PHP code is as follows, and works with any other cmd line examples I’ve used in the past, but in this case yields nothing to $output:

    $cmd = 'c:\rtmpdump\rtmpdump -r "rtmp://fms.domain.com/live/live_800"';
    exec($cmd, $output);
    foreach ($output as $item){
        // do something with this $item
    }

I’ve tried it by putting the Windows command line in a .bat file, and running that, in which ase $output then contains only what was echoed in the bat file, but not the output shown below, which is what results when I run the command manually from the command line.

C:\rtmpdump>rtmpdump -r "rtmp://fms.domain.com/live/live_800"
RTMPDump v2.3
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
ERROR: rtmp server sent error
Starting Live Stream
For duration: 2.000 sec
INFO: Metadata:
INFO:   author
INFO:   copyright
INFO:   description
INFO:   keywords
INFO:   rating
INFO:   title
INFO:   presetname            Custom
INFO:   creationdate          Tue May 08 03:00:23 2012
INFO:   videodevice           Osprey-440 Video Device 1B
INFO:   framerate             25.00
INFO:   width                 480.00
INFO:   height                360.00
INFO:   videocodecid          avc1
INFO:   videodatarate         800.00
INFO:   avclevel              30.00
INFO:   avcprofile            66.00
INFO:   videokeyframe_frequency10.00
INFO:   audiodevice           Osprey-440 Audio Device 1B
INFO:   audiosamplerate       22050.00
INFO:   audiochannels         1.00
INFO:   audioinputvolume      75.00
INFO:   audiocodecid          mp4a
INFO:   audiodatarate         48.00
#######
Download complete

C:\rtmpdump>rtmpdump

The program DOES run, that’s not the problem, there is an output file that shows the video data dump, so syntax of the executable is not the issue – the question is whether there is any other way to intercept what rtmpdump.exe is outputting to the command window, that is NOT being captured by running it from PHP via exec().

And if it matters, it’s the “INFO:… ” that I’m interested in using. I’m trying to determine if a live video stream is streaming or not. The server is running, but I need to know if a particular stream (live_800) is streaming or not.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:30:15+00:00Added an answer on June 3, 2026 at 3:30 pm

    Thanks to JohnF getting me on the right track, should any other novices need to accomplish this, here’s how I did it using proc_open:

    $descriptorspec = array(
    0 => array("pipe", "r"),    // stdin is a pipe that the child will read from
    1 => array("pipe", "w"),    // stdout is a pipe that the child will write to
    2 => array("pipe", "w")     // stderr is a pipe that the child will write to
    );
    $cmd = c:\rtmpdump\rtmpdump -r "rtmp://fms.domain.com/live/live_800 -B 1 -m 3";
    $process = proc_open($cmd, $descriptorspec, $pipes);
    if (is_resource($process)) {
        $stdin = stream_get_contents($pipes[0]);
        $stdout = stream_get_contents($pipes[1]);
        $stderr = stream_get_contents($pipes[2]);
        fclose($pipes[0]);  fclose($pipes[1]);  fclose($pipes[2]);
        // It is important that you close any pipes before calling proc_close in order to avoid a deadlock
        $return_value = proc_close($process);   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.