Group:  English: Entertainment ยป microsoft.public.windowsmedia.encoder
Thread: C# control of encoder; encoder monitor, stop detect, restart

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

C# control of encoder; encoder monitor, stop detect, restart
dl0haus 16.05.2007 17:16:02
I'm looking at implementing a "monitor" or a watchdog for our WM Encoder 9
encoders. I work for a network that streams live sporting events and other
programming and we've got a few internet "stations" that need to run 24/7.
The encoders seem to "break" sometimes for inexplicable reasons; they quit.

Basically what I need to do is write a .NET application (or some kind of
script?) that will monitor the encoder that is running and if it stops,
detects this condition and restarts automatically.

I imagine there are probably cases were the encoder might "really break"
meaning it crashes. I probably need a way to have some kind of
communications timeout with the encoder so I can restart the entire encoder
application if necessary.

This application I want to write keeps us from having to monitor everything
manually and doing manual restarts when we get an angry phone call.

Thanks,
D
Re: C# control of encoder; encoder monitor, stop detect, restart
"Mike Lowery" <selfspam[ at ]mouse-potato.com> 16.05.2007 19:28:51

"dl0haus" <dl0haus[ at ]discussions.microsoft.com> wrote in message
news:3DBB244B-25BB-47E4-9317-351030096F37[ at ]microsoft.com...
[Quoted Text]
> I'm looking at implementing a "monitor" or a watchdog for our WM Encoder 9
> encoders. I work for a network that streams live sporting events and other
> programming and we've got a few internet "stations" that need to run 24/7.
> The encoders seem to "break" sometimes for inexplicable reasons; they quit.
>
> Basically what I need to do is write a .NET application (or some kind of
> script?) that will monitor the encoder that is running and if it stops,
> detects this condition and restarts automatically.
>
> I imagine there are probably cases were the encoder might "really break"
> meaning it crashes. I probably need a way to have some kind of
> communications timeout with the encoder so I can restart the entire encoder
> application if necessary.
>
> This application I want to write keeps us from having to monitor everything
> manually and doing manual restarts when we get an angry phone call.

I wrote an app that did this for publishing points. It detected network
bandwidth and restarted when it went low for too long. Same concept could be
used for restarting an encoder.

SNMP can also be used to monitor bandwidth levels.


Re: C# control of encoder; encoder monitor, stop detect, restart
dl0haus 16.05.2007 22:24:02
That makes sense... I guess I was wondering if the encoder API has facilities
for querying existing encoders... It seems to me the SDK is for manipulating
encoder objects, not watching existing ones...

I'm not sure if I follow you on this relative to the encoder. It will
either be streaming or not (its clearly going to be showing on the encoder);
getting its feed from somewhere else. I guess what you are saying is the
network traffic would die down majorly if the encoder stopped because it
would no longer be pulling its stream from the source?

So you have some app that is running, detecting network bandwidth... it gets
low so you say hey, something is wrong... you do some programmatic thing to
pop the encoder process that is running (if it didn't crash which is usually
the case) and then pass some command-line execution to start another encoder
with parameters to start encoding (unless this is an option in the encoder on
startup)?

<"Mike Lowery" wrote:

[Quoted Text]
>
> "dl0haus" <dl0haus[ at ]discussions.microsoft.com> wrote in message
> news:3DBB244B-25BB-47E4-9317-351030096F37[ at ]microsoft.com...
> > I'm looking at implementing a "monitor" or a watchdog for our WM Encoder 9
> > encoders. I work for a network that streams live sporting events and other
> > programming and we've got a few internet "stations" that need to run 24/7.
> > The encoders seem to "break" sometimes for inexplicable reasons; they quit.
> >
> > Basically what I need to do is write a .NET application (or some kind of
> > script?) that will monitor the encoder that is running and if it stops,
> > detects this condition and restarts automatically.
> >
> > I imagine there are probably cases were the encoder might "really break"
> > meaning it crashes. I probably need a way to have some kind of
> > communications timeout with the encoder so I can restart the entire encoder
> > application if necessary.
> >
> > This application I want to write keeps us from having to monitor everything
> > manually and doing manual restarts when we get an angry phone call.
>
> I wrote an app that did this for publishing points. It detected network
> bandwidth and restarted when it went low for too long. Same concept could be
> used for restarting an encoder.
>
> SNMP can also be used to monitor bandwidth levels.
>
>
>
Re: C# control of encoder; encoder monitor, stop detect, restart
"Mike Lowery" <selfspam[ at ]mouse-potato.com> 17.05.2007 14:31:16

"dl0haus" <dl0haus[ at ]discussions.microsoft.com> wrote in message
news:D5AE5394-B564-40D2-BEF2-6595F12EA4EF[ at ]microsoft.com...
[Quoted Text]
> That makes sense... I guess I was wondering if the encoder API has facilities
> for querying existing encoders... It seems to me the SDK is for manipulating
> encoder objects, not watching existing ones...
>
> I'm not sure if I follow you on this relative to the encoder. It will
> either be streaming or not (its clearly going to be showing on the encoder);
> getting its feed from somewhere else. I guess what you are saying is the
> network traffic would die down majorly if the encoder stopped because it
> would no longer be pulling its stream from the source?

I'm a little confused on what you mean by "getting its feed from somewhere
else." Do you mean A/V feed? If so then that makes sense. And yes, I'm saying
if the encoder stops outputting packets, you know you have a failure. Generally
you can pick a bandwidth threshold to monitor, although static images
(commercials or dead air, for example) can cause low bandwidth too so you have
to be careful of that.

> So you have some app that is running, detecting network bandwidth... it gets
> low so you say hey, something is wrong... you do some programmatic thing to
> pop the encoder process that is running (if it didn't crash which is usually
> the case) and then pass some command-line execution to start another encoder
> with parameters to start encoding (unless this is an option in the encoder on
> startup)?

This all depends on the failures you've been experiencing. If the encoder app
is crashing, then you can either start a new WME process or do something more
drastic like reboot the encoder computer (which could then automatically restart
encoding if configured correctly.) If WME is just stopped, you could send it a
command to start encoding using the SDK. And yes, there are command-line
options you can specify to load a session and start encoding automatically.


Re: C# control of encoder; encoder monitor, stop detect, restart
dl0haus 17.05.2007 14:55:00
Ok... Well, if the SDK has objects that can access existing encoders that are
running and starting them, I'm assuming there are probably calls in the SDK
that can tell you whether its actually encoding something or not?

That to me would be the best solution... have a program that can poll the
encoder every 30 seconds or something with encoder.GetProperty("RUNNING"); or
whatever to see if its actually pushing packets as you said... if not, I'd
just do the encoder.Start() or whatever it would be.

The failures for the most part seem to be it just "stops". It doesn't
crash, something happens with the A/V feed or something else happens that
causes it to stop encoding...

So, I guess specifically my inquiry is about the SDK's capabilities to
monitor an encoder and start/stop/restart it. Do you know of any sample code
that does this in .NET?

Thanks,
D

"Mike Lowery" wrote:

[Quoted Text]
>
> "dl0haus" <dl0haus[ at ]discussions.microsoft.com> wrote in message
> news:D5AE5394-B564-40D2-BEF2-6595F12EA4EF[ at ]microsoft.com...
> > That makes sense... I guess I was wondering if the encoder API has facilities
> > for querying existing encoders... It seems to me the SDK is for manipulating
> > encoder objects, not watching existing ones...
> >
> > I'm not sure if I follow you on this relative to the encoder. It will
> > either be streaming or not (its clearly going to be showing on the encoder);
> > getting its feed from somewhere else. I guess what you are saying is the
> > network traffic would die down majorly if the encoder stopped because it
> > would no longer be pulling its stream from the source?
>
> I'm a little confused on what you mean by "getting its feed from somewhere
> else." Do you mean A/V feed? If so then that makes sense. And yes, I'm saying
> if the encoder stops outputting packets, you know you have a failure. Generally
> you can pick a bandwidth threshold to monitor, although static images
> (commercials or dead air, for example) can cause low bandwidth too so you have
> to be careful of that.
>
> > So you have some app that is running, detecting network bandwidth... it gets
> > low so you say hey, something is wrong... you do some programmatic thing to
> > pop the encoder process that is running (if it didn't crash which is usually
> > the case) and then pass some command-line execution to start another encoder
> > with parameters to start encoding (unless this is an option in the encoder on
> > startup)?
>
> This all depends on the failures you've been experiencing. If the encoder app
> is crashing, then you can either start a new WME process or do something more
> drastic like reboot the encoder computer (which could then automatically restart
> encoding if configured correctly.) If WME is just stopped, you could send it a
> command to start encoding using the SDK. And yes, there are command-line
> options you can specify to load a session and start encoding automatically.
>
>
>
Re: C# control of encoder; encoder monitor, stop detect, restart
"Mike Lowery" <selfspam[ at ]mouse-potato.com> 17.05.2007 20:39:13

"dl0haus" <dl0haus[ at ]discussions.microsoft.com> wrote in message
news:B47C6F30-CE19-44F3-9D22-9E0466A35C12[ at ]microsoft.com...
[Quoted Text]
> Ok... Well, if the SDK has objects that can access existing encoders that are
> running and starting them, I'm assuming there are probably calls in the SDK
> that can tell you whether its actually encoding something or not?
>
> That to me would be the best solution... have a program that can poll the
> encoder every 30 seconds or something with encoder.GetProperty("RUNNING"); or
> whatever to see if its actually pushing packets as you said... if not, I'd
> just do the encoder.Start() or whatever it would be.
>
> The failures for the most part seem to be it just "stops". It doesn't
> crash, something happens with the A/V feed or something else happens that
> causes it to stop encoding...
>
> So, I guess specifically my inquiry is about the SDK's capabilities to
> monitor an encoder and start/stop/restart it. Do you know of any sample code
> that does this in .NET?

There are no .NET libraries for WM, it's all COM based. The WME SDK has
examples.


RE: C# control of encoder; encoder monitor, stop detect, restart
xlthim 05.07.2007 18:50:01
We wrote a C# program where we have a 320x240 "preview" and "postview"
screen, along with a stats panel. As the stats get updated, you could monitor
the textboxes, and if one goes to zero (or less than a certain level), stop
the encoder, and restart it. Is this the idea of what you want?

xlthim

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net