LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Record RTSP audio stream

Solved!
Go to solution

Zou,

 

Well in that case I could run a command line VLC and then end it after 10 seconds. Seems like the easiest way right now. I think user32.dll in windows will let you kill tasks. i know there is an easy way in .net to start an app and keep the process id so you can kill it later. I used that once to spawn off a bunch of ghostsrvr apps for imaging multiple pc's 🙂

 

Anyways, thanks. I think this is my major blocking point for a fully automated video encoder test application.

- A minute saved is a Minute earned!
0 Kudos
Message 11 of 19
(3,336 Views)
This VI works similar to the System Exec VI but also returns the PID of the process so you can later kill it.
Message Edited by rolfk on 03-13-2010 08:04 AM
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 12 of 19
(3,326 Views)

Corey,

 

.net way is the best to terminate a process.  But don't "kill" the process, you can use the id to get the main window handle.  Close the main window to terminate the process gracefully.  No worry about memory leak, and re-start the application again without trouble.

 

This method is just a wrap around the C/WinAPI method (Rolf used in his VIs) I think.  I used C/WinAPI method five years ago to torture to test Intel chips: start/stop an application repeatedly, and in multiple instance.

 

I moved on to VLM now.  It can handle multiple instance of VLC, and for multiple source.

George Zou
0 Kudos
Message 13 of 19
(3,309 Views)

Thanks for the LvUtils.zip file. I'm am getting back to this and thought, maybe i should just get a working run and kill process working. Then i noticed you posted this file 🙂

 

I've setup a simple vi, using your files, with:

 

"c:\program files\VideoLan\vlc\vlc.exe" rtsp://192.168.1.28/stream1 --sout=#transcode{vcodec=h264,vb=800,scale=1,acodec=mp3,ab=128,channels=1,samplerate=44100}:std{access=file,mux=mp4,dst=c:\test.mpg}

 

And that starts the vlc no problem. But if i use the kill process then it does not close the file or something and i dont get video from test.mpg? If i run from command line and click on the X or stop or file/close then the file saves correctly. There has to be a way to maybe use "findwindow" and "sendmessage" to tell VLC to close? I think i have those already put together for labview somewhere 🙂

 

-Corey

- A minute saved is a Minute earned!
0 Kudos
Message 14 of 19
(3,265 Views)
Solution
Accepted by topic author pRoFiT

Okay user32.dll findwindow and sendmessage seem to work. Here is a snippet. also used your create function. I was hoping the PID and the hwnd would be the same and then i wouldn't need findwindow...but they are different. I may need the PID to verify the process closed...Not sure yet.

 

 

save_stream_test.png

 

p.s. ignore the &H112 that was hex command for the sendmessage to close window. shown above as 112

 

-Corey

- A minute saved is a Minute earned!
0 Kudos
Message 15 of 19
(3,262 Views)

No the PID is the process ID. It is a unique Windows kernel ID for a process. But a process can have MANY windows, so there is no way they could be the same. Also processes are very low level kernel objects, almost at the basic of the Windows kernel together with events, semaphores, threads and memory. Windows are GDI (Graphics Device Interface) objects, at least 2 layers higher, that make use of many kernel services too but also of other subssytems, one of them being the graphics output system, and handling the basic user input such as mouse, keyboard and such too.

 

There are functions to enumerate the windows of a given process but they use callback functions and are therefore not feasable to use directly in LabVIEW without some small C wrapper.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 16 of 19
(3,253 Views)

Thanks for posting the solution.

 

I'm having problem with user32.dll: labview crashes the moment I run my vi that uses that dll. (WIN7 normal user account)

 

Could you tell what setting do you use for the call library function? Mine are attached to this post.

0 Kudos
Message 17 of 19
(2,677 Views)

Could you post the code for the solution please??

0 Kudos
Message 18 of 19
(2,673 Views)

Kind of late 🙂 like 5 years late. but hey, maybe this will help someone.

0 Kudos
Message 19 of 19
(2,055 Views)