Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   rtmpdump (http://stream-recorder.com/forum/forumdisplay.php?f=54)
-   -  

Killing RTMPsrv/RTMPdump inside Windows

(http://stream-recorder.com/forum/showthread.php?t=14051)

RedPenguin 10-17-2012 12:25 AM

Killing RTMPsrv/RTMPdump inside Windows


 
I have successfully created a batch file to open RTMPDumpHelper and browser.

The problem I have is I tried to use taskkill and Cygwin tools to kill rtmpsrv and rtmpdump.

The problem is it apparently only kills rtmpsrv but not the rtmpdump that is started.

I randomly use rtmpdump in other batch files around same time so I can't just try killing any rtmpdump.

Anybody know if there is a way to watch for the exact PID or something, cause only way so far is kill it when I get a chance causing unnecessary extra recording.

svnpenn 10-17-2012 07:17 AM

Re: Killing RTMPsrv/RTMPdump inside Windows


 
If you get my build of RtmpSrv, you can use the "--printonly" option.

Code:

$ rtmpsrv --help
This is just a stub for an RTMP server. It doesn't do anything beyond
obtaining the connection parameters from the client.

-h, --help              Prints this help screen.
-c, --port port        Overrides the port in the rtmp url
-i, --printonly        Print RtmpDump command and exit
-z, --debug            Debug level command output.
-N, --version          Print version information and exit

github.com/svnpenn/rtmpdump/downloads

RedPenguin 10-23-2012 04:17 PM

Re: Killing RTMPsrv/RTMPdump inside Windows


 
I see how your rtmpsrv works but I'm not quite sure how I can still kill it afterwards.

I mean I still think I would have to find some way to find out exactly which rtmpdump is running for my recording and kill only that one.

svnpenn 10-23-2012 04:42 PM

Re: Killing RTMPsrv/RTMPdump inside Windows


 
Quote:

Originally Posted by RedPenguin (Post 55660)
I see how your rtmpsrv works but I'm not quite sure how I can still kill it afterwards. I mean I still think I would have to find some way to find out exactly which rtmpdump is running for my recording and kill only that one.

It is clear you have misunderstood the "--printonly" option. It does not invoke RtmpDump. Running RtmpSrv with the printonly option merely prints the first RtmpDump command detected and exits.

RedPenguin 10-23-2012 08:08 PM

Re: Killing RTMPsrv/RTMPdump inside Windows


 
Quote:

Originally Posted by svnpenn (Post 55661)
It is clear you have misunderstood the "--printonly" option. It does not invoke RtmpDump. Running RtmpSrv with the printonly option merely prints the first RtmpDump command detected and exits.

Well I understand that part but I was temporarily confused on how to kill the rtmpdump I start afterwards with the output.

svnpenn 10-23-2012 08:20 PM

Re: Killing RTMPsrv/RTMPdump inside Windows


 
Quote:

Well I understand that part but I was temporarily confused on how to kill the rtmpdump I start afterwards with the output.
Cygwin has long known issues with non-Cygwin binaries, AKA RtmpDump. If you want to kill RtmpDump with Cygwin, you need to do one of these

Quote:

# Instead of invoking like this
rtmpdump -o a.flv -r rtmp://server.com/app/playpath
# Invoke like this, then hit Ctrl+C to stop
timeout 1d rtmpdump -o a.flv -r rtmp://server.com/app/playpath

# Set RtmpDump to simply stop after certain time
rtmpdump -o a.flv -r rtmp://server.com/app/playpath -B 10

# Invoke RtmpDump under cmd.exe instead of Bash
rtmpdump -o a.flv -r rtmp://server.com/app/playpath

# Compile RtmpDump as a Cygwin binary instead of Native Windows binary
rtmpdump -o a.flv -r rtmp://server.com/app/playpath

# Kill RtmpDump using Cygwin commands
ps -W | awk /rtmpdump/'{print$4;exit}' | xargs kill -f

# Use Windows Task Manager to kill
rtmpdump.exe


RedPenguin 10-26-2012 10:26 PM

Re: Killing RTMPsrv/RTMPdump inside Windows


 
Thank you so much.

I finally came up with a working idea from your solutions.

I realized with "ps -W" I can find out exactly which rtmpdump is running and kill only the one going to RTMPDumpHelper and not the other one on the system recording other stuff at any given moment.

hyc 10-30-2012 04:09 PM

Re: Killing RTMPsrv/RTMPdump inside Windows


 
Quote:

Originally Posted by svnpenn (Post 55667)
Cygwin has long known issues with non-Cygwin binaries, AKA RtmpDump. If you want to kill RtmpDump with Cygwin, you need to do one of these

I wrote a fix for this years ago.

http://thread.gmane.org/gmane.comp.g...793/focus=3797

Seems like it may not have been committed, unfortunately.

http://sourceforge.net/tracker/index...&at id=302435

Woebegone 10-30-2012 04:55 PM

Re: Killing RTMPsrv/RTMPdump inside Windows


 
I use Cygwin as well. I often have multiple streams running, so "ps" doesn't do it for me. I found the following command allows me to pick the right rtmpdump stream to kill:

WMIC.exe PROCESS get CommandLine,ProcessId

I parse out the lines and grep the particular stream I want dead. Then kill -9 on the correct pid works pretty well for me. The only downside is the (partial) stream doesn't get finished, so stream viewers will think it's a live stream. I'm sure a quick trip through ffmpeg would clear that up, though. (I haven't actually tried, cause I throw away the streams I kill.)

svnpenn 10-30-2012 05:15 PM

Re: Killing RTMPsrv/RTMPdump inside Windows


 
Quote:

Originally Posted by hyc (Post 55952)
I wrote a fix for this years ago.

http://thread.gmane.org/gmane.comp.g...793/focus=3797

Seems like it may not have been committed, unfortunately.

http://sourceforge.net/tracker/index...&at id=302435

If you have the gumption, it would do much better on the Cygwin mailing list, not MinGW. For this glaring "error" to be allowed after so many years is telling.


All times are GMT -6. The time now is 07:10 PM.