[Theora] encoder settings

Wim Taymans wim at fluendo.com
Thu Sep 8 17:11:03 PDT 2005


On Thu, 2005-09-08 at 12:11 +0200, Thomas Vander Stichele wrote:
> Hi,
> 
> 
> > When I grab  video frames from the camera and encode them they
> > form 4KB  OGG pages, then I send them over TCP/IP to the client
> > application.  Since I want to achieve as small latency as possible I don't
> > want to buffer the stream and here is the problem...
> 
> So what you probably want to reduce here is the delay introduced by ogg
> paging.  Ogg collects multiple video frames' worth of data into an Ogg
> page, typically flushing out when the page becomes 4KB.
> 
> > I'm not sure why but this makes the playback not very smooth.
> 
> The reason is, because as you can see from the timing, long blocks of
> data for multiple video frames are collected together. 
> 
> > 0.0 sec. read 1448 bytes
> > 0.022 sec. read 1448 bytes
> > 0.07 sec. read 1448 bytes
> > 0.183 sec. read 1448 bytes
> > 0.206 sec. read 1448 bytes
> > 0.209 sec. read 1448 bytes
> > 0.222 sec. read 1448 bytes
> > 0.239 sec. read 1448 bytes
> > 0.249 sec. read 1448 bytes
> > 0.328 sec. read 1448 bytes
> > 0.341 sec. read 1448 bytes
> > 
> > The difference is obvious, but how they (Fluendo) did this?
> 
> I'd have to look again at what we did (it wasn't necessarily all a
> conscious decision, I sure didn't look at the resulting stream the way
> you did, thanks for that info), but IIRC we added a property to our ogg
> muxer that allows it to flush out a page more frequently.  You should be
> able to do the same thing by flushing using ogg_page_flush IIRC.  In

The ogg muxer forces a page_flush after a configurable amount of time,
making sure no page contains more than N ms of data, practically this
results in audio and video data being interleaved at at most N ms,
introducting a latency of a little more than N ms. An algorithm similar
to this might give less bandwidth overhead than flushing a page after
every packet.

Wim

> your case (if you really want the frame to be sent out as quickly as
> possible) you could even ogg_page_flush after every video frame you
> submit to the theora encoder.  Take into account that you are adding
> extra overhead to the stream in that case, but it seems warranted from
> what little I'm guessing about your application.
> 
> Hope that helps,
> Thomas
> 
> 
> Dave/Dina : future TV today ! - http://www.davedina.org/
> <-*- thomas (dot) apestaart (dot) org -*->
> When somebody knows you well
> well there's no comfort like that
> And when somebody loves you well
> well there's no drug like that
> <-*- thomas (at) apestaart (dot) org -*->
> URGent, best radio on the net - 24/7 ! - http://urgent.fm/
> 
> 
> 
> _______________________________________________
> Theora mailing list
> Theora at xiph.org
> http://lists.xiph.org/mailman/listinfo/theora
-- 
Wim Taymans <wim at fluendo.com>



More information about the Theora mailing list