9

my ~/.bashrc contains the following function

webcamrecord () {
vlc v4l2:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" :v4l-norm=3 :v4l-frequency=-1 :v4l-caching=300 :v4l-chroma="" :v4l-fps=-1.000000 :v4l-samplerate=44100 :v4l-channel=0 :v4l-tuner=-1 :v4l-audio=-1 :v4l-stereo :v4l-width=640 :v4l-height=480 :v4l-brightness=-1 :v4l-colour=-1 :v4l-hue=-1 :v4l-contrast=-1 :no-v4l-mjpeg :v4l-decimation=1 :v4l-quality=100 --sout="#transcode{vfilter=adjust{gamma=1.5},vcodec=theo,vb=2000,scale=0.67,acodec=vorb,ab=128,channels=2}:standard{access=file,mux=ogg,dst="output_file.ogg"}" 
}

The command works beautifully to record directly from my webcam, with one or two flaws. First, the video produced moves too quickly, between twice and three times the normal rate.

Also, there is no audio. This is less of an issue, but I would still like to fix this.

Can someone help me debug this command, so as to fix these issues?

4
+50

This one-liner worked for me, with audio and video:

vlc v4l2:// :input-slave=alsa:// :v4l-vdev="/dev/video0" :v4l-norm=3 :v4l-frequency=-1 :v4l-caching=300 :v4l-chroma="" :v4l-fps=-1.000000 :v4l-samplerate=44100 :v4l-channel=0 :v4l-tuner=-1 :v4l-audio=-1 :v4l-stereo :v4l-width=480 :v4l-height=360 :v4l-brightness=-1 :v4l-colour=-1 :v4l-hue=-1 :v4l-contrast=-1 :no-v4l-mjpeg :v4l-decimation=1 :v4l-quality=100 --sout="#transcode{vcodec=theo,vb=2000,fps=12,scale=0.67,acodec=vorb,ab=90,channels=1,samplerate=44100}:standard{access=file,mux=ogg,dst=output.ogg}"

You could also try this one:

vlc v4l2:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/pcm" :v4l-norm=3 :v4l-frequency=-1 :v4l-caching=300 :v4l-chroma="" :v4l-fps=-1.000000 :v4l-samplerate=44100 :v4l-channel=0 :v4l-tuner=-1 :v4l-audio=-1 :v4l-stereo :v4l-width=480 :v4l-height=360 :v4l-brightness=-1 :v4l-colour=-1 :v4l-hue=-1 :v4l-contrast=-1 :no-v4l-mjpeg :v4l-decimation=1 :v4l-quality=100 --sout="#transcode{vcodec=theo,vb=2000,fps=12,scale=0.67,acodec=vorb,ab=90,channels=1,samplerate=44100}:standard{access=file,mux=ogg,dst=output.ogg}"

Your experience may vary, depending on your hardware. Good luck!

1

Out of curiosity, are you sure that the audio source is the proper source?

Secondly (again, just a question) why aren't you using ffmpeg to stream the video instead?
Something like but not quite:

ffmpeg -b 100K -an -f video4linux2 -s 320x240 -r 10 -i /dev/audio2 -i /dev/video0 -b 100K -f ogg - | mplayer - -idle -demuxer ogg

Swap the audio input and video input to your liking and then mess around with the actual file conversion, i'm a bit rusty on ffmpeg and mplayer but it's doable. + a friend did it with raspberry pi with ~20fps @1080p so you should be fine with standard equipment via this method :)

1

Get an overview of all devices (in this example: /dev/video0):

v4l2-ctl --list-devices

Check the availible formats:

v4l2-ctl --list-formats-ext -d /dev/video0

Determ sound source (card: 0 ..., device: 1... is equal to hw:0,1. In this example hw:0,0):

arecord -l

Record video + audio, directly to file:

cvlc v4l2:///dev/video0:width=640:height=480 :input-slave=alsa://hw:0,0 --sout="#transcode{vcodec=theo,vb=2000,fps=20,scale=1.0,acodec=vorb,ab=90,channels=1,samplerate=44100}:standard{access=file,mux=ogg,dst=output.ogg}"

Same but with live video:

cvlc v4l2:///dev/video0:width=640:height=480 :input-slave=alsa://hw:0,0 --sout="#transcode{vcodec=theo,vb=2000,fps=20,scale=1.0,acodec=vorb,ab=90,channels=1,samplerate=44100}:duplicate{dst=display,dst=standard{access=file,mux=ogg,dst=output.ogg}}"  

You could change cvlc back to vlc if you want to have controls + menu.

More options with the v4l2 module in VLC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.