PDA

View Full Version : Crf advice needed


gav1577
5th August 2008, 23:39
Hi guys i need some advice about crf vs 2 pass ok here we go. I want to backup my bluray movies as avchd dual layer. for example
if i were to encode a movie using crf and ended up with a file that was 7 gb and then done an encode with 2 pass and ended up with a file also 7 gb would the crf encode look better than the 2 pass encode ? i know 2pass will achieve desired file size but would rather through trial and error use crf to get as close as possible to the target size if i knew that the quality was going to be better

Thanks

Avenger007
5th August 2008, 23:54
Just curious, what would make you think that crf might be better than 2-pass at the same bitrate, so much so that you would use trial-and-error to achieve that bitrate with crf?

gav1577
6th August 2008, 00:03
Just curious, what would make you think that crf might be better than 2-pass at the same bitrate, so much so that you would use trial-and-error to achieve that bitrate with crf?

Because i think read before that crf produces better quality but was a while ago and cant be sure if it does or not . just out of curiosity do you have a answer for me ;)

Avenger007
6th August 2008, 00:07
2-pass looks just as good as crf at the same bitrate, and maybe even a little better due to the advantages offered by making a first pass, eg. better direct mvs.

Shinigami-Sama
6th August 2008, 00:07
crf and 2 pass will look the same at the same bitrate
crf just doesn't take a week to finished unlike 2pass

lexor
6th August 2008, 00:10
You can use selectevery/selectrange/etc filter in avisynth to get like 10% of frames sampled from the entire movie and use that to guesstimate the result of crf encode. In my experience the final size will undersize prediction of 10% sample, but more than 10% really takes too long for guesstimation, so I just do test encodes at integer crf and then deduct 0.5 to do the final encode. Dirty, but works.

Oh and I don't know where you read that crf is somehow better quality at the same bitrate, but I'm fairly sure that's false.

Shinigami-Sama
6th August 2008, 00:13
You can use selectevery/selectrange/etc filter in avisynth to get like 10% of frames sampled from the entire movie and use that to guesstimate the result of crf encode. In my experience the final size will undersize prediction of 10% sample, but more than 10% really is too long for guesstimation, so I just do test encodes at integer crf and then deduct 0.5 to do the final encode. Dirty, but works.

ddog has a semi-automated script to do just that
and found that 1-5% is all you really need to predict the size

lexor
6th August 2008, 00:13
ddog has a semi-automated script to do just that
and found that 1-5% is all you really need to predict the size

You mean the old excel spreadsheet (and a program based on it)? that doesn't work anymore, way off on predictions.

fibbingbear
6th August 2008, 00:14
for reference:

http://forum.doom9.org/showthread.php?t=134545

gav1577
6th August 2008, 00:18
Thanks guys for the help will read up on the on the thread fibbingbear posted :)

Shinigami-Sama
6th August 2008, 00:37
You mean the old excel spreadsheet (and a program based on it)? that doesn't work anymore, way off on predictions.

yeah its old, but a good start

LoRd_MuldeR
7th August 2008, 01:08
You can use selectevery/selectrange/etc filter in avisynth to get like 10% of frames sampled from the entire movie and use that to guesstimate the result of crf encode.

If you use selectevery() to select only 10% of the movie, this means that you only take every 10th frame from the source.
So instead of consecutive frames with fluid motion you will get a sequence of more or less random frames (like scene changes all the time).
Wouldn't that cause the encoder to place a lot of I-Frames and wouldn't it also completely destroy any motion compensation attempts?
If so, your test result would be more or less useless...

And I still don't see the point why people want to guesstimate the size of a CRF encode:
If I want to achieve a video at certain quality level, I use CRF mode and size doesn't matter. If need to hit a target file/media size, I use 2-Pass.
That's it...

Ranguvar
7th August 2008, 03:31
SelectRangeEvery (http://avisynth.org/mediawiki/Select#SelectRangeEvery) will do what is needed.

LoRd_MuldeR
7th August 2008, 03:40
SelectRangeEvery (http://avisynth.org/mediawiki/Select#SelectRangeEvery) will do what is needed.

That filter makes more sense here :)

However even when picking out a short sequence of consecutive frames every few minutes, you still might happen to get scenes that are far more/less complex than the rest of the movie...

lexor
7th August 2008, 04:27
That filter makes more sense here :)

However even when picking out a short sequence of consecutive frames every few minutes, you still might happen to get scenes that are far more/less complex than the rest of the movie...

Both DS and Aku weighed in on this subject before and declared any such iframe bias to be negligible. It is certainly not the cause of mispredictoin of the final size.

chainring
7th August 2008, 16:05
I, too, was curious if there was a way to guage the final size of a CRF encode. Like others, I remembered the DARF thread, and DDog's input, as well as the SelectRangeEvery AviSynth function. Well, let's just say that using 1%, 2%, 5% and 10% samples, the outcome was pretty far off the mark. I'll have to dig up the values I used for the test.

audyovydeo
7th August 2008, 16:32
I, too, was curious if there was a way to guage the final size of a CRF encode. Like others, I remembered the DARF thread, and DDog's input, as well as the SelectRangeEvery AviSynth function. Well, let's just say that using 1%, 2%, 5% and 10% samples, the outcome was pretty far off the mark. I'll have to dig up the values I used for the test.

I wasn't aware of this SelectRangeEvery function.
I've just made this script, but since I haven't got any material to encode right now, if anyone cares to test it on their footage, go for it.

Taking a GOP of 250 as reference I calculate how many GOPS the clip has, and test 5% those spread evenly across the clip.

# created 7.8.2008
# version 4
clipgops=(Framecount(clip))/250
testgops=round(clipgops/20)
passo=(Framecount(clip)/testgops)
SelectRangeEvery(clip, passo, 250, 250, audio=false)

I put an offset of 250 as I don't consider the first bunch of frames as statistically significant, but that's me. Also, it does not work for clips shorter than 5000 frames. I'm not good enough with avisynth scripting to do checking etc


It *should* give a more accurate estimate of a clip's compressibility than discussed above.
(grains of salt, pepper &your favourite spice).



cheers
audyovydeo

DarkZell666
7th August 2008, 17:45
And I still don't see the point why people want to guesstimate the size of a CRF encode:
If I want to achieve a video at certain quality level, I use CRF mode and size doesn't matter. If need to hit a target file/media size, I use 2-Pass.
That's it...

The original idea was to save over 75% of the encoding time, while keeping a quality very close to that of 2-pass ;)
Instead of doing pass 1, then pass 2, you do 10% of pass 1, and use the calculated CRF for pass 2.

Actually, predictions were quite good at the time, I was amazed by the results, but VAQ and Psy-Rd have been introduced since then, so the calculations will be off unless they're revisited because the bitrate-per-QP value isn't the same. I do recall VAQ being tuned to get it as close as possible to the original value though :) A vanilla x264 build should still be useable with DDog's spreadsheets imho (not tested of course).

Blue_MiSfit
7th August 2008, 21:47
If you're targeting AVCHD discs, you should probably use 2pass...

But why? Hard drives are so cheap, and your PS3 can play files off a network share, right?

~MiSfit