Quote:
Originally Posted by bkosborne
I'm looking for a way to monitor activity on a stream so that I can determine if there is anything come through the stream or not. If there is, I'll initiate a dump on it.
I imagine this working as running a cron task that checks a stream every 60 seconds. If it determines that a stream is coming through, then call upon rtmpdump to start recording it. If not, then do nothing and check again in 60 seconds.
Since rtmpdump just kind of errors out when there is no stream data, it doesn't seem like it would be a good idea to attempt to use it to monitor a stream.
It would be easy if I was doing this on a case-by-case basis manually, but I'm trying to automate the task of recording streams automatically if they are available.
Has anyone come across a way to do this? Perhaps some other tools I can use in command line (linux)?
|
RTMPDUMP doesn't necessarily have to be left to 'error out' if the stream pauses or stops streaming.
There are switches you can add to an RTMPDUMP command to allow for this. I add the following to the end of each command -
--resume --timeout 15
The "--timeout 15" switch causes the download attempt to end gracefully if no data is received for 15 seconds. You can specify any length of time, in seconds. If you don't include this switch, most builds of rtmpdump will time out after 120 seconds.
I use this switch to cause rtmpdump to test a url for the presence of actual data, and to time out if none is received.
The inclusion of the '--resume' switch causes the stream to continue the download - if you make a further attempt, after a timeout - from the point at which it left off, instead of going back to the start. The switch has no effect if used with a live stream.