3

I am trying to use FFprobe to test if a streaming link is active or not.

For example this is a working streaming link:

ffprobe -loglevel quiet -show_streams rtmp://Lrmh0w.cloud.influxis.com/yoy/_definst_/185

I do get output which mean link is active.

However, once I change link to something not work:

ffprobe -loglevel quiet -show_streams rtmp://Lrmh0w.cloud.influxis.com/yoy/_definst_/18555555555

The command keeps running in background with no result.

Is there a way to bypass this, or is there any ffprobe timeout parameter? I couldn't find it from the official website documentation.

llogan
  • 121,796
  • 28
  • 232
  • 243
Krasic
  • 137
  • 2
  • 14

3 Answers3

6

I'm just using *nix timeout:

/usr/bin/timeout 5s /usr/bin/ffprobe $SOURCE

In my case, it was enough.

Maks
  • 61
  • 2
2

Try adding -timeout n before the url, where n is the number of seconds. If it doesn't help then you should ask the question without -loglevel quiet, including all the version info and error messages.

avnr
  • 614
  • 5
  • 12
  • Hello avnr, didnt worked for me tried normal , without -loglevel quiet , timeout before/after url , before/after show_stream nothing... – Krasic May 28 '15 at 23:18
  • The idea about removing -loglevel quiet is so that you can post the full dump and show all the info, such as ffprobe version, platform, included libs, the stream metadata, etc. You should re-post the question in a relevant forum such as superuser.com or SE's video production forum and include the full dump. – avnr May 29 '15 at 09:05
  • when i run without -loglevel quiet : it show ffprobe version, platform, included libs , however it stuck on stream medata and keep running on background with no result , is there any other way on php or ffprobe to check if a streaming link is up or down ? – Krasic May 29 '15 at 10:01
  • If the dump includes metadata then it probably means that ffprobe was able to establish a connection. In RTMP the path portion of the URI is not really a path but the name of an application registered on the the media server. So - assuming ffprobe really shows metadata - this means that the media server accepted the connection, but hangs due to the application's absence; in other words this indicates a media server issue. It would be much more efficient to assist you if you were to post the dump, the information about the metadata for example is very relevant. – avnr May 30 '15 at 19:11
0

I will +1 on the answers above : Adding a timeout before the ffprobe works.

ffprobe -show_format -timeout 1000000 -loglevel quiet  "${ChannelList[$i+1]}"

Would every now and then get stuck on a bad http request resulting in a 503 error (when looking at logs after removing loglevel quiet). Channel list is where all the stream links are loaded.

timeout 5s ffprobe -show_format -timeout 1000000 -loglevel quiet  "${ChannelList[$i+1]}"

This worked like a charm - prevented ffprobe from getting stuck indefinitely on a bad url and freezing the entire process.