[x265] [PATCH] Fix incorrectly calculated bitrate.

den c dncodr at gmail.com
Tue Apr 22 01:14:50 CEST 2014


# HG changeset patch
# User Den Scherbin <dncodr at gmail.com>
# Date 1398122218 -10800
#      Tue Apr 22 02:16:58 2014 +0300
# Node ID 3acc990983392b2df145629573aea28fa370ad22
# Parent  8c1e721209f4e28ecc3ef2642e59fb7cfc320cbc
cli: fix bitrate output when encoding

diff -r 8c1e721209f4 -r 3acc99098339 source/x265.cpp
--- a/source/x265.cpp	Mon Apr 21 15:18:16 2014 -0500
+++ b/source/x265.cpp	Tue Apr 22 02:16:58 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);


On 4/22/14, Steve Borho <steve at borho.org> wrote:
> On Mon, Apr 21, 2014 at 4:19 PM, den c <dncodr at gmail.com> wrote:
>> x265: fixes bitrate output when encoding
>
> Can you commit this and email it as a proper patch so it has your full
> name associated with it?
>
> If you don't want to bother configuring Mercurial at all, you can do
> this in two command lines:
>
> hg commit -u "your name <dncodr at gmail.com>" -m "cli: fix bitrate
> output when encoding"
> hg export tip > bitrate-fix.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bitrate-fix.patch
Type: application/octet-stream
Size: 1380 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20140422/128267e1/attachment.obj>


More information about the x265-devel mailing list