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)

SansGrip 12-17-2002 09:52 AM

Quote:

Originally Posted by jamesp
These encoded changes look like they take more space than an actual main frame!

You know, that makes a lot of sense. For very noisy sources, it might be best to reduce the number of P- and B-frames, since as you say it's possible that describing the differences might require a higher bitrate than simply using more I-frames...

I think most of our questions regarding the GOP could be answered with a sophisticated MPEG analyzer. Anyone know of such a beast?

jp 12-17-2002 10:01 AM

Quote:

Originally Posted by bman
Quote:

Originally Posted by jp
I tried to use just tmpgenc crop at VCD resolution and got mixed results - nothing talk about for now.
But I found that, using standard avs without addborders and with center in tmpg I always get a smaller filesize (around 0,5%).

About the GOPs that you are testing. I had the idea that the max GOP size was the sum of all frames, for example: a GOP 1-8-3 would give a size of 1+8+8*3 =33 (+1 if close GOP selected). If so, why to use the same number for P frames and Max GOP ?

GOP = I + P + (P+1)xB
Check yourself with TMPGenc->GOP -> GOP structure

bman

You´re absolutely right! with I=1 we´ve got GOP= 1+p+(P+1)*B (-B if Closed GOP selected).
But my question remains: Why P=max GOP? and why 15 (just on example)? If I count correctly, the GOP is cutted between a 2nd and a 3th B frame (not the best place to stop)

jamesp 12-17-2002 10:12 AM

Quote:

Originally Posted by SansGrip
Quote:

Originally Posted by jamesp
These encoded changes look like they take more space than an actual main frame!

You know, that makes a lot of sense. For very noisy sources, it might be best to reduce the number of P- and B-frames, since as you say it's possible that describing the differences might require a higher bitrate than simply using more I-frames...

I think most of our questions regarding the GOP could be answered with a sophisticated MPEG analyzer. Anyone know of such a beast?

Well this could also be true for DVD encodes using CQ_VBR at 11. The resulting Mpegs are going to be noisy so Tmpeg could be finding it harder to allocate a bitrate

Jim

bman 12-17-2002 10:17 AM

Quote:

Originally Posted by jp
Quote:

Originally Posted by bman
Quote:

Originally Posted by jp
I tried to use just tmpgenc crop at VCD resolution and got mixed results - nothing talk about for now.
But I found that, using standard avs without addborders and with center in tmpg I always get a smaller filesize (around 0,5%).

About the GOPs that you are testing. I had the idea that the max GOP size was the sum of all frames, for example: a GOP 1-8-3 would give a size of 1+8+8*3 =33 (+1 if close GOP selected). If so, why to use the same number for P frames and Max GOP ?

GOP = I + P + (P+1)xB
Check yourself with TMPGenc->GOP -> GOP structure

bman

You´re absolutely right! with I=1 we´ve got GOP= 1+p+(P+1)*B (-B if Closed GOP selected).
But my question remains: Why P=max GOP? and why 15 (just on example)? If I count correctly, the GOP is cutted between a 2nd and a 3th B frame (not the best place to stop)

It's just a NUMBER , OK?!!!!
U can use any number , ANY number ! (like 5823 - signature of KWAG) :D
It can be big any size but not less than optimal value - THE ONE our Bright minds are serching for 8) :?
Size of GOP depends on MAX frame numbers in gop . This number is responsible on GOP size .

bman

SansGrip 12-17-2002 10:28 AM

Quote:

Originally Posted by jamesp
Well this could also be true for DVD encodes using CQ_VBR at 11. The resulting Mpegs are going to be noisy so Tmpeg could be finding it harder to allocate a bitrate

Maybe we're using a different definition of "noise". I'm referring to random variations (i.e. additive white noise) in the source material that confuses the MPEG encoder and causes unnecessary allocation of bits that could be better spent describing actual details.

A low CQ_VBR doesn't make more of this kind of noise. It might make "mosquito noise", but it's not really noise at all. We should probably start calling it the Gibbs Effect instead :).

Jellygoose 12-17-2002 10:42 AM

8O wow, kwag and others... now this is getting really odd...
So as I understand ya'll correctly :) ...
There's an optimal GOP for each resolution + for each CQ_VBR value of this resolution ?
Let's just go ahead and test... I'll run a couple of tests on the PAL templates, of the KVCDx3...

later guys...

Boulder 12-17-2002 10:59 AM

Quote:

Originally Posted by SansGrip
Quote:

Originally Posted by Boulder
The P frame number seems to be totally unpredictable..you have created a monster, Kwag :twisted:

P-frame?? Oh boy oh boy.

Well, I should also have told that the max number of frames in a GOP is the same as the number of P-frames..

so what I really meant was that this thing we are contemplating could really turn out to be a tough case. In my tests GOP size 36 frames produced a slightly smaller file than a 30-frame GOP. Then again, I got the smallest filesize with a max 8-frame GOP..confusing!

I just hope that this value would only depend mostly on the resolution.

kwag 12-17-2002 11:04 AM

I think I know what we have to do. If for a given CQ_VBR there is an optimal number of max frames, we need to calculate a formula that applies either a negative or positive offset to a pre-determined center point of max frames. This way, when we change the CQ_VBR value, the max frames is adjusted. Of course with a minimum value and maximum values. Like MIN_P=6, MAX_P=36.

-kwag

SansGrip 12-17-2002 11:05 AM

Quote:

Originally Posted by Boulder
Well, I should also have told that the max number of frames in a GOP is the same as the number of P-frames..

Not really -- the number of frames in a GOP is the sum of all I-frames, P-frames and B-frames. Thus the number of P-frames in the GOP should always be less than the total frames in the GOP.

Quote:

Originally Posted by Boulder
Then again, I got the smallest filesize with a max 8-frame GOP..confusing!

I think enough testing will make things clearer...

Boulder 12-17-2002 11:07 AM

I think it's time for SansGrip to start planning another util..THE P-REDICTOR!

Jesus, we'll need more time predicting the GOP size and the CQ_VBR value than encoding the movies :lol:

SansGrip 12-17-2002 11:07 AM

Quote:

Originally Posted by kwag
I think I know what we have to do. If for a given CQ_VBR there is an optimal number of max frames ( P's ), we need to calculate a formula that applies either a negative or positive offset to a pre-determined center point of P's. This way, when we change the CQ_VBR value, the P's are adjusted.

Can you give an example of how this would work?

(And by "P's" you mean "pictures", not "P-frames", right? :?)

kwag 12-17-2002 11:09 AM

Opps, sorry SansGrip, I had edited the post, but you beat me to it on the quote :D I meant max number of frames. Not P's.

-kwag

SansGrip 12-17-2002 11:11 AM

Quote:

Originally Posted by Boulder
I think it's time for SansGrip to start planning another util..THE P-REDICTOR!

heheheh actually I was just imagining how this could be incorporated into KVCDP... :D

Quote:

Jesus, we'll need more time predicting the GOP size and the CQ_VBR value than encoding the movies :lol:
If you think this is complicated check out the process used to transfer a studio release onto DVD... Those compressionists do all this and more -- usually on a scene-by-scene basis! 8O

Boulder 12-17-2002 11:11 AM

Quote:

Originally Posted by SansGrip
Not really -- the number of frames in a GOP is the sum of all I-frames, P-frames and B-frames. Thus the number of P-frames in the GOP should always be less than the total frames in the GOP.

Some more clearing :wink: .. I meant that I used the same formula as the other people here, 1-8-3-1-8 produced the smallest filesize :)

SansGrip 12-17-2002 11:13 AM

ARGH!! WE'RE ALL POSTING AT THE SAME TIME!!!! :lol: :mrgreen:

kwag 12-17-2002 11:16 AM

We go on like this, this thread will have 20 pages by the end of the day :lol:
At this speed, we'll probably have a solution to all of this in a matter of hours :mrgreen:

-kwag

Boulder 12-17-2002 11:19 AM

Quote:

Originally Posted by SansGrip
If you think this is complicated check out the process used to transfer a studio release onto DVD... Those compressionists do all this and more -- usually on a scene-by-scene basis! 8O

I would as well if they paid me big money too :wink:

To be honest, if this thing gets included in the KVCD Predictor, it's going to be the sliced bread of amateur(?) video encoding, if you see what I mean 8)

Boulder 12-17-2002 11:24 AM

Quote:

Originally Posted by kwag
At this speed, we'll probably have a solution to all of this in a matter of hours :mrgreen:

Distributed computing's the name of the game these days..the interest in this has been huge, I must admit.

SansGrip 12-17-2002 11:26 AM

Quote:

Originally Posted by Boulder
I would as well if they paid me big money too :wink:

hehe no kidding.

Quote:

To be honest, if this thing gets included in the KVCD Predictor, it's going to be the sliced bread of amateur(?) video encoding, if you see what I mean 8)
Right now I have a picture in my head forming...

It involves selecting several sample strips (say, "this represents the average amount of action in the film", "this represents more sedate scenes", "this represents particularly high-action scenes", or whatever) and encoding them, then running them through an MPEG analyzer to determine how efficiently each strip is using the CQ_VBR and GOP settings, then generate a new template (incorporating "force picture type" settings) to use based on the analysis, then repeat...

Sort of like a feedback loop, all in one program...

8O

SansGrip 12-17-2002 11:46 AM

Another thought...
 
wrt the analysis idea, if one were to go through the encoded sample strip and calculate the average size of I-frames, P-frames and B-frames, shouldn't it be possible to calculate the best GOP structure from that information?

In other words, let's say we had the following results from the analysis (numbers are made up and probably bear no resemblance to real figures):

Avg. I-frame = 25kb
Avg. P-frame = 10kb
Avg. B-frame = 5kb

This information would suggest a large GOP, with as many P- and B- frames as possible.

The question is, what would the average sizes be for a movie that compresses better with a smaller GOP? Could it possibly look like this:

Avg. I-frame = 20kb
Avg. P-frame = 22kb
Avg. B-frame = 25kb

:?:

What else would account for the phenomenon?

jamesp 12-17-2002 11:51 AM

[quote="SansGrip"]
Quote:

Originally Posted by Boulder
If you think this is complicated check out the process used to transfer a studio release onto DVD... Those compressionists do all this and more -- usually on a scene-by-scene basis! 8O

Judging by my copies of Highlander and 'Blackadder' these so called compressionists can't come up with anything better than a standard KVCD LBR!

kwag 12-17-2002 11:55 AM

This is starting to get hairy now 8O , like the case of the chicken and the egg. Which came first :?: The CQ_VBR or the GOP size :?:

-kwag

kwag 12-17-2002 11:58 AM

Quote:

Originally Posted by SansGrip
Sort of like a feedback loop, all in one program...

8O

Sounds to me more like a software "Phase Locked Loop" algo :idea:

-kwag

SansGrip 12-17-2002 11:58 AM

Quote:

Originally Posted by kwag
Which came first :?: The CQ_VBR or the GOP size :?:

I think we make a sample strip and determine a good CQ_VBR the standard way. Then perhaps do an analysis of the MPEG as suggested above to determine the best GOP structure, then adjust CQ_VBR accordingly. Hopefully a small-ish change in CQ_VBR to match desired target size won't change the optimal GOP structure...

SansGrip 12-17-2002 11:59 AM

Quote:

Originally Posted by jamesp
Judging by my copies of Highlander and 'Blackadder' these so called compressionists can't come up with anything better than a standard KVCD LBR!

Ah, but then you get something like LOTR... :)

kwag 12-17-2002 12:01 PM

Quote:

Originally Posted by SansGrip
Hopefully a small-ish change in CQ_VBR to match desired target size won't change the optimal GOP structure...

... Because if the changes are to great, we fall into a "positive feedback" type situation where a change in CQ_VBR throws off the GOP, and then it's like a never ending loop. And that's going to be a pain 8O

-kwag

SansGrip 12-17-2002 12:03 PM

Quote:

Originally Posted by kwag
... Because if the changes are to great, we fall into a "positive feedback" type situation where a change in CQ_VBR throws off the GOP, and then it's like a never ending loop. And that's going to be a pain 8O

Or how about this: We figure out manually how big a change, on average, we get from optimizing the GOP for a given CQ_VBR. Then we deliberately miss the target with our file size prediction by that amount, then adjust the GOP...

kwag 12-17-2002 12:13 PM

Thinking Thinking ....... Thinking ..... :lol:

-kwag

kwag 12-17-2002 12:56 PM

Got something :!:
This is what I'm doing manually, and it seems to work correctly.
Start your encode with regular file size prediction. Say at CQ_VBR=25 and a GOP of 1-18-3-1-18. ( Half way between 1-36-3-1-36 )
Keep encoding as usual to target your wanted predicted file size. Then after you're done, go into TMPEG and select a 5 second range. Take something in the beginning of your 100 second window. We still haven't removed the file prediction script, so your range will be within 100 seconds. Now encode this 5 second clip. Take a look at file size. Now change your GOP and encode again. See if file size is larger or smaller, and adjust GOP up or down a couple of MAX P's accordingly.
The 5 second sample clip is very fast to encode, so you can play up and down pretty fast until you find the optimal max number of frames. Now after you're done, remove the frame range in TMPEG and go back to regular file prediction once more. After one or two runs, you should have your target again, with a slightly higher CQ_VBR value, but not that high to make a difference for a new GOP calculation. Hopefully this is what needs to be automated :wink:

Edit: I'm doing this right now, as I want to compare the original predicted file size with bit rate viewer, and then the new optimized mpeg. Because both file sizes will be about the same, I want to examine both mpegs to determine if the optimized mpeg has a lower Q factor meaning higher quality. Maybe not visually, but mathematically. If this is true, then we have achieved a GOP optimizing method. If the quality is the same, then CQ_VBR is playing a trick on us, and what we're doing is not worth it.

-kwag

Boulder 12-17-2002 01:33 PM

I'm also encoding The Cannonball Run for the second time. The first one had 8 frames/GOP and this one 15. The first one is a couple of megabytes short of a full CD, let's hope that this other one is as well. Then I could check the files both visually and with Bitrate Viewer. Hopefully this will provide some extra information.

And what comes to bad compressionists, nothing can beat Future Film's remasters of Time Bandits and Monty Python's Life of Brian.. they both look more like a really bad XVCD than a DVD to me. The only good thing about them is that they were cheap.

caish5 12-17-2002 01:38 PM

LOTR
 
Sansgrip

On the LOTR subject. I just watched the region 4 PAL Special Edition which has the movie on two discs.
It looks as if it needs a bit of blockbuster to me.!!!
For 2 discs it should look WAAAY better.

jamesp 12-17-2002 01:46 PM

Re: LOTR
 
Quote:

Originally Posted by caish5
Sansgrip

On the LOTR subject. I just watched the region 4 PAL Special Edition which has the movie on two discs.
It looks as if it needs a bit of blockbuster to me.!!!
For 2 discs it should look WAAAY better.

Beauty and the Beast looked a bit dodgy in places! - and that cost me a fortune!

What makes me laugh is these people have over 8 gigs to play with.

SansGrip 12-17-2002 01:48 PM

Quote:

Originally Posted by kwag
Got something :!:

Let me know if it works, and I'll try duplicating here. If it works for me too I'll start figuring out how to add it to KVCDP :).

SansGrip 12-17-2002 01:51 PM

Re: LOTR
 
Quote:

Originally Posted by caish5
On the LOTR subject. I just watched the region 4 PAL Special Edition which has the movie on two discs.
It looks as if it needs a bit of blockbuster to me.!!!
For 2 discs it should look WAAAY better.

I can only speak of the region 1 "normal edition" of it, full-screen at that (my wife picked it up and forgot to check which version it was, grr ;)).

I've not looked very closely at it, but from my regular viewings with family etc. it looks pretty darn good.

SansGrip 12-17-2002 01:53 PM

Re: LOTR
 
Quote:

Originally Posted by jamesp
What makes me laugh is these people have over 8 gigs to play with.

It's because they try to jam so many BS "extras" on there too. If they used the whole 8gb for video (aka SuperBit discs) the quality should be superb. Usually is, sometimes isn't.

What gets me is that I don't believe I've ever watched one of those "extras" more than once. Most of the discs I've bought, I've not even watched them at all. Very annoying.

SansGrip 12-17-2002 02:00 PM

Quote:

Originally Posted by kwag
If this is true, then we have achieved a GOP optimizing method. If the quality is the same, then CQ_VBR is playing a trick on us, and what we're doing is not worth it.

Quick... quick!! :mrgreen:

kwag 12-17-2002 02:04 PM

Quote:

Originally Posted by SansGrip
Quote:

Originally Posted by kwag
Got something :!:

Let me know if it works, and I'll try duplicating here. If it works for me too I'll start figuring out how to add it to KVCDP :).

And the veredict is......... NOT WORTH IT. :evil:
The tighter the GOP, the more visible artifacts on low bit rates. So the higher GOP shines on smoothing artifacts. So the 1-36-3-1-36 is good enough to provide descent quality vs. file size. The smaller file sizes with different GOPs drop the overall quality too. I noticed it on a specific scene on "Red Planet" and after playing it over and over, I finally see that the longer GOP helps A LOT. So CQ_VBR is playing tricks on us as we change the GOP size. One more thing that should be tried is to find how long can we go in the GOP before we loose quality. In the original KVCD templates, this size was 48, and it caused problems with some DVD players. The "flashing" effect. With a GOP size of 36, I don't see anyone complaining. Could we jack this up more? How much more? Or is 36 good enough for what we are getting now?

-kwag

SansGrip 12-17-2002 02:15 PM

Quote:

Originally Posted by kwag
And the veredict is......... NOT WORTH IT. :evil:

Booooo! ;)

Quote:

In the original KVCD templates, this size was 48, and it caused problems with some DVD players. The "flashing" effect. With a GOP size of 36, I don't see anyone complaining. Could we jack this up more?
My biggest concern is, of course, retaining compatibility with as many standalones as possible. Anything over 18 (for NTSC) is non-standard and might cause problems.

kwag 12-17-2002 02:25 PM

Quote:

Originally Posted by SansGrip
Quote:

Originally Posted by kwag
And the veredict is......... NOT WORTH IT. :evil:

Booooo! ;)

:mrgreen: :P

Quote:

My biggest concern is, of course, retaining compatibility with as many standalones as possible. Anything over 18 (for NTSC) is non-standard and might cause problems.
For DVD, yes 18 is definitively a must. For VCD playback, some will take long GOPs and others won't. Maybe 36 is good enough, or maybe there's not that much diffence between 18 and 36 and we can drop back to 18 for more compatibility :?: I'll make a couple of tests at 18 and 36. If there's not that much difference, I'll fall back the templates to 18 with a note that if your player supports longer GOP, then crank it up at your own risk :wink:

-kwag

christopher 12-17-2002 02:40 PM

Quote:

Originally Posted by heyitsme
Christopher

At what resolution did you encode to get those results.

352x480 cq 20 the movie was 112 minutes in length

-Christopher


All times are GMT -5. The time now is 05:53 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.