digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Video Encoding and Conversion (http://www.digitalfaq.com/archives/encode/)
-   -   To crop or not to crop! (http://www.digitalfaq.com/archives/encode/1841-crop-crop.html)

black prince 12-21-2002 02:48 PM

@SansGrip,

SansGrip wrote:
Quote:

Try encoding some sample strips with that Avisynth script I posted (including a crop) instead of masking in TMPGEnc. I think you'll find the results to be almost identical to the extra compression you obtained through masking.
I did and except for using Tmpgenc's resize the results were similar. :D
I tried to figure out how you determined the resize and crop values, but
was at a loss. Still, adding Tmpgenc's resize decrease file size even more,
so I went for it. 8) I gained ~1.5MB per 90 seconds of encode time and
that allowed for a significant increase for CQ_VBR. :)

-black prince

kwag 12-21-2002 03:45 PM

Quote:

Originally Posted by SansGrip
Hmmm, Resident Evil came out way over target at 760mb :?. I'm running some more strips now with 75/48 to see if that helps.

Very important:
I got tired of this "Unpredictable" file size, depending on the resolutions. I did a test at 352x480, and the file size was WAY off 8O. So here's my latest findings and analysis. Just like the sampling theory, where you sample "at least" twice your highest frequency, a higher sampling rate with smaller windows should give a higher resolution than less samples of a larger window. The principle is that you have a finer grain resoution, the higher you go in sampling, and more "visibility" of the real material analyzed So I'm now testing 256 snapshots of 6 frames each 8O. It seems to give me almost the same sample file size, no matter what resolution I use :wink:
So theoretically, this should be more than enough for ANY film of just about any size. You might as well set prediction factor to 1.0, because what I see is that the final size is now almost 100% accurate with the formula.
Here are my three tests at different resolutions:

Code:

352x240, Sample size=7,010KB, CQ_VBR=29.88
352x480, Sample size=7,300KB, CQ_VBR=13.88
704x480, Sample size=7,212KB, CQ_VBR=5.72

Feedback please. Please try this as soon as possible and let us know your results :!:

My own feedback. This doesn't work!. 256/6. Back to the drawing board. Now trying 128/24 ...

-kwag

SansGrip 12-21-2002 04:00 PM

Quote:

Originally Posted by black prince
I tried to figure out how you determined the resize and crop values, but was at a loss.

I used FitCD :).

Quote:

Still, adding Tmpgenc's resize decrease file size even more
In my tests it didn't -- it increased the file size slightly, at least compared to Avisynth's bilinear. When you say it decreased, which of the resize filters were you comparing it to?

Quote:

I gained ~1.5MB per 90 seconds of encode time
Then something's still not right ;).

SansGrip 12-21-2002 04:04 PM

Quote:

Originally Posted by kwag
now testing 256 snapshots of 6 frames each 8O.

I was going to reply and say "shouldn't the sample length be closer to the GOP?" but now I realize that since we're not using scene-change detection it doesn't matter what size the sample is provided it's not too short. We're concerned about the GOP after encoding, not before it. Do you see what I mean?

Quote:

It seems to give me almost the same sample file size, no matter what resolution I use :wink:
Unfortunately the method I used for Resident Evil worked great for both American Pie and Untouchables, so it seems to depend on the source material too.

Quote:

Please try this as soon as possible and let us know your results :!:
My tests will have to wait until tonight, since we're going to my brother-in-law's place for supper and I think they'd frown upon me using my laptop at the dinner table :D.

black prince 12-21-2002 04:34 PM

@SansGrip,

SansGrip wrote:
Quote:

I used FitCD .
I used FitCD and tried to adjust left and top borders to match Tmpgenc's
mask settings. The numbers would not take and defaulted to 0. :(
For DVD 3/4 small a output (528x480) and TV-overscan 2 the resize
is BilinearResize(496,352,22,0,676,480) and AddBorders(16,64,16,64). :?
Not sure how to get this setting in FitCD. :? I tested Tmpgenc's resize vs
avs script resize with no filters and there is a decrease. I will test another
movie and see if the results are them same. :)



@Kwag,
Kwag wrote:
Quote:

Here are my three tests at different resolutions:
Code:
352x240, Sample size=7,010KB, CQ_VBR=29.88
352x480, Sample size=7,300KB, CQ_VBR=13.88
704x480, Sample size=7,212KB, CQ_VBR=5.72
Feedback please. Please try this as soon as possible and let us know your results
-kwag
I'm confused. How should I setup file prediction test :?: :

IL = Framecount / 50
SL = round(Framerate) * 2
SelectRangeEvery(IL, SL)


Are the CQ_VBR values a starting point :?:

-black prince

kwag 12-21-2002 04:48 PM

Quote:

Originally Posted by black prince
@Kwag,
Kwag wrote:
Quote:

Here are my three tests at different resolutions:
Code:
352x240, Sample size=7,010KB, CQ_VBR=29.88
352x480, Sample size=7,300KB, CQ_VBR=13.88
704x480, Sample size=7,212KB, CQ_VBR=5.72
Feedback please. Please try this as soon as possible and let us know your results
-kwag
I'm confused. How should I setup file prediction test :?: :

IL = Framecount / 50
SL = round(Framerate) * 2
SelectRangeEvery(IL, SL)


Are the CQ_VBR values a starting point :?:

-black prince

Start a CQ_VBR of ~20 and use:

Code:

IL=Framecount / 256
SL=6
SelectRangeEvery(IL,SL)

Here you're taking 256 samples of 6 frames each. Try it and let me know :wink:

-kwag

kwag 12-21-2002 05:18 PM

Quote:

Originally Posted by SansGrip
Quote:

Originally Posted by kwag
now testing 256 snapshots of 6 frames each 8O.

I was going to reply and say "shouldn't the sample length be closer to the GOP?" but now I realize that since we're not using scene-change detection it doesn't matter what size the sample is provided it's not too short. We're concerned about the GOP after encoding, not before it. Do you see what I mean?

Yes, but the thing I see is that very small samples are very random. So the more, the better. Each "window" can hit more B and P frames, because there are more Bs and Ps than I frames. Still, there should be I frame hits too. I tried 300 snapshots of 6 frames, and got basically the same result. So I think 256 is a pretty good amount of sampling points on a movie. We just need to find out if the results are consistent with different types of movies. Maybe I'm wrong :roll: :!:

Quote:

My tests will have to wait until tonight, since we're going to my brother-in-law's place for supper and I think they'd frown upon me using my laptop at the dinner table :D.
How about using a small PocketPC or PALM to evaluate formulas under the table. It's small enough, and you can hide it under the napkin 8O 8) :lol:

-kwag

black prince 12-21-2002 05:20 PM

Hi SansGrip,

SansGrip wrote:
Quote:

In my tests it didn't -- it increased the file size slightly, at least compared to Avisynth's bilinear. When you say it decreased, which of the resize filters were you comparing it to?
Here's my latest resize tests:

Test #1
Using avs resize LanczosResize(496,352) and AddBorder(16,16,16,16)
with Clip Frame only in Tmpgenc.

File Size = 18,547,704

Test #2
Using Tmpgenc's resize of 496x352 and Clip Frame. LanczosResize and
AddBorders are commented and not being used.

File Size = 17,252,889

The savings are 18,547,704 - 17,252,889 = 1,294,815 or 1.3MB 8O

Picture quality and resolution are the same and of course excellent :mrgreen:
I'm using LanczosResize and maybe that's why it decreases :?:

-black prince

black prince 12-21-2002 06:02 PM

Hey Kwag,

Kwag wrote:
Quote:

Code:
IL=Framecount / 256
SL=6
SelectRangeEvery(IL,SL)
The file prediction formula must have changed:

Old = ((movie length / 100) * (test file size * .95)) = Total Video file Size

New = ((movie lenght / 256) * (test file size * .98 )) = Total Video File Size :?:

-black prince

muaddib 12-21-2002 06:44 PM

Quote:

Originally Posted by black prince
I'm using LanczosResize and maybe that's why it decreases :?:

Yep... I think that you are right.
LancosResize gives more sharpness, and that increase the file size.

muaddib 12-21-2002 06:55 PM

Quote:

Originally Posted by black prince
Hey Kwag,

Kwag wrote:
Quote:

Code:
IL=Framecount / 256
SL=6
SelectRangeEvery(IL,SL)
The file prediction formula must have changed:

Old = ((movie length / 100) * (test file size * .95)) = Total Video file Size

New = ((movie lenght / 256) * (test file size * .98 )) = Total Video File Size :?:

-black prince

That would be right if SL was 1 sec (framerate). But the SL is just 6 frames.
You can calculate the Total Video File Size like this: (sample size / sample lenght ) * movie lenght * .98

note: movie lenght and sample lenght in seconds

gonzopdx 12-21-2002 08:26 PM

I just finished my first squeeze of a 120+ minute film onto one disc.

KVCD Predictor predicted 796 mb (CQ_VBR10.5), actual size 820mb (d'oh!).

Used TMPGEnc's resizing, clipping, encoded at 480x352 (widescreen), new GOP.

Quality is decent -- blocks are apparent on my 27" HDTV -- but for a 133 minute high-action film squished onto ONE 80-minute CD-R, I'm pleased =) It looks alright if you sit at a normal distance from the TV (6-8+ feet).

I'll probably do two discs to improve the quality.

EDIT: WOW! I was finally able to post on the board! =)

kwag 12-21-2002 08:42 PM

Welcome grivad :D

-kwag

SansGrip 12-21-2002 08:56 PM

Quote:

Originally Posted by black prince
I used FitCD and tried to adjust left and top borders to match Tmpgenc's mask settings. The numbers would not take and defaulted to 0. :(

Enter the "real" width and height first. For example if you have 16-pixel borders left and right, the real width is 688. You'd enter that in the "film pixel" box.

SansGrip 12-21-2002 08:56 PM

Quote:

Originally Posted by black prince
I'm confused. How should I setup file prediction test :?:

Hmmm... Might want to check the Avisynth forum... :)

SansGrip 12-21-2002 08:58 PM

Quote:

Originally Posted by kwag
How about using a small PocketPC or PALM to evaluate formulas under the table. It's small enough, and you can hide it under the napkin 8O 8) :lol:

Ah, I wish. Mine was the victim of an unfortunate washing machine incident ;).

SansGrip 12-21-2002 09:01 PM

Quote:

Originally Posted by black prince
The savings are 18,547,704 - 17,252,889 = 1,294,815 or 1.3MB 8O

I might be starting to sound like a broken record, but if you're getting that much of a difference between Avisynth cropping/resizing and TMPGEnc masking/resizing then your Avisynth script isn't right :).

Make sure you crop ALL borders from the source in Avisynth before running any filters on it (to reduce the work they have to do and thus speed things up significantly) and then resize within Avisynth using FitCD's suggestions.

I'm certain that if you do this you'll find only a very slight difference in the two methods (and the difference will be due to the different resizing algorithms being used: TMPGEnc's is apparently slightly less "soft" than bilinear, at least according to my tests).

kwag 12-21-2002 10:17 PM

Testing.... Testing ..... Encoding..... 8)

-kwag

SansGrip 12-21-2002 11:40 PM

Just watched Resident Evil (352x480, CQ_VBR 15.55) and it looks very good -- not DVD quality due to the relative softness, but still very watchable and of course a lot sharper than standard VCD. Also the bitrate was high enough that there was hardly any noticible Gibbs...

Again, though, I had that freezing at the beginning of the disc. However this time there was very bad corruption at the end, video and audio, but only in the last 5 minutes or so.

Is this another symptom of too-low minimum bitrate?

black prince 12-22-2002 12:09 AM

Hi SansGrip,

SansGrip wrote:
Quote:

Make sure you crop ALL borders from the source in Avisynth before running any filters on it (to reduce the work they have to do and thus speed things up significantly) and then resize within Avisynth using FitCD's suggestions.
Finally figured out how to get FitCD to crop and the results were the
same as yours. I used LanczosResize which add sharpening, so when
I commented it and used Tmpgenc's resize the file size decrease was
due to no sharpening. I'll switch to BilinearResize in the future. :?
Thanks for being patient in answering my questions :)

-black prince


All times are GMT -5. The time now is 10:12 PM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.