Log in

View Full Version : encoding using x264 with i7, low fps?


rurouni572
2nd February 2010, 06:16
I just started some casual encoding (as in I have no clue what I pasted down below means in any sense) and I'm wondering why my fps while encoding in megui, or pretty much any other gui that uses x264 is encoding so slowly. Well, for i7 standards anyway. I read many benchmarks saying 2nd pass for HD 720p encoding should be around 22-27 average fps while my i7 720 struggles uphill until it peaks at about 20fps about 3 minutes into encoding, all while all 8 logical cores are maxed out 100%. My 1st passes are around 27fps average as well. It's in a laptop, so I suppose that's where the trouble is coming from? Although I'm still skeptical.

Also the fact that megui is the only gui that encodes up to that speed makes me a little worried. I realize the encoder is x264 itself and not the gui, but for some reason, encoding in programs like staxrip or ripbot or handbrake give me speeds of around 5fps, and they start dipping lower than that after a couple minutes.

Below I pasted the avisynth script for a video I'm encoding and the x264 settings. Perhaps the resizing is what's slowing it down? Also, my raws come from a canon vixia hf20 and it gives me humongous 17mbps AVCHD files in .mts containers. I'm wondering if there might be something in the decoding process that's bottlenecking my speeds?

The quality of what I've encoded so far is very good. I'm not concerned so much with quality as I am the speed of encoding because I take a lot of 3-4 minute videos and I have to encode something close to 50 videos. Again, I don't know what the specifics of x264 settings are, but the below settings produce videos that look more than fine. I do notice differences when I encode with different bitrates, but I think I could even go lower than what I have and maintain the quality I want. Any recommendations for a good batch encoder too would be nice. Manually clicking through 50 videos in megui is mentally taxing =(.

program --profile high --preset fast --pass 2 --bitrate 3000 --stats ".stats" --thread-input --deblock -1:-1 --b-adapt 2 --ref 5 --rc-lookahead 40 --me umh --direct auto --partitions all --trellis 2 --output "output" "input"

DirectShowSource("C:\Users\Michael\Desktop\Video Editting\Raw Videos\WGF 2010\WGF 2010 Singles (1).mts", fps=29.970, audio=false, convertfps=true)
#deinterlace
#crop
LanczosResize(1280,720) # Lanczos (Sharp)
#denoise

Dark Shikari
2nd February 2010, 07:30
20fps is hardly slow considering how incredibly slow the settings you're using are. Remember, you're encoding 720p as wel--
but for some reason, encoding in programs like staxrip or ripbot or handbrake give me speeds of around 5fps, and they start dipping lower than that after a couple minutes.Then something is horrifically broken on your system. Handbrake's default settings are faster than the ones you pasted here.

Blue_MiSfit
2nd February 2010, 08:18
Yes. Why are you using --preset fast, and then tossing in things like --trellis 2 --b-adapt 2 and --me umh? These are all rather "slow" settings. If things are "too fast" aka, you're not getting 100% CPU Utilization, dial up to --preset slow or slower.

There are other options to fine-tune this, but adjusting the presets usually gives enough granularity. --b-adapt 2 and --trellis 2 both take a LOT of work :)

Also, what DirectShow decoder are you using? There's always potential for better performance on the decode side. You can try ffmpeg-mt via ffdshow, CoreAVC, DivX H.264, or DiAVC. All of these are "fast" by any standard.

All in all, 20fps for 720p coming from a 1080i or 1080p (???) AVCHD source isn't half bad! Is your source video interlaced?

~MiSfit

rurouni572
2nd February 2010, 16:18
To be completely honest I don't really know what almost any of those settings are. Those settings are a direct copy of what I got from the x264 preset on megui. I think I might have clicked the preset "extra quality" instead of "fast" though. I just tried the fast preset with --trellis 0 and no --b-adapt and the 2nd pass was around 24fps. I suppose that's supposed to be "fast"?

My vid source is...pseudo interlaced. My camera has a "30p" mode, but I read that it doesn't actually do progressive frames, but records "fake" progressive where it does something like shut off every third interlaced frame or something. I'll look more into it and post exactly what I'm talking about instead of looking even more ignorant =S. I'm thinking about switching back to 60i recording unless someone tells me that's a bad idea.

How do you check for what DirectShow decoder you're using? I checked my ffdshow settings and ffmpeg-mt is used to decode my h.264/avc files.

And thank you for the replies!

Dark Shikari
2nd February 2010, 18:47
To be completely honest I don't really know what almost any of those settings are. Those settings are a direct copy of what I got from the x264 preset on megui. I think I might have clicked the preset "extra quality" instead of "fast" though. I just tried the fast preset with --trellis 0 and no --b-adapt and the 2nd pass was around 24fps. I suppose that's supposed to be "fast"?It's pretty fast considering the source is 1080p and has to be decoded by a slow decoder, then resized further to an even smaller size. x264 isn't the bottleneck here.
My vid source is...pseudo interlaced. My camera has a "30p" mode, but I read that it doesn't actually do progressive frames, but records "fake" progressive where it does something like shut off every third interlaced frame or somethingIt's called telecine. (http://www.mod16.org/hurfdurf/?p=12)

rurouni572
2nd February 2010, 19:16
It's pretty fast considering the source is 1080p and has to be decoded by a slow decoder, then resized further to an even smaller size. x264 isn't the bottleneck here.

Alright, cool. It eases my mind to see that it's not that I'm using horribly wrong settings and that the fps is around what it's supposed to be. I guess next question is what would be a faster decoder? And would it actually yield a noticeable difference?

And about telecine, is there an advantage to using telecine vs. interlaced video? The first time I tried doing stuff with 60i I got annoying stripes across the screen that I for some reason could not deinterlace in sony vegas. That's why I switched to this 30p telecine setting. I fear I'm going off topic though.

Blue_MiSfit
2nd February 2010, 20:04
Telecine is a way of storing progressive video (usually 24p) inside an interlaced stream.

Your best bet is probably shooting 60i, since your camera is natively interlaced, and then deinterlacing in post, to either 60p or 30p, depending on motion / project considerations.

Your multi core PC + AviSynth can do a better job of deinterlacing than the poor little camera can!

~MiSfit

rurouni572
2nd February 2010, 20:29
Telecine is a way of storing progressive video (usually 24p) inside an interlaced stream.

Your best bet is probably shooting 60i, since your camera is natively interlaced, and then deinterlacing in post, to either 60p or 30p, depending on motion / project considerations.

Your multi core PC + AviSynth can do a better job of deinterlacing than the poor little camera can!

~MiSfit

Alright, I will do just that.

Thanks for the advice so far misfit and dark shikari. I think everything I had questions about has been addressed, so off to encoding I go!

Turtleggjp
3rd February 2010, 16:25
I'll chime in here, since I too have a Canon camcorder (HF100). Even though I've never tried the 30p mode, it is my understanding that the video it produces is coded as interlaced, but may be treated as progressive (no de-interlacing needed). You should not run into telecine video until you switch to 24p mode.

Do you have an Nvidia card in your system? If you do, Neuron2's DGDecodeNV AVISynth filters can help you by accelerating the decoding (and de-interlacing if needed) of your camcorder's video.

rurouni572
3rd February 2010, 22:23
I do have an Nvidia card. How would I go about using this DGDecodeNV thing? I am using megui so I don't actually know script syntax and whatnot.

Blue_MiSfit
3rd February 2010, 23:27
You buy the license from neuron2, and then you install the software, which operates just like DGIndex / DGAVCIndex. The only difference being decoding / deinterlacing is handled by your GPU via CUDA.

DGDecodeNV supports MPEG-2 VC-1 and H.264, and it's really a nice piece of kit. I'm not sure if its possible to make MeGUI use DGDecodeNV instead of DGIndex or other methods. You may have to write your own AviSynth scripts, but fear not. This is incredibly easy :)

~MiSfit

Turtleggjp
4th February 2010, 16:11
Best $15 I ever spent. And the guy deserves it too, not only for this program, but for everything else he does around here.

It works like this:

1. Index your file (or files, you can do more than one at once if you wish to join your camcorder's footage) using the DGIndex program. This will create a .dgi file (the index) and an audio file.

2. Create a .avs script file that loads the .dgi file using DGSource (or DGMultiSource). In this file, you will specify if you want to use deinterlacing, cropping, resizing, etc.

3. Use the .avs file as input for your x264 encode.

while that is working...

4. (if needed) Use Neuron's (free) Joints (http://forum.doom9.org/showthread.php?t=149441) program to correct audio sync if you used multiple camcorder clips.

That's just a basic summary of the steps needed. If you need further details on each step, don't hesitate to ask.

rurouni572
4th February 2010, 23:34
Would it actually be a noticeable increase in the overall speed of encoding? As in is the decoding the biggest limiting factor here? I'm already getting close to 25fps on 2nd pass, and from what I'm reading that's pretty darn fast already (if decoding source files and encoding are related like that). If I can get about another 4-5fps in speed I think I'll consider purchasing.

It's not really about the money though. Relearning how to encode (no matter how easy) isn't something I'm looking to do at this time UNLESS it gives me noticeable upgrades like I mention above. I don't really know what DGIndex does, or what an index file is, and I'm sure explanations to these also require even further explanation.

I do thank you guys for answering my questions though.

Blue_MiSfit
4th February 2010, 23:59
The big speed increase comes from hardware deinterlacing on the card. Of course, that's only if you have interlaced sources :)

The decoding will offload some CPU time as well, but it's not THAT big.

~MiSfit