<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">We’re trying to send an x264 encoded RTP stream to an iOS device.<div class="">While it works in general, we aren’t sure if we have the best settings to achieve our goal.</div><div class="">We read on a blog from an x264 developer that it should be possible to achieve a latency of x264 encoded RTP streams of around 10 ms from end to end.</div><div class=""><br class=""></div><div class="">We are nowhere near that in our setup. </div><div class="">The lowest we can get is > 1 sec.</div><div class=""><br class=""></div><div class="">Here are the settings we are using (c is the AVCodecContext pointer):</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">c-></span>bit_rate_tolerance<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">;</span></div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">rc_max_rate</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">rc_buffer_size</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">gop_size</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">max_b_frames</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="color: rgb(112, 61, 170);" class="">b_frame_strategy</span> = <span style="color: rgb(39, 42, 216);" class="">1</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="color: rgb(112, 61, 170);" class="">coder_type</span> = <span style="color: rgb(39, 42, 216);" class="">1</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="color: rgb(112, 61, 170);" class="">me_cmp</span> = <span style="color: rgb(39, 42, 216);" class="">1</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">me_range</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">16</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="color: rgb(112, 61, 170);" class="">qmin</span> = <span style="color: rgb(39, 42, 216);" class="">10</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="color: rgb(112, 61, 170);" class="">qmax</span> = <span style="color: rgb(39, 42, 216);" class="">51</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">scenechange_threshold</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">40</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">flags</span> |= <span style="font-variant-ligatures: no-common-ligatures; color: #78492a" class="">CODEC_FLAG_LOOP_FILTER</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">me_method</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">ME_HEX</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">me_subpel_quality</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">i_quant_factor</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0.71</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">qcompress</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0.6</span>;</div><div style="margin: 0px; font-family: Menlo;" class="">c-><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">max_qdiff</span> = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">4</span>;</div></div><div style="margin: 0px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px;" class="">Additionally, we tried to set some libx264 private settings like so:</div><div style="margin: 0px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px;" class=""><div style="font-family: Menlo; margin: 0px; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #3d1d81" class="">av_opt_set</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">_pVideoCodecCtx</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">-></span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">priv_data</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">, </span>"preset"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">, </span>"ultrafast"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">);</span></div><div style="font-family: Menlo; margin: 0px; color: rgb(209, 47, 27);" class=""><span style="color: rgb(61, 29, 129);" class="">av_opt_set</span><span style="color: rgb(0, 0, 0);" class="">(</span><span style="color: rgb(79, 129, 135);" class="">_pVideoCodecCtx</span><span style="color: rgb(0, 0, 0);" class="">-></span><span style="color: rgb(112, 61, 170);" class="">priv_data</span><span style="color: rgb(0, 0, 0);" class="">, </span>"tune"<span style="color: rgb(0, 0, 0);" class="">, </span>"zerolatency"<span style="color: rgb(0, 0, 0);" class="">, </span><span style="color: rgb(39, 42, 216);" class="">0</span><span style="color: rgb(0, 0, 0);" class="">);</span></div><div style="margin: 0px;" class=""><span style="color: rgb(61, 29, 129); font-family: Menlo;" class="">av_opt_set</span><span style="color: rgb(0, 0, 0); font-family: Menlo;" class="">(</span><span style="color: rgb(79, 129, 135); font-family: Menlo;" class="">_pVideoCodecCtx</span><span style="color: rgb(0, 0, 0); font-family: Menlo;" class="">-></span><span style="color: rgb(112, 61, 170); font-family: Menlo;" class="">priv_data</span><span style="color: rgb(0, 0, 0); font-family: Menlo;" class="">, </span><span style="color: rgb(209, 47, 27); font-family: Menlo;" class="">"g"</span><span style="color: rgb(0, 0, 0); font-family: Menlo;" class="">, </span><font color="#d12f1b" face="Menlo" class="">“30"</font><span style="color: rgb(0, 0, 0); font-family: Menlo;" class="">, </span><span style="color: rgb(39, 42, 216); font-family: Menlo;" class="">0</span><span style="color: rgb(0, 0, 0); font-family: Menlo;" class="">);</span></div><div style="margin: 0px;" class=""><span style="color: rgb(0, 0, 0); font-family: Menlo;" class=""><br class=""></span></div><div style="margin: 0px;" class="">Does anyone have a hint what we could do to get more speed?</div><div style="margin: 0px;" class="">Also, is there anything we can set on the decoder side to decrease the delay?</div><div style="margin: 0px;" class="">We are on the defaults there.</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Thanks!</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Best regards,</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Flo</div></div></body></html>