The above-mentioned bitrate values were measured using Theora 1.0 at VGA (640x480) resolution.<br><br>Concerning
the implementation of the Theora encoder into Ekiga, it is accessed via
the underlying Opal library. This library is the basis of any call
management in Ekiga and supports different encoders via plugin
integration. Below, you will find the major steps involved in adjusting
the encoder options in the Theora plugin. The whole Opal package can is
downloadable from <a href="https://sourceforge.net/projects/opalvoip/files/" target="_blank">https://sourceforge.net/projects/opalvoip/files/</a>.<br>
<br>1) The initialisation of the parameters:<br><br>theoraEncoderContext::<div id=":zc" class="ii gt">theoraEncoderContext()<br>{<br> ogg_packet headerPacket, tablePacket;<br> _frameCounter=0;<br> <br> _txTheoraFrame = new theoraFrame();<br>
_txTheoraFrame->SetMaxPayloadSize(THEORA_PAYLOAD_SIZE);<br>
<br> theora_info_init( &_theoraInfo );<br> _theoraInfo.frame_width = 352; // Must be multiple of 16<br> _theoraInfo.frame_height = 288; // Must be multiple of 16<br> _theoraInfo.width = _theoraInfo.frame_width;<br>
_theoraInfo.height = _theoraInfo.frame_height;<br> _theoraInfo.offset_x = 0;<br> _theoraInfo.offset_y = 0;<br> _theoraInfo.fps_numerator = THEORA_FRAME_RATE;<br> _theoraInfo.fps_denominator = 1;<br>
_theoraInfo.aspect_numerator = _theoraInfo.width; // Aspect = width/height<br> _theoraInfo.aspect_denominator = _theoraInfo.height; //<br> _theoraInfo.colorspace = OC_CS_UNSPECIFIED;<br> _theoraInfo.target_bitrate = THEORA_BITRATE * 2 / 3; // Anywhere between 45kbps and 2000kbps<br>
_theoraInfo.quality = 16; <br> _theoraInfo.dropframes_p = 0;<br> _theoraInfo.quick_p = 1;<br> _theoraInfo.keyframe_auto_p = 1;<br> _theoraInfo.keyframe_frequency = THEORA_KEY_FRAME_INTERVAL;<br>
_theoraInfo.keyframe_frequency_force = _theoraInfo.keyframe_frequency;<br> _theoraInfo.keyframe_data_target_bitrate = THEORA_BITRATE;<br> _theoraInfo.keyframe_auto_threshold = 80;<br> _theoraInfo.keyframe_mindistance = 8;<br>
_theoraInfo.noise_sensitivity = 1;<br><br> theora_encode_init( &_theoraState, &_theoraInfo );<br><br> theora_encode_header( &_theoraState, &headerPacket );<br> _txTheoraFrame->SetFromHeaderConfig(&headerPacket);<br>
<br> theora_encode_tables( &_theoraState, &tablePacket );<br> _txTheoraFrame->SetFromTableConfig(&tablePacket);<br>}<br><br>2)
The only theoraInfo parameters that are updated "on-the-fly" during a
RTP video session are the "target_bitrate" and
"keyframe_data_target_bitrate" parameters:<br>
<br>void theoraEncoderContext::SetTargetBitrate(unsigned rate)<br>{<br> _theoraInfo.target_bitrate = rate * 2 / 3; // Anywhere between 45kbps and 2000kbps}<br> _theoraInfo.keyframe_data_target_bitrate = rate;<br>
}<br><br>3) The changes are then applied by calling:<br><br>void theoraEncoderContext::ApplyOptions()<br>{<br> ogg_packet headerPacket, tablePacket;<br><br> theora_clear( &_theoraState );<br> theora_encode_init( &_theoraState, &_theoraInfo );<br>
<br> theora_encode_header( &_theoraState, &headerPacket );<br> _txTheoraFrame->SetFromHeaderConfig(&headerPacket);<br><br> theora_encode_tables( &_theoraState, &tablePacket );<br> _txTheoraFrame->SetFromTableConfig(&tablePacket);<br>
}<br><br>4) The major function calls for encoding the frames are then:<br><br>theora_encode_YUVin( &_theoraState, &yuv );<br>followed by<br>theora_encode_packetout( &_theoraState, 0 /* not last Packet */, &framePacket );<br>
<br>I hope this could help to find possible problems,<br><font color="#888888">Thomas</font></div>