[Theora] encoder settings

Thomas Vander Stichele thomas at apestaart.org
Thu Sep 8 03:11:47 PDT 2005


> 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
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,

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/

More information about the Theora mailing list