ffmpeg vs uvideo

2010-10-16 Thread Jan Stary
(I have changed the subject,
because the subject has changed.)

On Oct 14 01:59:39, Jacob Meuser wrote:
 On Thu, Oct 14, 2010 at 12:05:09AM +, Jacob Meuser wrote:
  On Thu, Oct 14, 2010 at 12:59:37AM +0200, Jan Stary wrote:
   On Oct 13 22:07:27, Jacob Meuser wrote:
On Wed, Oct 13, 2010 at 11:51:47PM +0200, Jan Stary wrote:
 This is a fresh upgrade of current/amd64 on a Macbook3,1.
 Basically, everything works except the wifi and uvideo.

 I installed the uvideo firmware as documented in uvideo(4).
 I can capture an image with 'fswebcam image.jpg';
 I have problems capturing a video stream with
 ffmpeg -y -f video4linux2 -s vga -r 25 -i /dev/video0 /tmp/out.mpg
 (the fps eventually drops to 0 and results in a tiny file
 containing just a few frames) but I haven't really tried
 tweaking the format options.

ffmpeg doesn't work with video(4).  frankly, I don't understand why
video(4) support is enabled in ffmpeg, giving the the impression it's
supposed to work, when it clearly doesn't.
   
   On another machine (HP EliteBook 8530w running a recent -current)
   I can capture video(4) just fine - using certain resolutions and frame
   rates, that is.
  
  with ffmpeg?  can you share your command, I've never gotten it to work.

This _sometimes_ works:
ffmpeg -y -f video4linux2 -r 25 -s vga -i /dev/video out.mpg
Other times, the fps gradually drops to zero.

With the current ffmpeg (just built form svn),
it consistently results in

ffmpeg -y -f video4linux2 -r 25 -s vga -i /dev/video0 /tmp/out.m
FFmpeg version SVN-r25502, Copyright (c) 2000-2010 the FFmpeg developers
built on Oct 16 2010 14:05:50 with gcc 4.2.1 20070719 
configuration: 
libavutil 50.32. 3 / 50.32. 3
libavcore  0. 9. 1 /  0. 9. 1
libavcodec52.92. 0 / 52.92. 0
libavformat   52.83. 0 / 52.83. 0
libavdevice   52. 2. 2 / 52. 2. 2
libavfilter1.52. 0 /  1.52. 0
libswscale 0.12. 0 /  0.12. 0
[video4linux2 @ 0x83f3d080] ioctl set time per frame(1/25) failed
/dev/video0: Input/output error

It fails this way with any other framerate, too.
So you are right: it doesn't work.

 fwiw, this is what I use, because using ffmpeg to capture directly from
 video(4) has never worked for me:
 
 $ video -f /dev/video1 -e yuy2 -s 640x480 -r 20 -o - | ffmpeg -y \
 -f rawvideo -pix_fmt yuyv422 -s 640x480 -r 20 -i - \
 -itsoffset 0.5 -f sndio -ar 16000 -ac 1 -i sun:1 out.avi

This is much more reliable;
without audio, I can capture just fine with

$ video -f /dev/video -e yuy2 -s 640x480 -r 20 -o - \
| ffmpeg -y -f rawvideo -pix_fmt yuyv422 -s 640x480 -r 20 -i - out.avi

However, the audio part does not work for me.
The ffmpeg-20100512p4 package says

$ video -f /dev/video -e yuy2 -s 640x480 -r 20 -o - \
| ffmpeg -y -f rawvideo -pix_fmt yuyv422 -s 640x480 -r 20 -i - \
-f sndio -ar 16000 -ac 1 -i sun:1 out.avi
FFmpeg version SVN-r23102, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct 11 2010 18:27:01 with gcc 4.2.1 20070719 
  configuration: --enable-shared --cc=cc --disable-altivec --disable-armv5te 
--disable-armv6 --disable-armv6t2 --disable-armvfp --disable-debug 
--disable-indev=jack --disable-indev=oss --disable-iwmmxt --disable-neon 
--disable-optimizations --disable-outdev=oss --enable-gpl --enable-libfaac 
--enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libschroedinger 
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 
--enable-nonfree --enable-postproc --enable-pthreads --enable-runtime-cpudetect 
--enable-x11grab --extra-cflags=-I/usr/local/include -I/usr/X11R6/include 
--extra-libs=-L/usr/local/lib -L/usr/X11R6/lib --mandir=/usr/local/man
  libavutil 50.15. 2 / 50.15. 2
  libavcodec52.67. 0 / 52.67. 0
  libavformat   52.62. 0 / 52.62. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter1.20. 0 /  1.20. 0
  libswscale 0.10. 0 /  0.10. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[rawvideo @ 0x80239080]Estimating duration from bitrate, this may be inaccurate
Input #0, rawvideo, from 'pipe:':
  Duration: N/A, start: 0.00, bitrate: N/A
Stream #0.0: Video: rawvideo, yuyv422, 640x480, 20 tbr, 20 tbn, 20 tbc
[sndio @ 0x83bc9080]Could not open sndio device
sun:1: Input/output error

I get the same result with -f sndio -i /dev/audio.
I get the same result with or without aucat running.

The svn install of ffmpeg doesn't even recognize sndio as a format
(Unknown input format: 'sndio'). It does recognize -f oss,
and I can capture both video and audio with

$ video -f /dev/video -e yuy2 -s 640x480 -r 20 -o - \
| ffmpeg -y -f rawvideo -pix_fmt yuyv422 -s 640x480 -r 20 -i - \
-f sndio -ar 48000 -ac 2 -i /dev/audio out.avi

 the audio is just slightly ahead (out of sync) without the -itsoffset.
 the sndio backend in ffmpeg has fairly accurate timestamping; the
 stamps should represent when the sound actually happened.  video(1) otoh
 is just outputting a stream of raw frames, so ffmpeg assumes the
 frames' timestamp is when 

Re: ffmpeg vs uvideo

2010-10-16 Thread Jacob Meuser
On Sat, Oct 16, 2010 at 05:46:24PM +0200, Jan Stary wrote:
 (I have changed the subject,
 because the subject has changed.)
 
 On Oct 14 01:59:39, Jacob Meuser wrote:
  On Thu, Oct 14, 2010 at 12:05:09AM +, Jacob Meuser wrote:
   On Thu, Oct 14, 2010 at 12:59:37AM +0200, Jan Stary wrote:
On Oct 13 22:07:27, Jacob Meuser wrote:
 On Wed, Oct 13, 2010 at 11:51:47PM +0200, Jan Stary wrote:
  This is a fresh upgrade of current/amd64 on a Macbook3,1.
  Basically, everything works except the wifi and uvideo.
 
  I installed the uvideo firmware as documented in uvideo(4).
  I can capture an image with 'fswebcam image.jpg';
  I have problems capturing a video stream with
  ffmpeg -y -f video4linux2 -s vga -r 25 -i /dev/video0 /tmp/out.mpg
  (the fps eventually drops to 0 and results in a tiny file
  containing just a few frames) but I haven't really tried
  tweaking the format options.
 
 ffmpeg doesn't work with video(4).  frankly, I don't understand why
 video(4) support is enabled in ffmpeg, giving the the impression it's
 supposed to work, when it clearly doesn't.

On another machine (HP EliteBook 8530w running a recent -current)
I can capture video(4) just fine - using certain resolutions and frame
rates, that is.
   
   with ffmpeg?  can you share your command, I've never gotten it to work.
 
 This _sometimes_ works:
 ffmpeg -y -f video4linux2 -r 25 -s vga -i /dev/video out.mpg
 Other times, the fps gradually drops to zero.
 
 With the current ffmpeg (just built form svn),
 it consistently results in
 
 ffmpeg -y -f video4linux2 -r 25 -s vga -i /dev/video0 /tmp/out.m
 FFmpeg version SVN-r25502, Copyright (c) 2000-2010 the FFmpeg developers
 built on Oct 16 2010 14:05:50 with gcc 4.2.1 20070719 
 configuration: 
 libavutil 50.32. 3 / 50.32. 3
 libavcore  0. 9. 1 /  0. 9. 1
 libavcodec52.92. 0 / 52.92. 0
 libavformat   52.83. 0 / 52.83. 0
 libavdevice   52. 2. 2 / 52. 2. 2
 libavfilter1.52. 0 /  1.52. 0
 libswscale 0.12. 0 /  0.12. 0
 [video4linux2 @ 0x83f3d080] ioctl set time per frame(1/25) failed
 /dev/video0: Input/output error
 
 It fails this way with any other framerate, too.
 So you are right: it doesn't work.

I'm pretty sure this is because video/uvideo doesn't allow setting the
frame rate.  also, many webcams don't deliver a consistent frame rate;
some of them will deliver a higher frame rate if they receive more light.

  fwiw, this is what I use, because using ffmpeg to capture directly from
  video(4) has never worked for me:
  
  $ video -f /dev/video1 -e yuy2 -s 640x480 -r 20 -o - | ffmpeg -y \
  -f rawvideo -pix_fmt yuyv422 -s 640x480 -r 20 -i - \
  -itsoffset 0.5 -f sndio -ar 16000 -ac 1 -i sun:1 out.avi
 
 This is much more reliable;
 without audio, I can capture just fine with
 
 $ video -f /dev/video -e yuy2 -s 640x480 -r 20 -o - \
 | ffmpeg -y -f rawvideo -pix_fmt yuyv422 -s 640x480 -r 20 -i - out.avi
 
 However, the audio part does not work for me.
 The ffmpeg-20100512p4 package says
 
 $ video -f /dev/video -e yuy2 -s 640x480 -r 20 -o - \
 | ffmpeg -y -f rawvideo -pix_fmt yuyv422 -s 640x480 -r 20 -i - \
 -f sndio -ar 16000 -ac 1 -i sun:1 out.avi
 FFmpeg version SVN-r23102, Copyright (c) 2000-2010 the FFmpeg developers
   built on Oct 11 2010 18:27:01 with gcc 4.2.1 20070719 
   configuration: --enable-shared --cc=cc --disable-altivec --disable-armv5te 
 --disable-armv6 --disable-armv6t2 --disable-armvfp --disable-debug 
 --disable-indev=jack --disable-indev=oss --disable-iwmmxt --disable-neon 
 --disable-optimizations --disable-outdev=oss --enable-gpl --enable-libfaac 
 --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libschroedinger 
 --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 
 --enable-nonfree --enable-postproc --enable-pthreads 
 --enable-runtime-cpudetect --enable-x11grab 
 --extra-cflags=-I/usr/local/include -I/usr/X11R6/include 
 --extra-libs=-L/usr/local/lib -L/usr/X11R6/lib --mandir=/usr/local/man
   libavutil 50.15. 2 / 50.15. 2
   libavcodec52.67. 0 / 52.67. 0
   libavformat   52.62. 0 / 52.62. 0
   libavdevice   52. 2. 0 / 52. 2. 0
   libavfilter1.20. 0 /  1.20. 0
   libswscale 0.10. 0 /  0.10. 0
   libpostproc   51. 2. 0 / 51. 2. 0
 [rawvideo @ 0x80239080]Estimating duration from bitrate, this may be 
 inaccurate
 Input #0, rawvideo, from 'pipe:':
   Duration: N/A, start: 0.00, bitrate: N/A
 Stream #0.0: Video: rawvideo, yuyv422, 640x480, 20 tbr, 20 tbn, 20 tbc
 [sndio @ 0x83bc9080]Could not open sndio device
 sun:1: Input/output error

-f sndio -ar 16000 -ac 1 -i sun:1 out.avi

that means to record 16kHz mono from /dev/audio1.  maybe that just isn't
supported on your hardware?

 I get the same result with -f sndio -i /dev/audio.

does simply 'ffmpeg -f sndio -i /dev/audio out.wav' work?

 I get the same result with or without aucat running.

yeah, ffmpeg requires to specify the input file, even if the 

Re: ffmpeg vs uvideo

2010-10-16 Thread Kevin Chadwick
On Sat, 16 Oct 2010 21:53:24 +0200
Jan Stary h...@stare.cz wrote:

 On Oct 16 19:20:32, Jacob Meuser wrote:
  On Sat, Oct 16, 2010 at 05:46:24PM +0200, Jan Stary wrote:
   (I have changed the subject,
   because the subject has changed.)
   
   On Oct 14 01:59:39, Jacob Meuser wrote:
On Thu, Oct 14, 2010 at 12:05:09AM +, Jacob Meuser wrote:
 On Thu, Oct 14, 2010 at 12:59:37AM +0200, Jan Stary wrote:
  On Oct 13 22:07:27, Jacob Meuser wrote:
   On Wed, Oct 13, 2010 at 11:51:47PM +0200, Jan Stary wrote:
This is a fresh upgrade of current/amd64 on a Macbook3,1.
Basically, everything works except the wifi and uvideo.
   
I installed the uvideo firmware as documented in uvideo(4).
I can capture an image with 'fswebcam image.jpg';
I have problems capturing a video stream with
ffmpeg -y -f video4linux2 -s vga -r 25 -i /dev/video0 
/tmp/out.mpg
(the fps eventually drops to 0 and results in a tiny file
containing just a few frames) but I haven't really tried
tweaking the format options.
   
   ffmpeg doesn't work with video(4).  frankly, I don't understand 
   why
   video(4) support is enabled in ffmpeg, giving the the impression 
   it's
   supposed to work, when it clearly doesn't.
  
  On another machine (HP EliteBook 8530w running a recent -current)
  I can capture video(4) just fine - using certain resolutions and 
  frame
  rates, that is.
 
 with ffmpeg?  can you share your command, I've never gotten it to 
 work.
   
   This _sometimes_ works:
   ffmpeg -y -f video4linux2 -r 25 -s vga -i /dev/video out.mpg
   Other times, the fps gradually drops to zero.
   
   With the current ffmpeg (just built form svn),
   it consistently results in
   
   ffmpeg -y -f video4linux2 -r 25 -s vga -i /dev/video0 /tmp/out.m
   FFmpeg version SVN-r25502, Copyright (c) 2000-2010 the FFmpeg developers
   built on Oct 16 2010 14:05:50 with gcc 4.2.1 20070719 
   configuration: 
   libavutil 50.32. 3 / 50.32. 3
   libavcore  0. 9. 1 /  0. 9. 1
   libavcodec52.92. 0 / 52.92. 0
   libavformat   52.83. 0 / 52.83. 0
   libavdevice   52. 2. 2 / 52. 2. 2
   libavfilter1.52. 0 /  1.52. 0
   libswscale 0.12. 0 /  0.12. 0
   [video4linux2 @ 0x83f3d080] ioctl set time per frame(1/25) failed
   /dev/video0: Input/output error
   
   It fails this way with any other framerate, too.
   So you are right: it doesn't work.
  
  I'm pretty sure this is because video/uvideo doesn't allow setting the
  frame rate.  also, many webcams don't deliver a consistent frame rate;
  some of them will deliver a higher frame rate if they receive more light.
  
fwiw, this is what I use, because using ffmpeg to capture directly from
video(4) has never worked for me:

$ video -f /dev/video1 -e yuy2 -s 640x480 -r 20 -o - | ffmpeg -y \
-f rawvideo -pix_fmt yuyv422 -s 640x480 -r 20 -i - \
-itsoffset 0.5 -f sndio -ar 16000 -ac 1 -i sun:1 out.avi
   
   This is much more reliable;
   without audio, I can capture just fine with
   
   $ video -f /dev/video -e yuy2 -s 640x480 -r 20 -o - \
   | ffmpeg -y -f rawvideo -pix_fmt yuyv422 -s 640x480 -r 20 -i - out.avi
   
   However, the audio part does not work for me.
   The ffmpeg-20100512p4 package says
   
   $ video -f /dev/video -e yuy2 -s 640x480 -r 20 -o - \
   | ffmpeg -y -f rawvideo -pix_fmt yuyv422 -s 640x480 -r 20 -i - \
   -f sndio -ar 16000 -ac 1 -i sun:1 out.avi
   FFmpeg version SVN-r23102, Copyright (c) 2000-2010 the FFmpeg developers
 built on Oct 11 2010 18:27:01 with gcc 4.2.1 20070719 
 configuration: --enable-shared --cc=cc --disable-altivec 
   --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-armvfp 
   --disable-debug --disable-indev=jack --disable-indev=oss --disable-iwmmxt 
   --disable-neon --disable-optimizations --disable-outdev=oss --enable-gpl 
   --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame 
   --enable-libschroedinger --enable-libspeex --enable-libtheora 
   --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc 
   --enable-pthreads --enable-runtime-cpudetect --enable-x11grab 
   --extra-cflags=-I/usr/local/include -I/usr/X11R6/include 
   --extra-libs=-L/usr/local/lib -L/usr/X11R6/lib --mandir=/usr/local/man
 libavutil 50.15. 2 / 50.15. 2
 libavcodec52.67. 0 / 52.67. 0
 libavformat   52.62. 0 / 52.62. 0
 libavdevice   52. 2. 0 / 52. 2. 0
 libavfilter1.20. 0 /  1.20. 0
 libswscale 0.10. 0 /  0.10. 0
 libpostproc   51. 2. 0 / 51. 2. 0
   [rawvideo @ 0x80239080]Estimating duration from bitrate, this may be 
   inaccurate
   Input #0, rawvideo, from 'pipe:':
 Duration: N/A, start: 0.00, bitrate: N/A
   Stream #0.0: Video: rawvideo, yuyv422, 640x480, 20 tbr, 20 tbn, 20 tbc
   [sndio @ 0x83bc9080]Could not open sndio device
   sun:1: Input/output error
  
  -f sndio -ar 16000