<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top"><br>multiply, not divide of course<br><p><a href="https://overview.mail.yahoo.com/mobile/?.src=Android">Sent from Yahoo Mail on Android</a></p> <hr><table cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td valign="top"> <div style="font-family:Roboto, sans-serif;color:#7e7d80;"><b>From</b>:"Mister K-bar" <misterkbar@yahoo.com><br><b>Date</b>:Fri, Aug 28, 2015 at 11:53 AM<br><b>Subject</b>:Initial high bitrate bug(?) in single-pass x264<br><br></div> <div style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px;"><div id="yiv0911240708"><div id="yui_3_16_0_1_1440787641960_3227"><div style="background-color:rgb(255, 255, 255);" id="yui_3_16_0_1_1440787641960_3226"><div id="yiv0911240708yui_3_16_0_1_1440785890129_4269" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue',
Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;">I am seeing a problem in the single-pass version of the x264 encoder where there appears to be a huge bitrate at the beginning, resulting in unacceptable amounts of compression to maintain the bitrate in the video that follows the initial high bitrate.</div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4268" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;">From what I can tell, the issue appears to be a bug, and SEEMS to be related to some kind of 1/2 second wallclock timer within the encoder: any encoding performed in that wallclock time has an ridiculously high bitrate. And once that time period has passed,
massive compression follows. It can take several seconds for the resultant artifacts to clear up.</div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;">If you slow down the encoding process (such as reducing the number of threads severely, or using a slower machine), the amount of playtime high bitrate goes down, with the simple formula:</div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" dir="ltr" style="color:rgb(0,
0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;">NumberOfHighRateFrames = ~0.5 seconds / NumberFramesProcessedPerSecond</div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;">Running a 2-pass encoding of course fixes this, but such a solution clearly won't scale: it increases the wallclock time of the encoding process severely about 40% on an unloaded machine, and cannot be used with any sort of live stream (easily).</div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue',
Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" dir="ltr" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;">For complete information on this topic, complete with a timeline of research into this issue (it was originally posted as "Linux quality worse than Mac"), graphs supporting the current theory, and links to MP4 files to reproduce the issue, please see this FFMPEG thread:</div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" dir="ltr" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" dir="ltr"><a rel="nofollow" target="_blank" href="http://ffmpeg.gusari.org/viewtopic.php?f=11&t=2296&p=6651#p6651"
id="yui_3_16_0_1_1440787641960_3264">Buggy, unacceptably high initial bitrate with libx264 codec • FFmpeg Support Forum</a><br></div><div style="width:450px;font-family:'Georgia', 'Times', 'Times New Roman', 'serif';margin-top:5px;margin-bottom:5px;background-color:#ffffff;" id="enhancrCard_0" class="link-enhancr-attachment link-enhancr-element richcompose-card"><table class="link-enhancr-element" cellspacing="0" cellpadding="0" border="0" style="width:450px;height:170px;display:block;" id="yui_3_16_0_1_1440787641960_3288"><tbody id="yui_3_16_0_1_1440787641960_3287"><tr class="link-enhancr-element"><td class="link-enhancr-element" colspan="8" style="height:1px;background-color:#e5e5e5;font-size:1px;border-collapse:collapse;"><div class="link-enhancr-element" style="height:1px;background-color:#e5e5e5;font-size:1px;line-height:0px;"> </div></td></tr><tr class="link-enhancr-element" id="yui_3_16_0_1_1440787641960_3374"><td rowspan="5"
class="link-enhancr-element" style="width:1px;background-color:#e5e5e5;font-size:1pt;border-collapse:collapse;"><div class="link-enhancr-element" style="width:1px;background-color:#e5e5e5;font-size:1pt;"> </div></td><td class="link-enhancr-element link-enhancr-image-wrap" rowspan="5" style="vertical-align:middle;width:168px;height:168px;background-color:#000000;border-collapse:collapse;" id="yui_3_16_0_1_1440787641960_3375"><div class="link-enhancr-element" style="width:168px;" align="center"><a rel="nofollow" target="_blank" href="http://ffmpeg.gusari.org/viewtopic.php?f=11&t=2296&p=6651#p6651" class="link-enhancr-card-urlWrapper link-enhancr-element" style="text-decoration:none;text-decoration:none;color:#000000;"><img alt="image" src="http://ffmpeg.gusari.org/styles/prosilver/imageset/ffmpeg-logo2.png" class="link-enhancr-thumbnail-image link-enhancr-element yahoo-ignore-inline-image" width="168" height="42"
style="display:block;margin:auto;"></a></div></td><td rowspan="5" class="link-enhancr-element" style="width:1px;background-color:#e5e5e5;font-size:0pt;border-collapse:collapse;"><div class="link-enhancr-element" style="width:1px;background-color:#e5e5e5;font-size:1pt;"> </div></td><td rowspan="5" class="link-enhancr-element" style="width:14px;background-color:#ffffff;font-size:0pt;border-collapse:collapse;" id="yui_3_16_0_1_1440787641960_3373"><div class="link-enhancr-element" style="width:14px;background-color:#ffffff;font-size:14pt;"> </div></td><td colspan="2" class="link-enhancr-element" style="height:6px;background-color:#ffffff;font-size:0pt;border-collapse:collapse;" id="yui_3_16_0_1_1440787641960_3467"><div class="link-enhancr-element" style="height:6px;background-color:#ffffff;font-size:6pt;" id="yui_3_16_0_1_1440787641960_3466"> </div></td><td rowspan="5" class="link-enhancr-element"
style="width:20px;background-color:#ffffff;font-size:0pt;border-collapse:collapse;" id="yui_3_16_0_1_1440787641960_3418"><div class="link-enhancr-element" style="width:20px;background-color:#ffffff;font-size:20pt;"> </div></td><td class="link-enhancr-element" rowspan="5" width="1" style="width:1px;background-color:#e5e5e5;font-size:1pt;border-collapse:collapse;"><div class="link-enhancr-element" style="width:1px;background-color:#e5e5e5;font-size:1pt;"> </div></td></tr><tr id="yui_3_16_0_1_1440787641960_3286"><td class="link-enhancr-element" colspan="2" style="width:100%;vertical-align:middle;font-family:'Georgia', 'Times', 'Times New Roman', 'serif';" id="yui_3_16_0_1_1440787641960_3285"><div class="link-enhancr-text-part link-enhancr-element" style="line-height:16.5px;background-color:#ffffff;height:135px;width:245px;" id="yui_3_16_0_1_1440787641960_3284"><div class="link-enhancr-element" style="word-wrap:break-word;"
id="yui_3_16_0_1_1440787641960_3420"><span class="link-enhancr-element icon icon-shrink link-enhancr-toggle"></span><span class="link-enhancr-element icon icon-close link-enhancr-delete" id="yui_3_16_0_1_1440787641960_3419"></span><a rel="nofollow" target="_blank" href="http://ffmpeg.gusari.org/viewtopic.php?f=11&t=2296&p=6651#p6651" class="link-enhancr-card-urlWrapper link-enhancr-element" style="text-decoration:none;text-decoration:none;color:#000000;line-height:100%;font-size:18px;display:block;" id="yui_3_16_0_1_1440787641960_3465"><span class="link-enhancr-element link-enhancr-card-title" style="margin:0;font-weight:normal;margin-bottom:3px;font-size:18px;line-height:21px;max-height:43px;color:#000000;overflow:hidden;display:inline-block;" id="yui_3_16_0_1_1440787641960_3464">Buggy, unacceptably high initial bitrate with libx264 co...</span></a><div style="font-size:13px;line-height:20px;color:#999999;max-height:81px;font-family:'Georgia',
'Times', 'Times New Roman', 'serif';overflow:hidden;" class="link-enhancr-card-description link-enhancr-element">Buggy, unacceptably high initial bitrate with libx264 codec - FFmpeg support forum</div></div></div></td></tr><tr><td colspan="2" class="link-enhancr-element" style="height:4px;background-color:#ffffff;font-size:0pt;border-collapse:collapse;"><div class="link-enhancr-element" style="height:4px;background-color:#ffffff;font-size:4pt;"></div></td></tr><tr id="yui_3_16_0_1_1440787641960_3599"><td class="link-enhancr-element" style="vertical-align:middle;font-family:'Arial', 'Helvetica Neue', 'Helvetica', 'sans-serif';"><div class="link-enhancr-element" style="font-size:0pt;"><a rel="nofollow" target="_blank" href="http://ffmpeg.gusari.org/viewtopic.php?f=11&t=2296&p=6651#p6651" class="link-enhancr-card-url link-enhancr-element" style="color:black;text-decoration:none;text-decoration:none;cursor:pointer;"><span class="link-enhancr-element
link-enhancr-view-on" style="display:inline-block;line-height:11px;max-width:145px;min-width:85px;overflow:hidden;max-height:13px;" id="yui_3_16_0_1_1440787641960_3281"><span class="link-enhancr-element link-enhancr-mobile-no-resize" style="vertical-align:middle;font-size:9px;line-height:11px;color:#999999;">View on <span style="font-weight:bold;" class="link-enhancr-view-on-domain">ffmpeg.gusari.org</span></span></span></a></div></td><td class="link-enhancr-element" style="vertical-align:middle;width:100px;font-family:'Arial', 'Helvetica Neue', 'Helvetica', 'sans-serif';" id="yui_3_16_0_1_1440787641960_3598"><div class="link-enhancr-element link-enhancr-preview-wrapper" style="max-width:100px;min-width:80px;overflow:hidden;text-align:right;line-height:11px;max-height:13px;font-size:0pt;" id="yui_3_16_0_1_1440787641960_3597"><span class="link-enhancr-element link-enhancr-preview-by link-enhancr-mobile-no-resize"
style="vertical-align:middle;font-size:9px;line-height:11px;color:#999999;">Preview by Yahoo</span></div></td></tr><tr><td colspan="2" class="link-enhancr-element" style="height:9px;background-color:#ffffff;font-size:0pt;border-collapse:collapse;"><div class="link-enhancr-element" style="height:9px;background-color:#ffffff;font-size:9pt;"></div></td></tr><tr class="link-enhancr-element"><td class="link-enhancr-element" colspan="8" style="height:1px;background-color:#e5e5e5;font-size:1px;border-collapse:collapse;"><div class="link-enhancr-element" style="height:1px;background-color:#e5e5e5;font-size:1px;line-height:0px;"> </div></td></tr></tbody></table></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" dir="ltr"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" dir="ltr">As an aside, it was mentioned that a large number of threads is a BAD thing in the x264
codec. Can someone please explain why this is? Without knowing implementation details, this seems highly counter-intuitive.</div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" dir="ltr"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" dir="ltr">Thanks!</div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" dir="ltr">-Mark</div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;"><br></div><div id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;"><br></div><div
id="yiv0911240708yui_3_16_0_1_1440785890129_4254" style="color:rgb(0, 0, 0);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:16px;"><br></div></div></div></div></div></td> </tr> </tbody> </table></td></tr></table>