[x264-devel] How to display encoding time for every frame?

Xue Victor xyy1122 at gmail.com
Thu Dec 10 19:36:12 CET 2009


Seems a rather silly question, hacked a few lines and seems to be worked.
Put a quick note on this, I am not sure whether it is correct but it at
least works..

steps:
include time.h file in x264.c,
down scrolling till Encode function, declear a struct timeval as start_t and
end_t(struct timeval start_t, end_t;),
also initial three variables to record the time(long seconds, useconds,
fr_time;).
down scrolling till see the loop with a comment saying /*Encode Frames*/,
look into the loop and find i_frame_size = Encode_frame( h, opt->hout,
&pic);
add two lines, one in front of them, the other right after this line, like
the following:
gettimeofday(&start_t, NULL);
i_frame_size = Encode_frame( h, opt->hout, &pic );
gettimeofday(&end_t, NULL);

time are calculated as follows:
seconds = end_t.tv_sec - start_t.tv_sec;
useconds = end_t.tv_usec - start_t.tv_usec;
fr_time = ((seconds)*1000 + useconds/1000.0) + 0.5;

use the same lines in the /* Flush delayed frames */ while loop.

Best,
Yuanyi


On Thu, Dec 10, 2009 at 10:22 AM, Xue Victor <xyy1122 at gmail.com> wrote:

> Hi, all.
>
> I want to see the time consuming for every frame when using x264 to encode.
> I tried --verbose option but it doesn't show the encoding time in my
> computer(r1295+ubuntu 9.04). Does any one have the shortcut to do it or
> guide me what portion of the code that would implement that? Thank you.
>
> Best,
> Yuanyi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20091210/1c6f5cc4/attachment.htm>


More information about the x264-devel mailing list