[Theora] v4l audio

Simon Blandford sblandford at gmail.com
Sat Dec 31 23:52:09 PST 2005


Tell me about it!

I just spent most of Xmas week trying to hack ffmpeg2theora.c to take
live sound input. I managed to sort-of work out how to do it from
looking at ffmpeg.c (which can take sound and video). I managed to
open the two streams together but they seemed to not work in parallel.
The minute and seconds counter runned really slow and the resulting
OGG file had speeded up picture and skipping audio. I think I'm a
little out of my depth with this and I was unable to find
documentation for the ffmpeg API and there are only examples of
video-only capture I can find on the web.

If anyone might find the hacked version ffmpeg2theora.c file useful I
can send if it would make a good starting point.

To solve your immediate problem, try one the following methods.
1) As Ralph suggested, you can use a program to pipe an intermediate
format that ffmpeg2theora can handle...

ffmpeg -target pal-vcd - | \
ffmpeg2theora -a 0 -v 0 -x 320 -y 240 -o output.ogg -

The above example is low quality and reduced picture size as it was
intended for webcasting.


2) Use gstreamer pipes. The example below is for webcasting but can
easily be adapted for saving to a file (watch out for
line-wrapping!)...

gst-launch  v4l2src device=/dev/video0 \!
video/x-raw-yuv,framerate=25.0,width=320,height=240 \! \
        videorate \! video/x-raw-yuv,framerate=5.0 \! \
        ffcolorspace \! \
        videobalance brightness=0.1 contrast=1.2 \! \
        timeoverlay \! \
        textoverlay text="TestTX" x0=10 y0=210 font-desc="MS Gothic 18" \! \
        theoraenc bitrate=10 \! oggmux name=mux \! \
        shout2send ip=my.icecast.server port=8000 password=xxxxx \
        streamname=live.ogg description="Test live transmission"
mount=/live.ogg \
        { osssrc device=/dev/dsp \! audioconvert \! \
                rawvorbisenc bitrate=32000 \! queue \! mux. }

Hope that helps,
Regards,
SimonB


On 31/12/05, Ralph Giles <giles at xiph.org> wrote:
> On Sat, Dec 31, 2005 at 12:55:23PM -0600, James Clark wrote:
>
> > I've a pchdtv-3000 card I am trying to record from.  I can successfully
> > record audio/video using streamer or watch television with audio using
> > tvtime, so I know the audio is there.
>
> Most capture cards, for reasons that have never been clear to me, don't
> contain an audio digitizer. So they decode the audio signal, and then
> send it out through an external cable to your sound card, which does
> the actual digitization (causing all sorts of sync issues). It looks
> like the PCHTDV-3000 works this way?
>
> > ffmpeg2theora --v4l /dev/video0 -o test.ogg
> >
> > This records video but no audio.
>
> Yes. Likewise, the v4l kernel interface only provides video, not audio.
>
> > Should I be able to do this? Do I need to stream the audio separately?
>
> It would be nice if ffmpeg2theora could also read from the sound card
> for the audio track, but I don't believe it currently does. I think
> you can use something like mencoder (which can) to stream some
> multiplexed, not-very-compressed A/V format to ffmpeg2theora, but
> obviously that's wasteful.
>
> You can also encode theora video as above, and use sox | oggenc to
> encode vorbis audio from the soundcard and use oggzmerge after the fact
> to combine the two files, but see above about sync problems.
>
> Probably the best option (if you don't want to write something) is the
> flumotion(.net) media server. It can record from both v4l and the sound
> card and encode to Ogg Theora+Vorbis.
>
> HTH,
>  -r
> _______________________________________________
> Theora mailing list
> Theora at xiph.org
> http://lists.xiph.org/mailman/listinfo/theora
>


More information about the Theora mailing list