Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 03-01-2007, 09:46 AM   #1
Registered: Jun 2004
Posts: 233

Rep: Reputation: 33
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???
Old 12-06-2008, 02:49 AM   #2
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 2,186
Blog Entries: 1

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
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

Old 12-06-2008, 03:37 AM   #3
Senior Member
Registered: Feb 2003
Distribution: debian
Posts: 2,186
Blog Entries: 1

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
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.


ffmpeg, v4l, v4l2

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to V4L2, Video Outputt Device Sourabh Linux - Newbie 0 02-15-2007 07:20 AM v4l2,bttv driver--Help bmaamba Slackware 2 02-02-2007 07:49 AM
help me install v4l2 (bttv, xawtv, drivers please. carboncopy Linux - Hardware 5 07-15-2004 02:19 AM
BTTV and V4L2, what's different ? jhome4u Linux - Software 0 12-12-2003 09:56 AM
bttv 0.7.90 v4l2 The Yeti Lives Linux - Newbie 0 06-11-2003 08:09 PM

All times are GMT -5. The time now is 04:06 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration