I have almost finished integration of Theora into our videoconferencing program. Since a videoconferencing program is realtime, it is UDP-based and wraps the Theora stream in RTP (More on that later). The problem here is that most examples I could find, wraps the theora stream in ogg, and used over tcp or files. I send over UDP and clients need to be able to start in the middle of the stream. I do resend packets periodically, so the clients need to wait for a header resend before they can start. Even after that, I have a problem that I only see the difference from a white background the first few seconds, and ghost images after that. One of the problems is probably that I send wrong parameters to theora for encoding. I had some problem understanding what the intention of these parameters are. I will therefore ask some questions about some of the parameters in the th_info structure: th_info info; info.fps_numerator = 10; info.fps_denominator = 1; My understanding is that this is the framerate, and that the parameters above means 10 frames per second, Is that right? info.aspect_denominator = 0; info.aspect_numerator = 0; Here I use the default, and hope that is OK. info.keyframe_granule_shift = 10; I'm uncertain on what the intention of the parameter is. It seems like it is the frequency keyframes are sent in, so the parameter above would mean that every 10th frame is a keyframe, but I'm not sure that is right, and would like this parameter to be explained, as it was not obvious for me by reading the documentation. Hope somebody would help me with this. -Gisle
ogg.k.ogg.k at googlemail.com
2010-Mar-25 10:27 UTC
[theora] Questions about encoder parameters.
> info.fps_numerator = 10; > info.fps_denominator = 1; > > My understanding is that this is the framerate, and that the parameters > above means 10 frames per second, Is that right?Yes.> info.aspect_denominator = 0; > info.aspect_numerator = 0; > > Here I use the default, and hope that is OK.This setup means it is unspecified.> info.keyframe_granule_shift = 10; > > I'm uncertain on what the intention of the parameter is. It seems like > it is the frequency keyframes are sent in, so the parameter above would > mean that every 10th frame is a keyframe, but I'm not sure that is > right, and would like this parameter to be explained, as it was not > obvious for me by reading the documentation.This particular setting means that there will ve a keyframe at most every 1024 frames (2^10, as there are 10 bits to encode the number of frames since last keyframe). Keyframes may well (and probably will) happen more often, though. http://wiki.xiph.org/GranulePosAndSeeking should be of interest to understand how the granule position system works, and how the granule shift determines that maximum keyframe spacing.
ogg.k.ogg.k at googlemail.com wrote:> >> info.keyframe_granule_shift = 10; >> > This particular setting means that there will ve a keyframe at most every 1024 > frames (2^10, as there are 10 bits to encode the number of frames > since last keyframe). Keyframes may well (and probably will) happen > more often, though. > http://wiki.xiph.org/GranulePosAndSeeking should be of interest to understand > how the granule position system works, and how the granule shift determines > that maximum keyframe spacing. >Ahh, this probably explain my problem. Since I need to be able to start in the middle of a stream, this setting is probably the reason that it can take minutes before a new participant can see the others. This parameter is not very well explained in the documentation, and I had overlooked the wiki. That was really usefull. Thank you very much. -Gisle