PDA

View Full Version : mencoder and multithreaded encoding.


Thasp
6th May 2007, 03:57
I wondered why I was only getting 100% CPU usage instead of 200, or 150, while encoding xvid. So I removed every lib of the xvid I had, and followed advice from here (http://lists.mplayerhq.hu/pipermail/mencoder-users/2007-January/004965.html) and compiled the latest CVS.

Now it's using 115% CPU. I tried 0 threads, 2 threads, 3, 4, 120, same thing. It's ridiculous - I could get more speed with vmware and windows.

The line I was testing with is as follows.

mencoder test.mpg -sws 9 -vf pullup,crop=1904:1064:8:8,scale=1280:720:0:0:4,harddup -ovc xvid -xvidencopts noqpel:nogmc:trellis:nocartoon:nochroma_me:chroma_opt:lumi_mask:max_iquant=7:max_pquant=7:max_bquant=7:bitrate=3000:threads=120 -o -ofps 24000/1001 video.avi -oac copy


Also, with x264, I get 150% CPU usage, yet in windows with avisynth and x264, I can get 95%, and 100% with MT avisynth. This is of less concern than the snail-slow xvid issue, but still something I'd like to fix.

Thasp
6th May 2007, 10:27
It appears the culprit is scale. Is there an option to multithread or speed up scale?

Hellworm
6th May 2007, 12:46
If xvid does not use an extra thread for decoding (which seems to be the case) then you can use one mencoder to do decoding and scaling and write the output to a pipe (-ovc raw -of rawvideo). Then you can use a second mencoder with -rawvideo to encode the video.
That way you have an extra thread for scaling and decoding.