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:
ffmpeg -re -i sample.mp4 -vcodec copy -acodec copy -f flv -y rtmp://localhost:1935/live/myStream
To shutdown client I’m using:
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