[gst-devel] v4l2src

David Liontooth liontooth at cogweb.net
Fri Sep 29 19:25:07 CEST 2006


Zaheer Merali wrote:
> On 9/29/06, David Liontooth <liontooth at cogweb.net> wrote:
>> I just discovered the v4l2src plugin (it recently made it into Debian),
>> and tested it against some saa713x tv cards:
>>
>> gst-launch-0.10 oggmux name=mux ! filesink location=/tv7/test0.ogg
>> v4l2src device=/dev/video2 !
>> video/x-raw-yuv,width=640,height=480,framerate=\(fraction\)30000/1001 !
>> ffmpegcolorspace ! theoraenc ! queue ! mux. alsasrc
>> device=hw:2,0 ! audio/x-raw-int,channels=2,rate=32000,depth=16 !
>> audioconvert ! vorbisenc ! mux.
>>
>> These cards have 32000Hz audio output, and gstreamer didn't appear to
>> detect this, so I had to add it manually. The picture is good, and the
>> file claims to have sound:
>>
>> Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
>> AUDIO: 32000 Hz, 2 ch, s16le, 112.0 kbit/10.94% (ratio: 14000->128000)
>> Selected audio codec: [ffvorbis] afm: ffmpeg (FFmpeg Vorbis decoder)
>> ==========================================================================
>>
>> alsa-init: using device default
>> alsa: 32000 Hz/2 channels/4 bpf/65536 bytes buffer/Signed 16 bit Little
>> Endian
>> AO: [alsa] 32000Hz 2ch s16le (2 bytes per sample)
>> Starting playback...
>> A:  27.2 V:  27.3 A-V: -0.140 ct: -0.019 818/818 29%  1%  0.7% 0 0
>>
>> ... but in fact I cannot hear anything. Suggestions welcome.
>>
>
> I had the same issue with a v4l2 card here which uses the saa7134
> chipset.  It seems the alsa device just gives silence and requires a
> manual caps filter of 32000 Hz.  Have you managed to record the audio
> from it with any other program?
Yes, several -- for instance, this works:

mencoder -tv
driver=v4l2:device=/dev/video$DEV:fps=30000/1001:chanlist=us-cable:\
audiorate=32000:adevice=hw.$DEV:alsa:input=0:amode=1:normid=4 -ffourcc
DIVX -ovc \
lavc -lavcopts threads=2 -oac mp3lame -lameopts cbr:br=128 -endpos $TIM \
-o $DIR/$FIL.avi tv:// > /dev/null

A lot of work has been done on getting audio directly from saa713x. In
recent kernels you need saa7134-alsa or saa7134-oss modules.
Several programs still have weak alsa support, so you may have to get
oss emulation one way or the other, but this also works.

The cleanest is of course alsa -- set the cards to record on channel 1
and max volume, using for instance

    alsamixergui -c 1

For details, see http://linuxtv.org/v4lwiki/index.php/Saa7134-alsa
>> How can I tell gstreamer to stop capturing after n minutes?
> gst-launch-0.10 is just a test application, GStreamer is a library.
> To do what you said in a simple application is trivial.
Too bad I don't know how to do something that's so trivial! :-)
My 'programming' is restricted to bash scripting. Suggestions or examples?

Cheers,
David










More information about the gstreamer-devel mailing list