# ffmpeg stream monitoring, restarting

**URL:** <https://community.wowza.com/t/ffmpeg-stream-monitoring-restarting/36549>\
**Category:** Wowza Streaming Engine\
**Created:** [August 4, 2014, 4:38pm UTC](https://community.wowza.com/t/ffmpeg-stream-monitoring-restarting/36549 "2014-08-04T16:38:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ars\_M](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@Ars\_M](https://community.wowza.com/u/Ars_M)\
**Post date:** [August 4, 2014, 4:38pm UTC](https://community.wowza.com/t/ffmpeg-stream-monitoring-restarting/36549/1 "2014-08-04T16:38:40Z")

</div>

Hello

we transcoding live stream and sending to wowza.

Every day (i don’t know why, may be input stream error) my ffmpeg hands 2-3 times and i should monitoring and restarting ffmpeg service.

Is there any way keep running ffmpeg, even if we don’t have input stream?

Or good script for monitoring, restarting and help keep running ffmpeg ?

thank you

---

<div class="post-metadata">

**Author:** ![Daren\_Johnson](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@Daren\_Johnson](https://community.wowza.com/u/Daren_Johnson)\
**Post date:** [August 4, 2014, 9:54pm UTC](https://community.wowza.com/t/ffmpeg-stream-monitoring-restarting/36549/2 "2014-08-04T21:54:09Z")

</div>

Hi,

Would you share the ffmpeg command that you are using?

You should be able to monitor the error output of the ffmpeg command,

then kill and restart the ffmpeg command based on the error output results.

Daren

---

<div class="post-metadata">

**Author:** ![Ars\_M](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@Ars\_M](https://community.wowza.com/u/Ars_M)\
**Post date:** [August 5, 2014, 9:51am UTC](https://community.wowza.com/t/ffmpeg-stream-monitoring-restarting/36549/3 "2014-08-05T09:51:49Z")

</div>

i need to run 50 like this commands :

ffmpeg -i [http://111.111.111.111:8025/aaa](http://111.111.111.111:8025/aaa) -preset fast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 96k -vcodec libx264 -b:v 900k -f flv rtmp://222.222.222.222:1935/live/sample1

---

<div class="post-metadata">

**Author:** ![Ars\_M](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@Ars\_M](https://community.wowza.com/u/Ars_M)\
**Post date:** [August 6, 2014, 8:51am UTC](https://community.wowza.com/t/ffmpeg-stream-monitoring-restarting/36549/4 "2014-08-06T08:51:58Z")

</div>

i don’t really care for incoming stream error for now

I just need script for running 50 streams, monitoring, restarting and help keep running ffmpeg

---

<div class="post-metadata">

**Author:** ![Ars\_M](https://avatars.discourse-cdn.com/v4/letter/a/e68b1a/32.png) [@Ars\_M](https://community.wowza.com/u/Ars_M)\
**Post date:** [August 8, 2014, 9:32am UTC](https://community.wowza.com/t/ffmpeg-stream-monitoring-restarting/36549/5 "2014-08-08T09:32:54Z")

</div>

thank you, i will try

---

<div class="post-metadata">

**Author:** ![Daren\_Johnson](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@Daren\_Johnson](https://community.wowza.com/u/Daren_Johnson)\
**Post date:** [August 6, 2014, 9:39pm UTC](https://community.wowza.com/t/ffmpeg-stream-monitoring-restarting/36549/6 "2014-08-06T21:39:40Z")

</div>

Hi,

Another suggestion is to use a [unix tool like monit.](http://mmonit.com/monit)

It is able to monitor, stop and restart any process you choose

That way if any of your FFMPEG commands error out, and they would if the stream went away,

then monit should be able to pick it up and execute a restart.

Daren

---

<div class="post-metadata">

**Author:** ![Matt\_Young](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/matt_young/32/389_2.png) [@Matt\_Young](https://community.wowza.com/u/Matt_Young)\
**Post date:** [August 6, 2014, 4:17am UTC](https://community.wowza.com/t/ffmpeg-stream-monitoring-restarting/36549/7 "2014-08-06T04:17:05Z")

</div>

I’d suggest adding the -loglevel debug parameter to your command line and log everything to file in hopes that you can capture the actual issue.
