[Theora] OGG theora with mono output

Carsten Haese carsten at xiph.org
Fri Jan 21 13:38:28 PST 2005


On Fri, 2005-01-21 at 16:06, zikzak at tele2.fr wrote:
> On Fri, 21 Jan 2005 13:03:20 -0800
> Ralph Giles <giles at xiph.org> wrote:
> 
> >On Fri, Jan 21, 2005 at 08:51:50PM +0100, zikzak at tele2.fr wrote:
> >
> >> I would like to create an output file with mono audio.
> >> How to do it ?
> >> If use a video with mono as input, the result will be a video with stereo.
> >> Is there a way to use the --downmix from oggenc ?
> >
> >What too are you using that's mixing up? the encoder_example that ships 
> >with libtheora should, for example, encode the input wave at the input 
> >number of channels and sample rate.
> >
> >If you want to use --downmix you can use oggenc to compress the 
> >soundtrack separately and then use oggzmerge to multiplex it with
> >the video. I assume there's a gstreamer commandline that can downmix
> >the audio as part of encoding too.
> >
> >HTH,
> > -r
> 
> Sorry, i'm not clear.
> I use encoder_example but I would like to have a video with mono output for the audio, encoder_example seems to only produce stereo files.
> Is there a somewhere in the code a value to change to obtain mono sound only ?
> My purpose is to reduce the size of the audio and keep a nice quality for the video, because I try to stream the file with a bitrate of 128kbps (audio and video).
> Currently, audio is around 30kbps.

As Ralph said, encoder_example preserves the number of channels. If you
feed it stereo, you get stereo; if you feed it mono, you get mono. I'm
guessing you want to feed it stereo and downmix to mono on the fly.

This can be achieved with a relatively simple change to the
uninterleaving code (which happens around line 347 in the example from
current SVN). Instead of uninterleaving the samples into /audio_ch/
separate analysis buffers, just average them into one buffer. Of course
you'll also have to tell the encoder in vorbis_encode_init_vbr that
you're only doing one channel.

Hope this helps,

Carsten.




More information about the Theora mailing list