<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div>I found the solution.</div>
<div>For those who would need to do the same:</div>
<div><br>
</div>
<div>SECURITY_ATTRIBUTES sa;</div>
<div>char filename[MAX_PATH];
<div>char errfile[MAX_PATH];</div>
<div>char szCdeLine[1024];</div>
</div>
DWORD dwErr, dwFlags;
<div><br>
</div>
<div>ZeroMemory(&sa, sizeof(sa));</div>
<div>sa.nLength = sizeof(sa);</div>
<div>sa.bInheritHandle = true;</div>
<div>sa.lpSecurityDescriptor = NULL;</div>
<div><br>
</div>
<div>
<div>strcpy(filename, "e:\\tmp\\video.tmp");</div>
HANDLE hStdOut = CreateFileA(filename, GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);</div>
<div><br>
</div>
<div>strcpy(errfile, "e:\\tmp\\stderr.txt");</div>
<div>HANDLE hStdErr = CreateFile(errfile, GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);</div>
<div><br>
</div>
<div>PROCESS_INFORMATION pi;</div>
<div>STARTUPINFOA si;</div>
<div><br>
</div>
<div>ZeroMemory(&pi, sizeof(pi));</div>
<div>ZeroMemory(&si, sizeof(si));</div>
<div>si.cb = sizeof(si);</div>
<div>si.dwFlags |= STARTF_USESTDHANDLES;</div>
<div>si.hStdInput = NULL;</div>
<div>si.hStdOutput = hStdOut;</div>
<div>si.hStdError = hStdErr;</div>
<div><br>
</div>
<div>
<div>strcpy(szCdeLine, "openrtsp ");</div>
<div>strcat(szCdeLine, "-b 400000 ");</div>
strcat(szCdeLine, "-u admin admin1234 ");
<div>strcat(szCdeLine, "-v ");</div>
<div>strcat(szCdeLine, "-d 40 ");</div>
<div>strcat(szCdeLine, "-U 20201015T162020Z ");</div>
<div>strcat(szCdeLine, "\"rtsp://<a href="http://192.168.1.174:554/Streaming/Tracks/101%5C" rel="noopener noreferrer" target="_blank">192.168.1.174:554/Streaming/Tracks/101\</a>" ");</div>
<br>
</div>
<div>dwFlags = CREATE_NO_WINDOW;</div>
<div>CreateProcessA(NULL, szCdeLine, NULL, NULL, TRUE, dwFlags, NULL, NULL, &si, &pi);</div>
<div>WaitForSingleObject(pi.hProcess, INFINITE);</div>
<div>CloseHandle(pi.hProcess);</div>
<div>CloseHandle(pi.hThread);</div>
<div>CloseHandle(hStdOut);</div>
<div>CloseHandle(hStdErr);</div>
<div><br>
</div>
<div><br>
</div>
<div>Once this code has been executed, you get a .tmp file which contains the record of the rtsp stream and a .txt file which contains the result of StdErr.</div>
<div>Thanks to Kyle for getting me on the good way.<br>
</div>
<div><br>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div id="divRpF693193" style="direction: ltr;"><font size="2" face="Tahoma" color="#000000"><b>De :</b> live-devel [live-devel-bounces@us.live555.com] de la part de Nicolas Julien [nicolas.julien@cdvi.com]<br>
<b>Envoyé :</b> lundi 19 octobre 2020 17:14<br>
<b>À :</b> LIVE555 Streaming Media - development & use<br>
<b>Objet :</b> Re: [Live-devel] Run openrtsp from another program<br>
</font><br>
</div>
<div></div>
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">
<div>Hi Kyle,</div>
<div><br>
</div>
<div>Thanks for your answer.</div>
<div>I updated my code, following the example given.<br>
Still nothing on the stdout output.</div>
<div>However, I get the following message on the stderr output:</div>
<div><br>
</div>
<div>Usage: E:\cdvi\dev\rad_atrium_video\Win32\Debug\openRTSP.exe [-p <startPortNum>] [-r|-q|-4|-i] [-a|-v] [-V]
<br>
</div>
<div><br>
</div>
<div>As if the syntax of my command was not good, while this same command launched manually works perfectly.<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr tabindex="-1">
<div id="divRpF707974" style="direction:ltr"><font size="2" face="Tahoma" color="#000000"><b>De :</b> live-devel [live-devel-bounces@us.live555.com] de la part de Kyle Sebion [ksebion@digitalforces.com]<br>
<b>Envoyé :</b> lundi 19 octobre 2020 14:59<br>
<b>À :</b> LIVE555 Streaming Media - development & use<br>
<b>Objet :</b> Re: [Live-devel] Run openrtsp from another program<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr"><a href="https://stackoverflow.com/questions/7018228/how-do-i-redirect-output-to-a-file-with-createprocess" rel="noopener noreferrer" target="_blank">https://stackoverflow.com/questions/7018228/how-do-i-redirect-output-to-a-file-with-createprocess</a>
might be helpful for you. Probably not a problem with openrtsp.</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Oct 19, 2020 at 6:43 AM Nicolas Julien <<a href="mailto:nicolas.julien@cdvi.com" rel="noopener noreferrer" target="_blank">nicolas.julien@cdvi.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:rgb(0,0,0); font-size:10pt">
<div>Hi Ross,</div>
<div><br>
</div>
<div>When I run manually openRTSP from a windows console, all is fine.</div>
<div>Now, I'm trying to launch it from a C++ Windows program, but it does not work.</div>
<div>No error, but video file is not generated.</div>
<div><br>
</div>
<div>The command line is :</div>
<div>openrtsp.exe -b 400000 -u admin admin1234 -v -d 40 -U 20201015T162020Z "rtsp://<a href="http://192.168.1.174:554/Streaming/Tracks/101" rel="noopener noreferrer" target="_blank">192.168.1.174:554/Streaming/Tracks/101</a>" > e:\tmp\video.tmp</div>
<div><br>
</div>
<div>The C code is :</div>
<div><br>
</div>
<div>STARTUPINFOA si;<br>
PROCESS_INFORMATION pi;<br>
ZeroMemory(&si, sizeof(si));<br>
si.cb = sizeof si;<br>
ZeroMemory(&pi, sizeof(pi));<br>
</div>
<div><br>
</div>
<div>GetStartupInfoA(&si);</div>
<div><br>
</div>
<div>strcpy(szCdeLine, "-b 400000 ");</div>
<div>strcat(szCdeLine, "-u admin admin1234 ");</div>
<div>strcat(szCdeLine, "-v ");</div>
<div>strcat(szCdeLine, "-d 40 ");</div>
<div>strcat(szCdeLine, "-U 20201015T162020Z ");</div>
<div>strcat(szCdeLine, "\"rtsp://<a href="http://192.168.1.174:554/Streaming/Tracks/101%5C" rel="noopener noreferrer" target="_blank">192.168.1.174:554/Streaming/Tracks/101\</a>" ");</div>
<div>strcat(szCdeLine, "> e:\\tmp\\video.tmp");</div>
<div><br>
</div>
<div>if (!CreateProcessA("openRTSP.exe", szCdeLine, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi))</div>
<div>{</div>
<div>err = GetLastError();</div>
<div>throw Exception("openrtsp error";</div>
<div>}</div>
<div><br>
</div>
<div>WaitForSingleObject(pi.hProcess, 40000);</div>
<div>CloseHandle(pi.hProcess);</div>
<div>CloseHandle(pi.hThread);</div>
<div><br>
</div>
<div><br>
</div>
<div>The C program and openrtsp.exe are in the same directory.</div>
<div><br>
</div>
<div>Do you have any idea why it does not work ?</div>
<div><br>
</div>
<div>Thanks in advance,</div>
Nicolas</div>
</div>
_______________________________________________<br>
live-devel mailing list<br>
<a href="mailto:live-devel@lists.live555.com" rel="noopener noreferrer" target="_blank">live-devel@lists.live555.com</a><br>
<a href="http://lists.live555.com/mailman/listinfo/live-devel" rel="noreferrer" target="_blank">http://lists.live555.com/mailman/listinfo/live-devel</a><br>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div align="left"><span>
<p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; font-weight:700; vertical-align:baseline; white-space:pre-wrap">If you have any additional
problems or questions, or if this case needs to be handled more urgently, please see below for contact information.</span></p>
<br>
<p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; vertical-align:baseline; white-space:pre-wrap">Thank you.</span></p>
<br>
<p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; vertical-align:baseline; white-space:pre-wrap">Kyle Sebion, Digital Forces Corp.</span></p>
<p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; vertical-align:baseline; white-space:pre-wrap"> </span></p>
<p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; font-weight:700; vertical-align:baseline; white-space:pre-wrap">Urgent</span><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; vertical-align:baseline; white-space:pre-wrap">
support: 630-978-2000 X 1.</span></p>
<p dir="ltr" style="line-height:1.38; margin-top:0pt; margin-bottom:0pt"><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; font-weight:700; vertical-align:baseline; white-space:pre-wrap">Normal</span><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; vertical-align:baseline; white-space:pre-wrap">
support: <a href="mailto:help@digitalforces.com" rel="noopener noreferrer" target="_blank">
help@digitalforces.com</a> (</span><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; font-weight:700; vertical-align:baseline; white-space:pre-wrap">faster and better</span><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; vertical-align:baseline; white-space:pre-wrap">
than my personal email; reaches multiple people)</span></p>
<span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; vertical-align:baseline; white-space:pre-wrap">Voice: 630-299-4971 (same as x804). Text: (</span><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; font-weight:700; vertical-align:baseline; white-space:pre-wrap">avoid</span><span style="font-size:11pt; font-family:Arial; color:rgb(0,0,0); background-color:transparent; vertical-align:baseline; white-space:pre-wrap">)
630-447-0804.</span></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>