[MEncoder-users] Performance on multi core machines - a specific enquiry re avisynth mt input
James Hastings-Trew
jimht at shaw.ca
Sat Sep 29 04:34:14 CEST 2007
Michael Rozdoba wrote:
> First off, I hope this is an appropriate place to post this query. My
> apologies if I'm mistaken.
>
> I'm using mencoder under Windows XP as part of Megui. This is to encode
> to x264 2 pass, however as the input is an avisynth script which is very
> slow I'm performing a pre-render step where mencoder is used to
> transform the source via avisynth into an ffvhuff avi, which is itself
> subsequently passed into the 2 pass x264 encode.
>
> As the avisynth script is slow & avisynth natively doesn't make use of
> multi core cpus I'm using the mt (0.7) extension, which enables
> multithreading & exploitation of all cores.
>
> The script is fine. I can feed it to several players which will render
> it on my Q6600 box at about 11fps at 100% cpu utilisation. Without the
> mt extension I get 3fps at 25% cpu.
>
> I can even used VirtualDubMod & FFDShow to create a huffy avi encode
> from it, again at about 11fps, 100% cpu.
>
> However when I use mencoder it /all/ seems to be restricted to a single
> core & I only get 3fps 25% cpu.
>
> Can anyone explain what's going on & if this problem is unavoidable?
>
> Regardless of whether mencoder performs the huffy encode using multiple
> threads & cores, I did expect the framserving to its input to continue
> to exploit all four cores. Am I naively mistaken?
>
> Any comments, solutions or workarounds gratefully appreciated.
>
>
> For reference, though it's probably irrelevant, this is the mencoder cmd
> line:
>
> C:\Program Files\megui\tools\mencoder>mencoder.exe
> "E:\Work\test\fm-deblock.avs"
> -o "E:\Work\test\hfyu_fm-deblock.avi" -of avi -forceidx -ovc lavc
> -lavcopts vco
> dec=ffvhuff:vstrict=-2:pred=2:context=1
>
>
> Here's the full output:
>
> MEncoder dev-SVN-r23107-4.3.0 (C) 2000-2007 MPlayer Team
> CPU: Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz (Family: 6, Model:
> 15, Step
> ping: 11)
> CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
> Compiled with runtime CPU detection.
> success: format: 0 data: 0x0 - 0x605
> AVS file format detected.
> VIDEO: [YV12] 720x576 12bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s)
> [V] filefmt:38 fourcc:0x32315659 size:720x576 fps:25.00 ftime:=0.0400
> Opening video filter: [expand osd=1]
> Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
> ==========================================================================
> Opening video decoder: [raw] RAW Uncompressed Video
> VDec: vo config request - 720 x 576 (preferred colorspace: Planar YV12)
> VDec: using Planar YV12 as output csp (no 0)
> Movie-Aspect is undefined - no prescaling applied.
> videocodec: libavcodec (720x576 fourcc=48564646 [FFVH])
> Selected video codec: [rawyv12] vfm: raw (RAW YV12)
> ==========================================================================
> New_Face failed. Maybe the font path is wrong.
> Please supply the text font file (~/.mplayer/subfont.ttf).
> subtitle font: load_sub_face failed.
> Writing header...
> ODML: Aspect information not (yet?) available or unspecified, not
> writing vprp h
> eader.
> Writing header...
> ODML: Aspect information not (yet?) available or unspecified, not
> writing vprp h
> eader.
> Pos: 18.7s 467f ( 0%) 2.89fps Trem: 0min 0mb A-V:0.000 [33541:0]
>
>
> And just for completion, here's the avisynth script:
>
> SetMTMode(2,0)
> # Set DAR in encoder to 37 : 20. The following line is for automatic
> signalling
> global MeGUI_darx = 37
> global MeGUI_dary = 20
> DGDecode_mpeg2source("E:\Work\test\FM.d2v", info=3)
> ColorMatrix(hints=true,interlaced=true)
> #Not doing anything because the source is progressive
> crop( 0, 0, 0, 0)
> # from: http://forum.doom9.org/showthread.php?t=119486&page=2
> # Purpose: clean up blocky/noisy mpeg2 source
> source = last
> backward_vec2 = source.MVAnalyse(isb = true, delta = 2, pel = 2,
> overlap=4, sharp=2, idx = 1, truemotion=true)
> backward_vec1 = source.MVAnalyse(isb = true, delta = 1, pel = 2,
> overlap=4, sharp=2, idx = 1, truemotion=true)
> forward_vec1 = source.MVAnalyse(isb = false, delta = 1, pel = 2,
> overlap=4, sharp=2, idx = 1, truemotion=true)
> forward_vec2 = source.MVAnalyse(isb = false, delta = 2, pel = 2,
> overlap=4, sharp=2, idx = 1, truemotion=true)
> mask = mvmask(kind=1,
> vectors=forward_vec1).UtoY().spline36resize(source.width(), source.height())
> smooth = source.degrainmedian(mode=3).fft3dfilter(bw=16, bh=16, bt=3,
> sigma=4, plane=0)
> source2 = mt_merge(source, smooth, mask)
> source3 =
> source2.MVDegrain2(backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,idx=2)
> source3.gradfun2db(1.5)
> # Trim to a short clip for test purposes
> __film = last
> __t0 = __film.trim(120776, 122325)
> __t0
>
>
>
You'll need a :threads=2 option in the lavc opts to render with a dual
core machine using both cores.
I've had a look a MeGUI, and it really looks like it was written by
someone not all that familiar with MEncoder - it does a LOT of stuff
with external applicaitons (VirtualDub, AVISynth, besweet, MP4BOX,
DGIndex, Avimux, faac, lame, enc_aacPlus, etc.) that are all really
unnecessary because MEncoder has a LOT of really great filters and
codecs built in. I would be very surprised if you couldn't achieve
whatever it is you are trying to do with MEncoder alone. I say this as a
former very heavy user of VirtualDub, AviSynth, BeSweet, and boatloads
of special scripts and filters. Since I started working with MEncoder,
I've not needed to use any of those other programs, ever. For anything.
Like everything else in life, it comes down to either you know what you
are doing, or you don't. Looking at
http://speeddemosarchive.com/kb/images/2/23/Meguipaths.png this looks
very much like the work of someone who doesn't. Why in FSM's name is all
that crap needed in a GUI for MEncoder?
More information about the MEncoder-users
mailing list