[x265] [PATCH] Fix incorrectly calculated bitrate.

den c dncodr at gmail.com
Mon Apr 21 23:19:33 CEST 2014


x265: fixes bitrate output when encoding

diff -r 78c1f43f12f5 source/x265.cpp
--- a/source/x265.cpp	Thu Apr 17 16:32:16 2014 -0500
+++ b/source/x265.cpp	Mon Apr 21 23:59:24 2014 +0300
@@ -251,9 +251,9 @@
         return;
     int64_t elapsed = time - startTime;
     double fps = elapsed > 0 ? frameNum * 1000000. / elapsed : 0;
+    float bitrate = 0.008f * totalbytes * (param->fpsNum /
param->fpsDenom) / ( (float) frameNum);
     if (framesToBeEncoded)
     {
-        float bitrate = 0.008f * totalbytes / ((float)frameNum /
((float)param->fpsNum / param->fpsDenom));
         int eta = (int)(elapsed * (framesToBeEncoded - frameNum) /
((int64_t)frameNum * 1000000));
         sprintf(buf, "x265 [%.1f%%] %d/%d frames, %.2f fps, %.2f
kb/s, eta %d:%02d:%02d",
                 100. * frameNum / framesToBeEncoded, frameNum,
framesToBeEncoded, fps, bitrate,
@@ -261,7 +261,6 @@
     }
     else
     {
-        float bitrate = (float)totalbytes * 8 / ((float)1000 *
param->fpsNum / param->fpsDenom);
         sprintf(buf, "x265 %d frames: %.2f fps, %.2f kb/s", frameNum,
fps, bitrate);
     }
     fprintf(stderr, "%s  \r", buf + 5);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bitrate.patch
Type: application/octet-stream
Size: 1097 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140422/51e1a6bd/attachment.obj>


More information about the x265-devel mailing list