multithreading not very effective?

Discuss about generic usage of MediaCoder.

Moderator: HuggiL

Post Reply
grunnsat
Amateur
Amateur
Posts: 17
Joined: Thu Feb 14, 2008 9:29 am

multithreading not very effective?

Post by grunnsat » Sat May 22, 2010 11:18 pm

Until now I used MediaCoder on my laptop. It has a dual core T9300 cpu, so it is quite fast for a laptop. I always saw almost 100% cpu use whith MediaCoder, so I decided to build a very fast new server with as many cores as possible. And so now I am the proud owner of a dual Xeon E5620 server with 8 cores, but because of the hyperthreading MediaCoder reports 16 cores! The disk storage for the video files is a raid 0 set of four 500GB Seagate disks, and IOmeter reports a maximum sequential IO speed of almost 300MB/sec (read and write). The system disk is a OCZ Vertex Extreme flash disk. So my hardware is FAST!

The way I transcode video files is by uncompressing the input files to the scratch device first (big files!), and then using the 3-pass X264 encoding. The first pass is not that fast, not much faster than on my laptop. I get a throughput of about 150MB/sec. However the second pass is very disappointing. I get about 20MB/sec, and a CPU utilization of about 10%. In fact there is not that much difference with my laptop!?!

How can this be explained, and what can I do to get the performance I was hoping for?

AnonCrow
Modest
Modest
Posts: 136
Joined: Tue Aug 04, 2009 9:36 pm

Re: multithreading not very effective?

Post by AnonCrow » Sun May 23, 2010 12:56 am

Post your preset - and I hope you're not using the same preset as on your laptop.
Also post your exact x264 commanline used.

Running x264 in 3-pass has almost zero advantage over 2-pass, unless you're targeting very small bitrates ( <300 kbps for 720p) and/or you need to hit a very exact average bitrate (298 or 302 won't do, has to be exactly 300)

By 'uncompressing input files' you mean that you've pre-decoded the files into RAW files ?

Are you using avisynth, and if so , tried with avisynth-mt , or not using avisynth at all ?

grunnsat
Amateur
Amateur
Posts: 17
Joined: Thu Feb 14, 2008 9:29 am

Re: multithreading not very effective?

Post by grunnsat » Sun May 23, 2010 1:25 am

I am not aware that I should make any specific settings for my laptop or my server. I just use all cores on the laptop and the server, and that's it.

With uncompressed I mean raw video and PCM audio.

I'm using MEncoder, not Avisynth.

I'm using Windows 7 x64 and MediaCoder x64

AnonCrow
Modest
Modest
Posts: 136
Joined: Tue Aug 04, 2009 9:36 pm

Re: multithreading not very effective?

Post by AnonCrow » Sun May 23, 2010 1:53 am

Is the 10% cpu usage (reported by task manager or something else) overall or just x264 ?
What about cpu usage of mencoder alone ?
Does x264 cpu usage change much if you choose a faster or a slower preset ?
If you encode video only, disable audio alltogether (encode and mux it in later), any difference ?
Any preprocessing options set (deinterlace,deblock,denoise) ? Disable all and check any changes in encoding speed (and check the actual time it takes to encode a sample of video, not the cpu usage)

grunnsat
Amateur
Amateur
Posts: 17
Joined: Thu Feb 14, 2008 9:29 am

Re: multithreading not very effective?

Post by grunnsat » Sun May 23, 2010 2:47 am

I normally look at the statistics of MediCocder itself. I just compared them with the values of taskmanager, and the figures match. X264 uses 3 to 4 cpus of the 16 that are available.....Mencoder isn't doing very much either.I don't use any preprocessing options at the moment. I haven't tried any other settings so far. As far as I know the audio stream is processed after the video has been processed.

AnonCrow
Modest
Modest
Posts: 136
Joined: Tue Aug 04, 2009 9:36 pm

Re: multithreading not very effective?

Post by AnonCrow » Sun May 23, 2010 4:57 am

Is 'All Cores' checked for all encoders and decoders ?
cores.png
Try manually setting x264 --threads 8 , 16 or 24

With 16 virtual cores, 8 physical , if task manager reports 6-7% usage for a process , that means that it maxes out one physical core.
If mencoder is only using about that amount, you need to use a faster (multi-threaded) decoder, eg ffmpeg-mt.
Of course, since your input file is already decoded, you shouldn't need to set the decoder to mencoder, try setting it to bypass and
let x264 handle it.

Have you tried any other x264 GUIs ( eg. MeGUI, Handbrake, Avidemux) or just using x264 directly from CLI,
using either the uncompressed video directly ( raw yuv ? ) or using the x264 built-in decoders ( lavf, ffms) ?

See anything out of the ordinary in Mediacoder console output ?

If you have no success with increasing cpu usage of x264 , even when used from commandline, regardless of x264 preset used, might want to ask in doom10.org (closest thing to official x264 support forum for end-users)

edit: x264 input types :
http://forum.doom9.org/showthread.php?p ... ost1401954
http://mewiki.project357.com/wiki/X264_Settings#demuxer

Post Reply