-   Linux - Hardware (
-   -   v4l / v4l2 setup for ffmpeg (

rubadub 03-01-2007 09:46 AM

v4l / v4l2 setup for ffmpeg
I've been playing with webcams using mencoder for a while, but now I need (2 cams at once) to try ffmpeg.

I've downloaded the SVN and built it with the following flags:

$ ./configure --extra-ldflags=-L/usr/X11R6/lib --enable-x11grab --enable-gpl
I believe it works because I can do the following ok:

$ ffmpeg  -t 10 -s 1024x768 -f x11grab -i :0.0 out.mpgout.mpg
Next (or first) I try:

ffmpeg -t 5 -i /dev/dsp -f video4linux -i /dev/video0 -s 352x288 out2.mpg
It tries to start but just does nothing (but ctrl-c exits cleanly), here's the session:

$ ffmpeg -t 5 -i /dev/dsp -f video4linux -i /dev/video0 -s 352x288 out2.mpg
FFmpeg version SVN-r8169, Copyright (c) 2000-2007 Fabrice Bellard, et al.
  configuration: --extra-ldflags=-L/usr/X11R6/lib --enable-x11grab --enable-gpl
  libavutil version: 49.3.0
  libavcodec version: 51.35.0
  libavformat version: 51.10.0
  built on Mar  1 2007 14:59:56, gcc: 4.0.2 20051125 (Red Hat 4.0.2-8)

No matter how long I wait, nowt happens!

I believe v4l is set up alright because I can do:

mencoder -tv driver=v4l:width=352:height=288:device=/dev/video0 -ovc lavc -lavcopts vcodec=mpeg4 -endpos 5 -o vid0.avi tv://
- At some point I uncommented my devices in 'v4l.conf', which is what made it work with mencoder / mplayer and SCANIMAGE.

- Also this is the output from dmesg (after running ffmpeg):

/x/x/x/gspcav1-20060925/gspca_core.c: [spca5xx_set_light_freq:1851] Sensor currently not support light frequency banding filters.
Anybody got any ideas please???

Shadow_7 12-06-2008 02:49 AM

Try -f oss before -i /dev/dsp

It no longer hangs for me, BUT....

[video4linux @ 0x623fd0]Wrong size (0x0)
/dev/video0: Error while opening file

added -s 320x240 between -f video4linux and -i /dev/video0, and get this one:

[video4linux @ 0x623fd0]Wrong time base (0)
/dev/video0: Error while opening file

added -r 60000/1001 between -f video4linux and -i /dev/video0, and it records.

although I can't seem to get it to do modes other than 320x240 with ffmpeg. So this one works so far.

ffmpeg -f oss -i /dev/dsp -f video4linux -r 60000/1001 -s 320x240 -i /dev/video0 -sameq -aspect 4:3 -y tvffmpeg.mpg


Shadow_7 12-06-2008 03:37 AM

changed -f video4linux to -f video4linux2 and -s 720x480 works with -aspect 4:3

ffmpeg -f oss -ac 2 -ar 48000 -i /dev/dsp -acodec pcm_s16le -f video4linux2 -s 720x480 -r 30000/1001 -i /dev/video0 -sameq -aspect 4:3 -f avi -vcodec mjpeg -r 30000/1001 -y tvffmpeg.avi

although still long term A/V sync issues.

All times are GMT -5. The time now is 08:19 PM.