# Transcoder doesn't stop when I reject connection

**URL:** https://community.wowza.com/t/transcoder-doesnt-stop-when-i-reject-connection/42408
**Category:** Wowza Streaming Engine
**Created:** [March 20, 2014, 4:10pm UTC](https://community.wowza.com/t/transcoder-doesnt-stop-when-i-reject-connection/42408 "2014-03-20T16:10:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Jose\_Sesma](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@Jose\_Sesma](https://community.wowza.com/u/Jose_Sesma)
#### Post date: [March 20, 2014, 4:10pm UTC](https://community.wowza.com/t/transcoder-doesnt-stop-when-i-reject-connection/42408/1 "2014-03-20T16:10:02Z")

</div>

My problem is that when I broadcast with ffmpeg aplication I can’t stop the transcoder.

I mean, I have a logic to check if user is allowed to broadcast or not. And if the result is false, i shutdown stream and reject client.

With wirecast it works fine, users only can broadcast when the result is true, if it’s false they don’t broadcast.

But with ffmpeg even the result of logic function is false, it broadcasts like nothing happens. At least transcoder still on, and when I close connection in ffmpeg the original video gets corrupted, but transcoded videos are fine.

I’m using the follow code to broadcast:

```auto
ffmpeg -re -i sample.mp4 -vcodec copy -acodec copy -f flv -y rtmp://localhost:1935/live/myStream

```

To shutdown client I’m using:

```auto
if(stream.getClient()!=null){
		stream.getClient().rejectConnection("NetConnection.Connect.Closed");
		stream.getClient().rejectConnection("NetConnection.Connect.Rejected");
		stream.getClient().rejectConnection("NetStream.Play.UnpublishNotify");
                stream.getClient().shutdownClient();
		sendClientOnStatusError(stream.getClient(), "NetStream.Play.UnpublishNotify", "The publisher was rejected, Unauthorized");
		sendClientOnStatusError(stream.getClient(), "NetConnection.Connect.Closed", "shutdown your stream");
	}
	stream.stopPublishing();
	stream.shutdown();
	stream.close();
        stream.flush();
	sendStreamOnStatusError(stream, "NetStream.Play.UnpublishNotify", "The publisher was rejected, Unauthorized");
	sendStreamOnStatusError(stream, "NetConnection.Connect.Closed", "shutdown your stream");

```

What could be the problem?

Thank you,

Jose

---

<div class="post-metadata">

### Author: ![sal\_jefferson](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sal\_jefferson](https://community.wowza.com/u/sal_jefferson)
#### Post date: [March 21, 2014, 9:33am UTC](https://community.wowza.com/t/transcoder-doesnt-stop-when-i-reject-connection/42408/2 "2014-03-21T09:33:22Z")

</div>

Hi there, the way to shutdown an RTMP connection is to use IClient.setShutdownClient(true)

Salvadore

---

<div class="post-metadata">

### Author: ![sal\_jefferson](https://avatars.discourse-cdn.com/v4/letter/s/6de8d8/32.png) [@sal\_jefferson](https://community.wowza.com/u/sal_jefferson)
#### Post date: [March 21, 2014, 10:08am UTC](https://community.wowza.com/t/transcoder-doesnt-stop-when-i-reject-connection/42408/3 "2014-03-21T10:08:19Z")

</div>

No need to apologize, glad I could help!

Salvadore

---

<div class="post-metadata">

### Author: ![Jose\_Sesma](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@Jose\_Sesma](https://community.wowza.com/u/Jose_Sesma)
#### Post date: [March 21, 2014, 4:50pm UTC](https://community.wowza.com/t/transcoder-doesnt-stop-when-i-reject-connection/42408/4 "2014-03-21T16:50:00Z")

</div>

> Hi there, the way to shutdown an RTMP connection is to use IClient.setShutdownClient(true)
> 
> Salvadore

Hi Salvadore,

Wow!! It works like a charm… 😃

Thank you so much and sorry for inconveniences!!
