Write two webcam video with avconv

2019-04-14 20:27发布

问题:

Have problem capture video with avconv

I using this commands video0 in shell 0 and video1 in shell 1

avconv -f video4linux2 -i /dev/video0 video0.avi
avconv -f video4linux2 -i /dev/video1 video1.avi

But with start second video recorder message

/dev/video1: No space left on device

Question there is the possibility of recording two videos simultaneously?

Other

First capture of video0.avi is work perfectly, but if I interrupt with Ctrl+C and try execute same command the video is not captured.

This message displayed in shell

uvcvideo: Failed to resubmit video URB (-27)

The process still running?

Removing webcam and reconnect work fine in first time.

回答1:

I ran into the same issue - in my case I resolved it by connecting the webcams to separate USB2 buses. I still cannot make 2 USB webcams work simultaneously on the same bus. I have also found that I must run ffmpeg (now avconv) as root in order to capture and encode both sound and video from both cams simultaneously.

Also, I run this from a bash script, and found I must background one avconv command to run both simultaneously. The script looks like this:


nohup avconv -f video4linux2 -s 640x360 -r 30 /dev/video0 -f alsa -ac 2 -i hw:1,0 -acodec libmp3lame -ab 96k -async1 stream1.mp4

P1=$!

avconv -f video4linux2 -s 640x360 -r 30 /dev/video1 -f alsa -ac 2 -i hw:2,0 -acodec libmp3lame -ab 96k -async1 stream2.mp4

kill $P1

I hope this is helpful to you.



回答2:

I think you have to kill process id from first capture.



标签: ffmpeg