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

rtmpdump and batch commands...

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

troller12 11-24-2014 10:13 AM

rtmpdump and batch commands...


 
Hi guys,

I have some questions about batch.So I wanna create a little script where I have stored some rtmp links of the same channel (three or more for exsample) and now if I run the batch script then it starts to check the first rtmp link (all ok so far) and does execute the player too.The problem I have is that not all links will checked directly one after another so I have each time to exit the player before the batch script works go on.Lets say there are 4 links to check and the first three are not working at the moment then I have to close the player three times so this I wanna prevent to do manually so that the script does do it automatically you know.

The next question I have is: Is there a command I can use to set a time limit command in the script to check a link?So checking some channels does take mostly a longer time by rtmpdump (20 seconds+) before rtmpdump has ended the check or cleanup (ctrl+c) etc and here I wanna set a check time limit so that rtmpdump does check the link for 5 seconds for exsample and if the link was not loaded successfully in this time limit then the batch script should skip it and jump to next link to check.

Maybe you have some ideas whether its possible to do this via some batch commands etc.

greetz

arcticfox 01-17-2015 07:52 PM

Re: rtmpdump and batch commands...


 
Changing the --timeout parameter (-m) from default to 5 seconds may help.

troller12 01-18-2015 03:00 AM

Re: rtmpdump and batch commands...


 
Hi,

so it still keep the problem with the player itself which I have to close manually after calling each link before the batch / CMD does check the next link and thats the problem.But how to let close the player automatically right after a calling link was failed?Thats the main problem where I can't find any solution using batch you know.

greetz

j_cool 01-06-2017 04:36 PM

Re: rtmpdump and batch commands...


 
taskkill /FI "WINDOWTITLE eq C:\AP\ff\ffplay.exe" /FI "CPUTIME le 00:00:01"



Open 30 ffplay.exe's at the same time. One using any cpu resources stays, ones using none, go.

here after 15 secs:

writeln(f2,'sleep 15');
writeln(f2,'taskkill /FI "WINDOWTITLE eq C:\AP\ff\ffplay.exe" /FI "CPUTIME le 00:00:01"');


http://processhacker.sourceforge.net/

hacker(menu) - options - advanced - Include CPU (and other) usage of children in collapsed processes




C:\MISC\D7\>taskkill /?

TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]

Description:
This tool is used to terminate tasks by process id (PID) or image name.

Parameter List:
/S system Specifies the remote system to connect to.

/U [domain\]user Specifies the user context under which the
command should execute.

/P [password] Specifies the password for the given user
context. Prompts for input if omitted.

/FI filter Applies a filter to select a set of tasks.
Allows "*" to be used. ex. imagename eq acme*

/PID processid Specifies the PID of the process to be terminated.
Use TaskList to get the PID.

/IM imagename Specifies the image name of the process
to be terminated. Wildcard '*' can be used
to specify all tasks or image names.

/T Terminates the specified process and any
child processes which were started by it.

/F Specifies to forcefully terminate the process(es).

/? Displays this help message.

Filters:
Filter Name Valid Operators Valid Value(s)
----------- --------------- -------------------------
STATUS eq, ne RUNNING |
NOT RESPONDING | UNKNOWN
IMAGENAME eq, ne Image name
PID eq, ne, gt, lt, ge, le PID value
SESSION eq, ne, gt, lt, ge, le Session number.
CPUTIME eq, ne, gt, lt, ge, le CPU time in the format
of hh:mm:ss.
hh - hours,
mm - minutes, ss - seconds
MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB
USERNAME eq, ne User name in [domain\]user
format
MODULES eq, ne DLL name
SERVICES eq, ne Service name
WINDOWTITLE eq, ne Window title

NOTE
----
1) Wildcard '*' for /IM switch is accepted only when a filter is applied.
2) Termination of remote processes will always be done forcefully (/F).
3) "WINDOWTITLE" and "STATUS" filters are not considered when a remote
machine is specified.

Examples:
TASKKILL /IM notepad.exe
TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
TASKKILL /F /IM cmd.exe /T
TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM *
TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"

C:\MISC\D7\>





program FFcams;
{$APPTYPE CONSOLE}
uses windows,ClipBrd,ShellApi,StrUtils,sysutils;
var sf,s,clb,tmp: ansistring;
f,f2: text;

begin

tmp:=GetEnvironmentVariable('TEMP'); // C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp

assign(f2,tmp+'\tkil.bat');
rewrite(f2);
writeln(f2,'sleep 15');
writeln(f2,'taskkill /FI "WINDOWTITLE eq C:\AP\ff\ffplay.exe" /FI "CPUTIME le 00:00:01"');
writeln(f2,'del '+tmp+'\tkil.bat');
close(f2);

clb:= AnsiLowerCase(Clipboard.AsText);

assign(f,'c:\misc\cams\cams.txt');
reset(f);
while not eof(f) do
begin
readln(f,sf);
if AnsiContainsText(sf,'rtmp://') then
begin
s:= '-i "' + sf + clb + '/' + clb + ' live=1" -analyzeduration 0 -autoexit';
ShellExecute(0,'open',PChar('ffplay.exe'), PChar(s), nil,SW_MINIMIZE);
end;
end;
close(f);

ShellExecute(0,'open',PChar('cmd'), PChar('/C '+tmp+'\tkil.bat'),'',SW_HIDE);

end.


All times are GMT -6. The time now is 09:26 PM.