Page 1 of 1

Sound device still blocked after killing vlc process

Posted: 03 Feb 2010 02:34
by ralf.butler
Hi All,

I repeatedly (endless loop) capture 6hrs of video and audio input with vlc:

Code: Select all

while [ 0 -eq 0 ]; do cvlc --run-time=21600 v4l2:///dev/video0 input-slave=alsa://hw:0,0 :v4l2-standard=0 :sout='#transcode{vcodec=mp4v,vb=800,scale=1,acodec=mpga,ab=128,sfilter=marq}:std{access=file,mux=mp4,dst=/tmp/out.mp4}' --sub-filter marq --marq-marquee "%D %H:%M:%S" --marq-position 6 & sleep 21605 # wait 5 sec in addition pid=$(ps ax | grep vlc | awk '{ print $1 }') kill $pid wait $pid done
These commands are part of a bash script 'record.sh' which is called once by fcron after the computer starts. fcrontab -l:

Code: Select all

SHELL=/bin/bash @volatile,first(1) 300m ~/record.sh > /dev/null 2>&1
Once started, everything works fine. Video and audio signals are encoded and recorded. When the first 6hrs passes by the vlc process is killed and the next vlc recording process is stared.

But here is the problem. The second and all following vlc recordings triggered by endless loop do not contain audio.
I have the impression that the sound device is still occupied. Probably I do not properly kill the recording process and I guess that invoking the script 'record.sh' via fcrontab contributes to the problem as well.

Is there someone who has an idea if the problem has something to do with vlc'?

Thank you,
Ralf

Re: Sound device still blocked after killing vlc process

Posted: 05 Feb 2010 02:17
by ralf.butler
Can anyone help me out with that. So far I found no solution.

Thanks,
Ralf

Re: Sound device still blocked after killing vlc process

Posted: 06 Feb 2010 11:38
by RĂ©mi Denis-Courmont
Check that VLC is indeed completely killed with `ps faux`.

Re: Sound device still blocked after killing vlc process

Posted: 11 Feb 2010 11:05
by mrtipale
vlc do not release device & file quickly. I had similar prob on windows/linuxmachine. file access in win is diff from lin. still i recoommened to put some delay after u did

sleep1
#kill vlc_pid
sleep 2
skill vlc
kill -9 vlc_pid

This should solve ur problem. Trick worked for me on CentOS 5 & Win Xp pro.

Re: Sound device still blocked after killing vlc process

Posted: 11 Feb 2010 12:39
by mrtipale
But if I use ur command in below manner, its not recording audio :

cvlc v4l2:///dev/video0 input-slave=alsa://hw:0,0 --sout='#transcode{vcodec=mp4v,vb=800,scale=1,acodec=mpga,ab=128}:duplicate{dst=std{access=file,mux=mp4,dst=/tmp/123.mp4}}'

it records only video, any suggestion?
mahendra@mahendra tmp]$ mp4info 123.mp4
mp4info version 1.5.0.1
tv.mp4:
Track Type Info
1 video MPEG-4 Simple @ L1, 9.132 secs, 1025 kbps, 640x480 @ 27.814279 fps

my audio recorder is fine. as
arecord -t wav -q -d 10 test.wav
records sounds very well.
I 've some china made webcam on OS FC11.
i was even thinking of running both video & audio recorders in sync & mixing tracks with other tool ..

want to explore vlc more.