[x264-devel] Question about x264 real time encoding

Bo SONG benben841212 at gmail.com
Wed Apr 7 02:56:30 CEST 2010


On Wed, 07 Apr 2010 00:32:56 +0800, Jason Garrett-Glaser
<darkshikari at gmail.com> wrote:

> On Tue, Apr 6, 2010 at 7:27 AM, Bo SONG <benben841212 at gmail.com>
wrote:
>> 1. Commandline:
>> --bframes 0 --force-cfr --rc-lookahead 0
>> --sync-lookahead 0 -B 2500
>> Result:
>> X264Enc: 15.16 ms/frame, throughtput 30.0481 frames/sec, latency
>> 367.031 ms/frame
>> 2. Commandline:
>> --tune zerolatency -B 2500
>> Result:
>> X264Enc: 59.99 ms/frame, throughtput 16.2417 frames/sec, latency 0
>> ms/frame
>>
>> So it seems that high throughput leads to long latency, while low  
>> latency
>> cannot get such throughput. It is really frustrating. Anyone has some  
>> clue
>> to fix this?

> Sliced-threads is a bit slower than regular threads (not that much
> slower though).
> Have you tried using faster encoding settings?  720p at default
> settings in realtime requires a very fast CPU.  Using, say, veryfast,
> should easily get you up to 100fps or more.
> Dark Shikari

Thanks. Actually when encoding 720P video file using zerolatency +
veryfast I can get 43fps, while removing sliced-threads I get 81fps.  
Besides,
I used the version 1510 from x264.nl and the result is 45fps and 82fps. So
it seems my compiled version is functioning right. My cpu is a E5345 which
has 2 physical cpu and each have 4 cores. 2.33MHz

I think the throughput difference comes from cpu usage: using
frame-based threads I can get 66% in the previous experiment, while
using sliced-based I can get 40%. But I don't know how to improve cpu
usage and thus further reduce encoding time of one frame in
sliced-mode. This is critical in real time encoding because if x264 cannot
encode a frame within 30ms, then there have to be a frame drop.

Another question I thought a lot is how did x264 manage frame based
threading? If the sequence is IPPPPPPP..., does that mean x264 encode I
frame first, then use seperate thread to encode the following P s? Then
how does it handle P referencing P? Or they just all referencing I frame?

Thanks!

-- 
Bo SONG


More information about the x264-devel mailing list