View Full Version : Question concerning AQ at High Quality Bitrate and Anamorphic Encoding


Splashdriver
6th July 2004, 07:14
Hi,

I'm encoding LOTR_The return of the King to a DVD+RW size (let's say around 4500 MB) with a bitrate around 3026 kBit/s (2-pass encoding). I'm using a resolution of 720x420 (no resize, just cropping). my question is: Does it make any sense to enable AQ at such a high bitrate?? (I've done a forum-search, but couldn't find a real appropiate answer).....

Thanks in advance!

Koepi
6th July 2004, 09:10
In such a high bitrate scenario I wouldn't use AQ. Adaptive quantisation gives more benefit for real bitrate constraints, now you're giving the codec enough space to do it's magic without the AQ trade-off.

Regards
Koepi

Splashdriver
6th July 2004, 09:52
Thank you for your valuable reply Koepi!

What about GMC.....should I compression-wise benefit from such a feature when using such a High bitrate like I do?
What are the recommendations on this?

Koepi
6th July 2004, 11:23
Yes, GMC improves quality quite a bit.

Regards
Koepi

Teegedeck
6th July 2004, 14:32
Edit: Whoops, just looked at the bitrate. Now that really makes AQ unneccessary unless you blow up the resolution with sharp resizer.

Splashdriver
6th July 2004, 18:46
Thanks...I guess enabling GMC is the best thing to do for this movie since I've spotted quite a lot of panning and zooming and stuff.

I normally don't encode movies with such a high bitrate, but this movie is 13h_12 min_47 sec ...[edit]oops....it's more like 3h_12 min_47 sec[edit]... long, so I was thinking that this movie would definitly need more bitrate (and a bigger file-size ofcourse) just to achieve good quality (I use the 'Didees SixofNine' matrix, guess that should improve things even more ;) ).

Gordianknot gives me a 76% compressibility test result (I believe AQ wasn't enabled in the codec settings, b-frames were at default). Lowering b-vops to 1/1.50/1 might be useful, but I'm not sure on that on.

@Teegedeck:
When encoding anamorphically (no resizing,just cropping)and setting the aspect ratio in mmg to 2.35.1 I end up with a 986x420 resolution movie. Would it be better to use AQ in this case since the resolution has become bigger in width or am I talking complete non-sense here:confused: ?? (source is DVD Pal btw)

sorry for repeatedly asking questions, but sometimes searching the forum just isn't enough..hope you 'll understand.

thanks in advance,
Splashdriver

Teegedeck
6th July 2004, 19:28
Bitrate, resolution, frames per second and duration are all factors that come into play. Compressibility is a good indicator for what you should use. Using high-bitrate matrices gives the most perceptible difference of all options. But with SixOfNine you already use one of the top-notch matrices.

Lowering B-vops probably won't get you far if you want better quality.
Edit: Sorry, I wasn't reading thoroughly at first.

loni_blues
6th July 2004, 19:56
Hi,
Adaptive quantisation gives more benefit for real bitrate constraints, now you're giving the codec enough space to do it's magic without the AQ trade-off.
What would be a recommended bitrate for using AQ?
Thanks,
loni_blues

Koepi
6th July 2004, 20:27
It's not just about bitrate, it's about the movie content itself as well. An underwater movie would most likely suffer from AQ.

I'd recommend using AQ at bitrates below 800-900kbps at 640x272 resolution - but that isn't a qualified value, it's just plain right out of my guts.

Regards
Koepi

Teegedeck
6th July 2004, 20:31
There is no magical figure for that.

It comes down to taste and to the individual movie. It has been shown that AQ can be a bad choice for scenes with darkish-blue backgrounds. That's the only real 'problem sample' we have encountered till now.

Apart from that: If your encode is all q=2 without AQ, then you definitely don't need it. :p But already a bit below that you actually have a difficult choice to make: Do you prefer p-frames constantly fluctuating between q=2 and q=3 or do you prefer having mostly q=2 (but most probably also some q=3) with some MBs in them quantized at q=3 or q=4? I think some frames are bound to look better, some are bound to look worse, it's hard to make a quantitative or even qualitative assessment about the benefits. I go for AQ but that's just me (well, not only me in fact, which is quite reassuring) and I'm mad as a march-hare. :rolleyes:

Splashdriver
6th July 2004, 22:07
@Teegedeck:

I've been lurking for quite a while and if I remember correctly you've done many HQ anamorphic DVD rips (right?) with AQ enabled. Now Koepi's opinion on AQ is to use it on "bitrates below 800-900kbps at 640x272 resolution , although it "isn't a qualified value". Is it safe to conclude that you don't fully support this statement and may I ask why?

Thanks in regard,
Splashdriver

Teegedeck
6th July 2004, 22:31
Excuse me, but which part of "it comes down to taste and to the individual movie" is unclear? At least I haven't made enough tests to help you on this one. I merely stated that I'd go even further than Koepi in saying I can give absolutely no 'do' or 'don't' on this one. I have no proof for a superiority of my personal preference using AQ.

Splashdriver
6th July 2004, 23:28
sorry, I shouldn't have been so stubborn when feeling sleepy:p
yes, you're right..guess I totally missed that part. I'm on a PIII 1ghz, so I'll have to wait quite a few hours to check the final result of the 2nd pass. (should be good quality to back-up though). We'll see :D

lexor
7th July 2004, 01:08
Originally posted by Splashdriver
...but this movie is 13h_12 min_47 sec

13 HOURS? what version do you have? the long promissed Extended (on steroids) version? Thatrical release is only 3 hours, your DVD is 4 times bigger!:eek:

Teegedeck
7th July 2004, 06:49
I regarded it a typo. The bitrate mentioned points to that.

Splashdriver
7th July 2004, 06:52
Stupid typo;)
It should be 3h_12 min_47 sec ofcourse...maybe when they start developing triple-layer DVD-burners and discs one day I'll will get my 13 hours of real DVD quality :D

Lagoon
7th July 2004, 21:05
"@Teegedeck:
When encoding anamorphically (no resizing,just cropping)and setting the aspect ratio in mmg to 2.35.1 I end up with a 986x420 resolution movie."

Something's wrong here, this is NOT anamoprhic but just plain square pixels.

Anamorphic would be 720x420.

Teegedeck
7th July 2004, 21:13
Right. It's not anamorphic but a true 16:9 frame.

SeeMoreDigital
7th July 2004, 21:41
Originally posted by Lagoon
Something's wrong here, this is NOT anamoprhic but just plain square pixels.

Anamorphic would be 720x420. Yep, something is indeed wrong!

When generating anamorphically cropped encodes from DVD sources where the original movies AR is 2.35:1. For NTSC, try using 368 vertical pixels and for PAL, try using 432 vertical pixels.


Cheers

loni_blues
8th July 2004, 03:27
@ Koepi & Teegedeck,
Thanks for the advice!
Regards,
loni_blues

Splashdriver
8th July 2004, 03:50
Seems I got this thing completely wrong overall....:(

Used GKnot for (auto-)cropping the source.....it gave me a resolution of 720x420.....W/H Module=16), since I didn't resize at all I assumed it was equal to anamorphic encoding.
Hitting the Smart Crop left-Right does give me an output of 720x432 in GKnot where the aspect ratio box says 1.667 with 0.0 aspect error. Now is this the thing that you guys are talking about? (sorry for asking real stupid questions, but I'm just really eager to learn)

I'm afraid I've probably wasted 2 long days of stupid encoding:(

SeeMoreDigital
8th July 2004, 09:48
Originally posted by Splashdriver
Hitting the Smart Crop left-Right does give me an output of 720x432 in GKnot where the aspect ratio box says 1.667 with 0.0 aspect error. Now is this the thing that you guys are talking about? (sorry for asking real stupid questions, but I'm just really eager to learn)

I'm afraid I've probably wasted 2 long days of stupid encoding:( First I have to ask.. do you know what anamorphic encoding is because the concept can be difficult to grasp and some explanations are often difficult to understand?

Anyway, with Mpeg2/DVD anamorphic images the 'height pixels' (480 for NTSC and 576 for PAL) have a static shape ie: they are not allowed to stretch or squash but the 'width pixels' (720 for both NTSC and PAL) have a distorted shaped ie: they are allowed to stretch or squash.

However, pixels like being encoded square (in much the same way dots like being round) so if you want them to change shape ie: make them become rectangular, you have to tell them. And this is where the expression PAR (Pixel Aspect Ratio) comes in.

With the XviD codec you will find many PAR values you can set. And once selected, the value will be embedded within the video stream as a signalling code, which in-turn will 'hopefully' be detected and decoded by your media player/direct-show filter.... hopefully!

As I don't use GK so I'm not familiar with the terminologies and expressions they use. However "when you do the math" 720 divided 432 does equal 1.666, so it looks like GK has given you the aspect ratio of the image pixel frame size... which is correct for square pixels.

All you've got to make sure of now is... did you remember to give the pixels a PAR shape?

If you did, then your in business. So all you've got to do now is find a media player (or configure a media player) so that will display your anamorphic encodes correctly. If you're not sure "Don't Panic" because there's a wonderful little tool called MPEG4modifier (http://forum.doom9.org/showthread.php?s=&threadid=78050), that can do this for you now!


Cheers

Splashdriver
8th July 2004, 10:28
Guess I'm a complete dumb-ass on the subject. I was told that encoding anamorphically results in a much bigger width and when using the appropriate player it correctly displays the image on resize (sorry If I'm not so techie on the explaining). Guess I still have a LOT of reading up to do (but that's ok, I like to learn:D )

In the Xvid codec I selected the following:
Pixel Aspect Ratio - select the shape of a pixel...: 16:9 PAL

I guess something is still wrong here since I didn't select 720x432 as my resolution but 720x420 (which is true 16:9 frame as been said). I'll will have a look at MPEG4modifier as soon as possible.

seems like MPEG4modifier doesn't support MKV, which is my favourite container for quite a while now)

PS: I always use Media Player Classic to playback movies and stuff.

SeeMoreDigital
8th July 2004, 11:16
Originally posted by Splashdriver
I guess something is still wrong here since I didn't select 720x432 as my resolution but 720x420 (which is true 16:9 frame as been said). True, 720/420 = 1.71:1 (which is nearly 1.77:1 aka 16:9) but anamorphic encoding does not work like this....

Anamorphic encoding is all about PAR. Which in this case is designed to stretch the width shape (ie: along the 720 axis) of pixels to fill an imaginary 1024 pixel shape (and 1024/432 = 2.37:1 which is as near as damn 2.35:1).

And the reason why 1024 is the imaginary shape to aim for is because 1024/576 = 1.77:1 which is 16:9PAL (which is what you would use if you wanted to generate encodes using square pixels and not anamorphic pixels).

Originally posted by Splashdriver
seems like MPEG4modifier doesn't support MKV, which is my favourite container for quite a while now).... PS: I always use Media Player Classic to playback movies and stuff. I'm an MP4 container fan myself and I'm happy to report that MPC will play anamorphic encodes perfectly as long as you have the necessary DSdec filters installed.

Anyway, here's a download link for 2No short anamorphic test files I've generated for you to try (http://homepage.ntlworld.com/seemoredigital/PAR_crop_tests.zip). They were both encoded using XviD. One is in the .AVI container, the other is in the .MP4 container.

Good luck


Cheers

EDIT: A bit more anamorphic info added

Splashdriver
8th July 2004, 12:00
True, 720/420 = 1.71:1 (which is nearly 1.77:1 aka 16:9) but anamorphic encoding does not work like this.... anamorphic encoding is all about PAR. Which in this case will stretch the shape of the (720 axis) width pixels to fill an imaginary 1024 pixel shape (and 1024/432 = 2.37:1 which is as near as damn 2.35:1).

Actually mmg outputs a 1046x420 resolution when no aspect ratio is selected (input resolution was 720x420). Now, since I wish to do a anamorphically encode, does this mean that I have to do both passes all over again (but this time 720x432 as resolution)??

When selecting an 720x420 file as input in mmg and setting the Aspect Ratio to 2.35.1 it gave me 986x420 file. Though I've been told that that's absolutely not anamorphic it doesn't look distorted at all (to me). It actually even tends to look a bit sharper, don't ask me why.

Thanks for the short files SeeMoreDigital, I'll definitely keep the mp4 file (both have nice quality man!). I did notice one thing. MPC (6.4.8.2) crashes when I try to acces play-> filters. Don't know why, the Avi file doesn't seem to have this problem, since I could acces the FFDshow(29-05-2004) property window with it.
Seems like enabling/disabling Hardware Overlay Mixer in FFDshow doesn't have any effect on resizing.

[edit] How do I change the name of thread (if that's possible)???

SeeMoreDigital
8th July 2004, 12:50
Originally posted by Splashdriver
[edit] How do I change the name of thread (if that's possible)??? Go to your first post, press the edit button and re-enter the 'Post subject'.

Originally posted by Splashdriver
Thanks for the short files SeeMoreDigital, I'll definitely keep the mp4 file (both have nice quality man!). I did notice one thing. MPC (6.4.8.2) crashes when I try to acces play-> filters. Don't know why, the Avi file doesn't seem to have this problem, since I could acces the FFDshow(29-05-2004) property window with it.
Seems like enabling/disabling Hardware Overlay Mixer in FFDshow doesn't have any effect on resizing. I would recommend that you install the latest 3ivX codec, which comes with the correct type of decoder filter, suitable for playing anamorphic Mpeg4 in .MP4.


Cheers

Splashdriver
8th July 2004, 17:45
Name of the post-subject has been changed from now

Stux
10th July 2004, 06:39
Encoding anamorphically is simple.

You crop off the excess image (say black bars), then encode with the right PAR preset.

There's no step 3 ;)

You don't actually have to worry about what actual size you end up encoding, just crop what you need to... perhaps crop a bit more to get the image to multiples of 8, then just encode with the right PAR preset.

Splashdriver
10th July 2004, 07:10
Originally posted by Stux
Encoding anamorphically is simple.

You crop off the excess image (say black bars), then encode with the right PAR preset.

There's no step 3 ;)

You don't actually have to worry about what actual size you end up encoding, just crop what you need to... perhaps crop a bit more to get the image to multiples of 8, then just encode with the right PAR preset.

I remember I read that somewhere (Sorry, can't remember where I read that thing exactly). Assuming I had the right information, I went to Gknot and just cropped of the black bars in the image, ending up with a resolution of 720x420. After that I commented out the resize thing in Avisynth. In the Xvid codec I made sure I set PAR to 16:9. I'm a bit confused here, because I don't think Teegedeck and SeeMoreDigital where saying the same thing that you just said Stux. I definitely need some more light to be shed here.

Thanks

SeeMoreDigital
10th July 2004, 10:57
Splashdriver

Try testing these Mpeg4 PAR 720x432 anamorphic test (http://homepage.ntlworld.com/seemoredigital/PAR_crop_tests.zip) files in both the AVI and MP4 container.

It might help you know what you've got to aim for!


Cheers

D-wizzz
10th July 2004, 13:11
hi.
@ see more,

Your explanations on anamorph encode is very helpfull. i've been reading up on that subject to for a while now.i also like it that it's in a language even i can understand with out getting lost a sea of terms and words.i've seen your test files btw and they look awesome,just out of curiosity which xvid stettings did you use to create those files.



Bye:D

SeeMoreDigital
10th July 2004, 13:28
Thanks D-wizzz,

Don't get too excited, the encode only looks as good as it does because there's very little pixel movement in it.

I reckon your Avatar contains more movement than my encode!

That said, there's nothing special about the settings. It just used XviD's defaults with B-VOP disabled and AS @ L3 Profile selected (not that this is really necessary). Under the 'Aspect Ratio' tab a PAR setting of 16:9PAL was used. And a 2pass VBR encode was generated.

And thanks for confirming that my anamorphic explanation was usefully to you. I've tried many times before to explain this in other threads but sadly it can still be a difficult concept to grasp!


Cheers

D-wizzz
10th July 2004, 13:58
hello again

[QUOTE]I've tried many times before to explain this in other treads but sadly it can still be a difficult concept to grasp!

yes your right. true my reading i've encounterd many explanations on this subject,either on doom or other places.it all comes down to the same thing anyway,but i think some people have more teacher qualities in them than others.;)

youjust have to read and try,and read,and try,and read,and try etc.................

I've read alot of post on different subjects of you and i must say i enjoy reading them for me they are right to the point.KEEP IT UP!!!!

(little tab on the back doesn't hurt,right)

See ya:p

Chainmax
10th July 2004, 14:19
So, is Stux right and it's enough to select 16:9 PAL for 25 fps encodes and 16:9 NTSC for 24 and 30fps encodes in Xvid's "Aspect Ratio" tab? It's not compulsory to use MKV or MP4? I am going to try MKV on my future encodes, but it's nice to know I have a choice.

SeeMoreDigital
10th July 2004, 14:34
Originally posted by Chainmax
So, is Stux right and it's enough to select 16:9 PAL for 25 fps encodes and 16:9 NTSC for 24 and 30fps encodes in Xvid's "Aspect Ratio" tab? It's not compulsory to use MKV or MP4? I am going to try MKV on my future encodes, but it's nice to know I have a choice. Yes, it's always been as simple as this. Ever since 3ivX launched their 'anamorphic encoding' capable codec!

The ecodes work a charm when muxed into the MP4 container. Don't know about MKV though.... I mean, what is the point ;)


Cheers

Splashdriver
11th July 2004, 08:29
I've installed 3ivx (hmmm...quite interesting thing) and it seems that the mp4 file is now correctly resized in MPC (720x432 --> 1046x432) where it previously wasn't (well, to be more accurate, without 3ivx just the 720x432 image was displayed, that's all). Now back to my anamorphic encoding question. I stil think something is wrong in the process, so I will try to explain every step more accurately. I hope someone familiar with Gknot can tell me what I'm doing wrong.

First of all, I open my .d2v in Gknot. Under the 'Input Pixel Aspect Ratio' I set Dislay AR to 1.25 (Source is Pal DVD). Then I go the Crop (Before resize!) part and select Auto-crop W and H-module are both set to 16). Now I end up with a resolution of 720x416 (aspect ratio 1.731 and aspect error -1.2%).
But under the Crop (Before resize!) part it's showing res. 718x420 with a aspect ratio of 1.710.
Good, I now hit Smart Crop Left-Right and resolution now becomes 720x432 with an Aspect Ratio of 1.667 and Aspect Error of -0.6%. Notice that under the Crop (Before resize!) part resolution is now shown as 696x420 with an aspect ratio of 1.657. Hitting Smart Crop All outputs a resolution of 720x416 (aspect ratio 1.731 - aspect error 0.4%), where Crop (Before resize!) says 716x412 with an Aspect ratio of 1.738. Since we like to have 720x432 I just leave it on Smart Crop Left-Right, right???
Time to save the .avs script looking something like this:

# PLUGINS
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\decomb.dll")
mpeg2source("F:\LOTR_The Return of the King\LOTR_The Return of the King.d2v", idct=0)

# CROPPING
crop(12,76,696,420)

# RESIZING
#LanczosResize(720,432)

When opening the script in VDubMod (v.1.5.10.1) under the File -->File information it gave me the following:
http://img43.exs.cx/img43/9784/Avi-inf_VDubmod1.png

Now My question is: Shouldn't I have 720x432 as resolution and why can't Gknot give this resolution without leaving a bit of the black bars in the image (I've been playing with it, but just can't get it right)????

Before I forget: Making mmg extract the aspect ratio information from the MPEG-4 data results in a display dimension of 1012/420....Shouldn't we aim for 1046x432 (like the the short test-files SeeMoreDigital previously posted)???

Sorry for the long post, I hope it's still somehow useful.

thanks in advance,
Splashdriver

Surco
11th July 2004, 11:24
Hi
The problem comes from here
Originally posted by Splashdriver
# RESIZING
#LanczosResize(720,432)

It should looks like

# RESIZING
LanczosResize(720,432)

A typo in your avisynth script i suppose ;)

Bye

EDIT: grammar.

SeeMoreDigital
11th July 2004, 12:37
Originally posted by Splashdriver
I've installed 3ivx (hmmm...quite interesting thing) and it seems that the mp4 file is now correctly resized in MPC (720x432 --> 1046x432) where it previously wasn't (well, to be more accurate, without 3ivx just the 720x432 image was displayed, that's all). Well this makes a good start. At least you can understand the power of the MP4 container over AVI, when it comes to anamorphic decoding!

Originally posted by Splashdriver
Now My question is: Shouldn't I have 720x432 as resolution and why can't Gknot give this resolution without leaving a bit of the black bars in the image (I've been playing with it, but just can't get it right)???? Unfortunately I don't use GK so I can't comment about how well it crops. Or if it's able to crop in a logical manner!

And just to confuse you even more :D, you will also find that not all 2.35:1 movies are exactly 2.35:1. Some are very badly centred. Some contain vertical mattes (aka over-scan mattes). Some, like my Blade Runner DVD are not 2.35:1 at all.

All I can say is that when cropping from a 720x576 anamorphic wide-screen source where the original movies AR is 2.35:1, the number of image pixels should be 432 (to the nearest 16th pixel). And you should not have to resize anything.


Cheers

Splashdriver
11th July 2004, 13:41
Originally posted by Surco
Hi
The problem comes from here

It should looks like

# RESIZING
LanczosResize(720,432)

A typo in your avisynth script i suppose ;)

Bye

EDIT: grammar.

Well Surco, I thought the idea of anamorphic encoding was to NOT do any resizing. That's why I didn't enable resizing in my avisynth script.

@SeeMoreDigital

Your explanations are quite clear and understandable. I'm still wondering why I can't get this thing to work. Maybe it's because the DVD just says 16:9 widescreen and nothing about anamorphic stuff??....

I've seen some anamorphically encoded MPEG-4 files which just resizes correctly and looks amazing too (muxed into a MKV container), so I think I do realize what's the power of anamorphic decoding. MP4 seems nice to me, but to be honest, I don't really see the advantage over MKV. Maybe it all depends on personal preference or it may be me being the ignorant one:D ...I don't know

stephanV
11th July 2004, 13:52
696x420 are the frame-dimension to which you crop and VirtualDub shows that info... i dont understand whats wrong? you should see resolution/frame dimensions seperate from aspect ratio.

SeeMoreDigital
11th July 2004, 13:57
Originally posted by Splashdriver
Your explanations are quite clear and understandable. I'm still wondering why I can't get this thing to work. Maybe it's because the DVD just says 16:9 widescreen and nothing about anamorphic stuff??.... Well I guess you might have a DVD with 4:3 Mpeg2 signalling rather than 16:9!

Can you capture an 720x576 Mpeg2 still frame an upload it please?


Cheers

Surco
11th July 2004, 14:06
Sorry, i read too fast and missed the point my apologies :(

Splashdriver
11th July 2004, 15:09
- Apology accepted Surco;) -

Now, according to DVD2avi the source is 16:9, just like the description
on the back-cover (Guess you're trying to say that this information may not always be as accurate as supposed to..)anyhow....

Here's an example captured with PowerDVD 5:

http://img40.exs.cx/img40/139/PDVD_000.png

Is there something that you can tell from this frame?

[edit]when playbacked the whole picture is obviously stretched horizontally with big black bars above and below the frame. As far as I know, PowerDvd doesn't allow one to capture such a frame, guess it can only capture frames the way it's originally stored on the disc meaning the whole picture in original state seems much more...ehm...squished. I like my encodes to be stretched correctly so objects don't look so large, that's the purpose[edit].

Thanks,
Splashdriver

SeeMoreDigital
11th July 2004, 15:21
Yep,

It is a 16:9 widescreen anamorphic DVD. So there's no problem with your disc!

If it had been an 2.35:1 image with 4:3 Mpeg2 signalling it would have looked like this: -

http://img33.exs.cx/img33/8408/SMD_43_2351_image.jpg

Note how much more matte is contained within the 720x576 pixel frame.


Cheers

Splashdriver
11th July 2004, 15:40
Edited previous post

SeeMoreDigital
11th July 2004, 15:58
Originally posted by Splashdriver
... when playbacked the whole picture is obviously stretched horizontally with big black bars above and below the frame.... guess it can only capture frames the way it's originally stored on the disc meaning the whole picture in original state seems much more...ehm...squished. I like my encodes to be stretched correctly so objects don't look so large, that's the purpose[edit]. What you are seeing is the whole point about anamorphic images!

It's very important that you understand exactly what an anamorphic image looks like prior to correction.


Cheers

gircobain
11th July 2004, 16:16
Originally posted by Splashdriver
# CROPPING
crop(12,76,696,420)

Shouldn't it be crop(0,76,720,420)?
Even though I think you'd be better off with crop(0,76,720,424) (mod8) or crop(0,80,720,416) (mod16)
Then in mmg set aspect ratio to 2.35
Isn't it simple like that? Or maybe I'm overlooking something...

Splashdriver
11th July 2004, 16:59
crop(12,76,696,420)or sometimes (12,76,696,416) is the result of doing a 'smart crop left-right' in GKnot. I've been advised by SeeMoreDigital to aim for 720x432, so that's what I'm trying to do. Unfortunately(?) when I select 720x432 as my resolution in Gknot, Avisynth automatically outputs values that resizes the picture to 696x420/416 (the same as under crop (before resize!) after I hit save (script). Guess I could manually edit the script and enter different crop values. The point is still that I don't wan't any black borders left. When entering manually an aspect ratio (1.667) in GKnot, resolution changed to 720x432, but.....there where still a bit off the black borders left. Cropping them off leads to resolution that's lower than
720x432. I'm a bit puzzled now....

SeeMoreDigital
11th July 2004, 17:07
As I say I'm not familiar with GK but why not try: crop(0,72,720,432). It seems a logical step to me :)


Cheers

gircobain
11th July 2004, 17:11
Well from the screenshot posted by SplashDriver I see that cropping to 720x432 do leave black borders
That's why I'm telling him to aim to either 720x424 or 720x416

Splashdriver
11th July 2004, 17:25
@SeeMoreDigital

Yes, I completely understand what you're saying but that still leaves a little bit of the black borders on both sides of the picture. I'll post a screenshot later

@Gircobain

How can you tell that from a screenshot?

SeeMoreDigital
11th July 2004, 17:34
Originally posted by Splashdriver
@Gircobain

How can you tell that from a screenshot? He can't ;)

Especially as it's a screenshot of the Mpeg2 source and not the Mpeg4 encode!


Cheers

gircobain
11th July 2004, 17:43
Originally posted by SeeMoreDigital
He can't ;)

Especially as it's a screenshot of the Mpeg2 source and not the Mpeg4 encode!


Cheers
I don't get your point
Cropping is done prior to encoding - avisynth decodes the frame, crops then pass it to xvid/divx to encode
imagereader("c:\PDVD_000.png")
crop(0,72,720,432)
That shows that, at least for that frame, there are black borders left at the top and at the bottom if you crop to 720x432
Anyways, if you want to keep the correct aspect ratio for anamorphic (1.666), you gotta crop left and right too. Or bear with a little deviation in the aspect ratio

Stux
11th July 2004, 17:46
You guys are still way over-complicating this

Like I said, there is no step 3

Just crop, then encode with the right PAR preset. PAR stands for Pixel Aspect Ratio.

There are only 4 PAR presets related to DVD

2 for NTSC and 2 for PAL

So, for NTSC 16:9, pick the NTSC 16:9 PAR preset.

Just crop, then encode. There is no scaling, and you don't have to "aim for 720" or "crop to 432" or any of that nonsense

crop, then encode. You do *need* to crop to multiples of 2 though, and you may want to crop to multiples of 8 (or even 16 if you're using a buggy encoder :-P)

That's it.

no step 3 ;)

SeeMoreDigital
11th July 2004, 18:04
Originally posted by Stux
That's it.

no step 3 ;) I think I'll stick with MPEGmediator for a bit longer... I can crop and resize anything with it to any shape!

Easy peesie, lemon squeezie

SeeMoreDigital
11th July 2004, 18:15
No black borders here when cropping to 720x432. Smack on the money!

http://img44.exs.cx/img44/8859/SMD_169_2351_cropped_image.jpg


Cheers

Zhnujm
11th July 2004, 19:14
Maybe im completely missing the point, but you cannot crop the left+right borders and then go back to 720 pixel WITHOUT resizing.
:confused:

There are only 2 solutions:
Leave the resolution at 720 and let the black bars in or crop the bars and leave the resolution whereever it is after cropping.
Both should give a perfect file as Stux already said.

gircobain
11th July 2004, 19:27
Originally posted by SeeMoreDigital
No black borders here when cropping to 720x432. Smack on the money!
There's a difference between cropping that png to 720x432 and cropping all black borders and resizing it to 720x432. That I can do also.

gircobain
11th July 2004, 19:30
Originally posted by Zhnujm There are only 2 solutions:
Leave the resolution at 720 and let the black bars in or crop the bars and leave the resolution whereever it is after cropping.
Both should give a perfect file as Stux already said. [/B]
Another solution is to crop to 704x424 for instance (thus preserving 1.666 AR) since MPEG-4 is far less restrictive when it comes to frame size than MPEG-2

Splashdriver
11th July 2004, 19:34
Here's a example of an image cropped to 720x432 (crop 0,72,720,432):
(Note that resizing has been disabled in the avisynth script, since they say that enabling resizing in your avisynth script for anamorphic encoding would completely defeat the purpose).

http://img25.exs.cx/img25/7124/LOTR_720x432_Example1.png


[EDIT]Guess the bitrate (3026 kBit/s) is high enough, so it wouldn't make a big difference....right??

SeeMoreDigital
11th July 2004, 19:39
Originally posted by Zhnujm
Maybe im completely missing the point, but you cannot crop the left+right borders and then go back to 720 pixel WITHOUT resizing.
:confused:

There are only 2 solutions:
Leave the resolution at 720 and let the black bars in or crop the bars and leave the resolution whereever it is after cropping.
Both should give a perfect file as Stux already said. Agreed :D

And, you can see from Splashdriver's Mpeg2 still capture that there arn't any vertical black boarders anyway!

---------------------------------------------------------------------

So, with regard to how to calculate the correct quantity of image pixels within an PAL DVD's 720x576 "anamorphic pixel frame". First you have to assume that you are going to convert to an "true 16:9 pixel frame". Which means you would end up with 1024x576 pixels.

OK, now we've established that the true width of the frame should be 1024, we can move on to calculating the image pixel heights of the most common movies aspect ratios. Which are as follows: -

1024 divided by 1.77 = 576.0 - Which is no suprise
1024 divided by 1.85 = 553.5 - Or 560 to the nearest 16th pixel
1024 divided by 2.35 = 435.7 - Or 432 to the nearest 16th pixel
1024 divided by 2.40 = 426.6 - Or 432 to the nearest 16th pixel

---------------------------------------------------------------------

So there you go.... Yes, a small bit of matte is remaining with a 2.35:1 cropped image (less than 2 rows of pixels top and bottom) but given that many DVD's images are off centre, this is not such a big problem


Cheers

Splashdriver
11th July 2004, 19:54
Thanks SeeMoreDigital......Think I finally got it...really like your way of explaining...it's been surely a very usefull thread to me with many useful information.....well, time to encode...thank you very much for the valuable knowledge.

Peace,

Splashdriver

SeeMoreDigital
11th July 2004, 20:07
Just for a laugh :D

Here's the worst example of an Film to PAL DVD transfer I have ever seen (it's also the same for the NTSC version).

If I had telecined this I would have been fired. And they call this the 'Directors Cut'... I bet Ridley Scott has never even seen it!

http://img31.exs.cx/img31/9312/SMD_BladeRunner.jpg

It total pants... isn't it?


Cheers

Stux
12th July 2004, 08:57
Originally posted by SeeMoreDigital
Just for a laugh :D

Here's the worst example of an Film to PAL DVD transfer I have ever seen (it's also the same for the NTSC version).

If I had telecined this I would have been fired. And they call this the 'Directors Cut'... I bet Ridley Scott has never even seen it!

http://img31.exs.cx/img31/9312/SMD_BladeRunner.jpg

It total pants... isn't it?


Cheers

Yes, bladerunner is the worst dvd transfer I know of :)

BUT to be fair, it was also one of the first 4 dvds ;) (i believe)

SeeMoreDigital
12th July 2004, 13:27
Originally posted by Stux
Yes, bladerunner is the worst dvd transfer I know of :)

BUT to be fair, it was also one of the first 4 dvds ;) (i believe) Yes, from what I remember it was one of the first PAL (single layered) releases and maybe even one of the first NTSC releases.

I think Waterworld was one of the first dual layered disc's!

Despite this though, there really was no excuse to do such a bad job of mounting and centring the image correctly in the frame. This was basic 'need-to-know' stuff even in 1998/9.

The BladeRunner transfer is so bad you only get around 662 horizontal pixels out of a possible 720 (704 would have been ok). However, when the pixel 'width' is proportionally scaled to 720, the pixel 'height' goes way beyond the maximum 436 pixels.

Thank goodness this was easy to correct when converting to Mpeg4. The image size below is much easier on the eye to watch for the movies 112 minutes: -

http://img26.exs.cx/img26/4475/720x576_720x432.jpg


Cheers

Splashdriver
12th July 2004, 22:45
Originally posted by SeeMoreDigital
1024 divided by 1.77 = 576.0 - Which is no suprise
1024 divided by 1.85 = 553.5 - Or 560 to the nearest 16th pixel
1024 divided by 2.35 = 435.7 - Or 432 to the nearest 16th pixel
1024 divided by 2.40 = 426.6 - Or 432 to the nearest 16th pixel



Cheers

I was just rechecking your calculations, when I think I encountered a miscalculation. Shouldn't the first calculation be 1024/177=578 ? According to my calculator it is (578.531073 to be exact).

Greetings,
Splashdriver

EDIT:a serious typo corrected

gircobain
12th July 2004, 23:23
It is actually 1.7777... = 16:9
1024:(16:9) = 576

Splashdriver
13th July 2004, 00:39
Originally posted by gircobain
It is actually 1.7777... = 16:9
1024: (16:9) = 576

Clear now!

Greetings,
Splashdriver

SeeMoreDigital
13th July 2004, 09:24
Well this is great stuff. You guys are beginning to get the hang of this :)

Yes, 16 divided by 9 is indeed 1.77777 (with as many sevens as you want to shove on the end).

I've had a quick look around but I can't find that all important little dot (.) to put above recurring numbers :(


Cheers

Splashdriver
13th July 2004, 10:21
Hi,

I've just finished my LOTR_The return of the king (720x432) encoding and have a little question (not sure if this question even belongs here)....
When I try to mux with my favourite (mkvtoolnix 0.9.2) muxer, I encountered the following: When letting mmg extract the aspect ratio information from the MPEG-4 data, it sets the display dimension to 1046/432. To my understanding, selecting the PAR in Xvid, should generate some sort of signal (setting the Width to 1024, right?) so that other applications capable of understanding this signal could extract the PAR information. Why is it set to 1046 and not 1024? If I'm understanding this right, aspect ratio is now 1046/432=2.421296

Greetings,
Splashdriver

SeeMoreDigital
13th July 2004, 10:54
Personally I don't know why this happens!

The problem is not exclusive to MK though.

If you generate a 3ivx 16:9PAL cropped AVI encode and play it using Windows Media Player. When you go to - File | Properties, the encodes 'Video Size' will be reported as being 1047x432.

The same happens with XviD and 3ivX 16:9PAL cropped encodes after they've been muxed into the MP4 container and played using 3ivx's DSdec filter....

It's a mystery!

SeeMoreDigital
14th July 2004, 17:25
Following on from my post above.....

There is something you can do so that all your players, third party applications and muxers etc, report less confusing and more logical information.

For a while now, I've been using the following 'custom' PAR settings: -

For 4:3PAL use 16:15
For 16:9PAL use 64:45
For 4:3NTSC use 16:18
For 16:9NTSC use 64:54

You should also find the mattes and the video appears in exactly the same place as the source, when viewed on either a CRT of LCD/Plasma monitor or TV screen.

Anyway, this is what I do when encoding from Mpeg2/DVD or Mpeg2/DVB sources.


Cheers

lordreign
17th July 2004, 17:00
Just a quick question to add to this post... The majority of my DVD's are pal but a have the occasional NTSC one. Obviously the height is different with each (576 and 480). Now I know PAL (576) dvd's are meant to stretch to around 1024 pixels, but I just need clarification on NTSC ones. Because they have a smaller vertical resolution (480), they are meant to be stretched to a lesser resolution horizontally, say around mid 900's or so. This would therefore imply that PAL dvd's allow for slightly more clarity because of the extra pixels. Is this a correct description or is it flawed? If it is flawed would you mind pointing out where.

Cheers Guys

SeeMoreDigital
17th July 2004, 17:19
Hi lordreign,

An 1.7777:1 (16:9) NTSC image with 480 vertical pixels will create a horizontal pixel quantity of 853.3333 (ie: a pixel frame size of 853.3333 x 480)

Technically an PAL DVD with it's 720x576 (414,740 total) pixels frame should offer superior image quality to an NTSC DVD with it's 720x480 (345,600 total) pixels frame. Around 20% more resolution in fact. However an NTSC DVD offers 20% more frames per second than PAL... so the end result is virtually identical.

The above is a very simplified explanation because it does not take into account what happens to an moving image when it's converted to analogue, prior to viewing on a TV screen.


Cheers

Lagoon
17th July 2004, 17:29
Hum NTSC DVDs are actually not offering 20% more frame than PAL, except for non-film. With pulldown it's only displaying 23.976fps.

Sharktooth
17th July 2004, 17:34
Originally posted by SeeMoreDigital
However an NTSC DVD offers 20% more frames per second than PAL... so the end result is virtually identical.

SeeMoreDigital
17th July 2004, 17:38
Originally posted by Lagoon
Hum NTSC DVDs are actually not offering 20% more frame than PAL, except for non-film. With pulldown it's only displaying 23.976fps. Obviously with pulldown the effect is different... but the frames are still all in there... are they not!

EDIT: Jeez, there are not many of us on the forum today! According to Doom9's stats the highest number of users was 861 on 23rd May 2002 at 16:56. I wonder what the lowest number was and for how long?

stephanV
17th July 2004, 17:43
not really... the frames are always constructed via pulldown, which is in principle a reversible proces. so a 23.976 movie carries just as much information as its 29.97 telecined counterpart.

Lagoon
17th July 2004, 17:47
Originally posted by SeeMoreDigital
Obviously with pulldown the effect is different... but the frames are still all in there... are they not!

EDIT: Jeez, there are not many of us on the forum today! According to Doom9's stats the highest number of users was 861 on 23rd May 2002 at 16:56. I wonder what the lowest number was and for how long?

They are, but they aren't displayed AFAIK. It may also that some frames are displayed twice to achieve it. In all case it's not more "fluid" than PAL.

SeeMoreDigital
17th July 2004, 18:01
Originally posted by Lagoon
They are, but they aren't displayed AFAIK. It may also that some frames are displayed twice to achieve it. In all case it's not more "fluid" than PAL. Well, speaking as a PAL land 'liver-inner' I much prefer PAL for films/movies.

Any encoded moving image that requires less telecine work (frame shuffling) has got to be better in the end.


Cheers

manono
17th July 2004, 19:07
Hi-

I don't know if I can add anything or not to this.

In all case it's not more "fluid" than PAL.

Well, yes and no. I'd say that's true if you're comparing 29.97fps .vs 25fps viewed on standard interlaced TV sets. For NTSC people, if you're fortunate enough to have a progressive scan DVD player, and a progressive display set for 48 or 72 Hz, then, as stephanV says, the process is reversed to display 24fps (each frame shown either 2 or 3 times depending). I'm not sure if you're claiming that 25fps is also more fluid than 24fps, but the difference is minute, I would think.

This assumes progressive encoding, with 24fps actually stored on the DVD, with the pulldown and the slowdown applied by the player. If it's film encoded as Interlaced, then some DVD players, and some displays (those with a Faroudja chipset-don't know about others) can perform an "IVTC" on-the-fly, to give you back your 24fps.

But before all you Euro guys get too pleased with yourselves for your higher resolution DVDs, just remember that if the movie was filmed at 24fps, then to convert it to 25fps, the audio (as well as the video) has been speeded up, and as a result you have higher pitched audio, about half a tone higher. This drives some people up a wall.

And if 24fps film was converted to PAL to keep it the same length, then although the audio is OK, the video gets badly screwed up. Depending how the conversion was done, it's either filled with blends, giving you a soft and blurry picture, or a frame has been added every second, in the form of a field every half a second, and there goes your fluid motion. I know there are quite a few DVDs of both types in PAL land.

Splashdriver-

aspect ratio is now 1046/432=2.421296

Open the .d2v in GKnot. Crop away all the black. What's left? I'd bet it's not 2.35:1. It's probably much closer to 2.42:1. Lots of so-called 2.35:1 movies these days are much "narrower" than that. And in fact, for example, 656x272 (non-anamorphic encoded) would be much closer to the true AR, without requiring nearly as much cropping into the video to achieve low Aspect Error, than is 640x272.

SMD-

It's a mystery!

Not a mystery at all. :)

SeeMoreDigital
17th July 2004, 19:33
Originally posted by manono
SMD-

It's a mystery!

Not a mystery at all. :) This is true... it's not! Which is why I decided to detail the PAR settings I use in the next post ;)

If Splashdriver, or anybody else, generated their anamorphic encodes with my settings instead of the current 3ivx or XviD ones. They will find that they'll be greeted with the correct horizontal pixel figures (ie: 1024 instead of 1046/1047) in apps like Matroska's mkvtoolnix 0.9.2 muxer.

And the image will be exactly where it should be.


Cheers

Splashdriver
18th July 2004, 09:17
Cropping away all the black borders left me with an aspect ratio of 1.710 (according to Gordian Knot).
656/272=2.411765
640/272=2.352941

Right??

@SeeMoreDigital

I haven't tried the other PAR settings you posted previously yet. I've allready finished my LOTR encode (finally), but I thinking about redoing it (1 b-frame or maybe no b-frames at all, disabling GMC (seems to cpu-intensive on my PIII 1Ghz) and disabling Trellis (Guess it's good for low-bitrates, but probably not much of a benefit when using a 3000+ bitrate).
I can encode short test-files, using the Custom PAR'S and see how it works out.

Greetings,

Splashdriver

manono
18th July 2004, 11:10
Right??

Wrong. I don't have Return Of The King (waiting for the EE), but I broke out my R1 Two Towers EE and did it and after cropping, it shows as 2.417:1. If you're PAL, then make sure you have PAL anamorphic 16:9 ticked under Input Pixel Aspect Ratio. If NTSC, then tick NTSC anamorphic 16:9.

Look in the upper right, inside the big Crop box, to the right of Aspect Ratio, and to the left of WidthxHeight, to get the correct figure. That encodes nicely for 656x272 (non-anamorphic, if you don't mind Mod 16 resolutions) with an Aspect Error of 0.2% (using the ITU etc. Standard (from the Options Tab)).

Splashdriver
18th July 2004, 11:39
Originally posted by manono
Right??

Wrong. I don't have Return Of The King (waiting for the EE), but I broke out my R1 Two Towers EE and did it and after cropping, it shows as 2.417:1. If you're PAL, then make sure you have PAL anamorphic 16:9 ticked under Input Pixel Aspect Ratio. If NTSC, then tick NTSC anamorphic 16:9.

Look in the upper right, inside the big Crop box, to the right of Aspect Ratio, and to the left of WidthxHeight, to get the correct figure. That encodes nicely for 656x272 (non-anamorphic, if you don't mind Mod 16 resolutions) with an Aspect Error of 0.2% (using the ITU etc. Standard (from the Options Tab)).

I had 1:1 ticked since I'm doing anamorpic encoding (I'm a newbe to this). Source is PAL indeed. Now, when I crop the black bars of (having PAL anamorphic ticked 16:9 ticked under Input Pixel Aspect Ratio) and do a Smart Crop Left-Right for a 656x272 (mod 16) resolution it gave me 2.412 aspect ratio to right of WidthxHeight and an aspect error of 0.3%. I never had the ITU Standard disabled. I guess that's nice, but the goal was to do an anamorphic encoding.

Greetings,
Splashdriver

SeeMoreDigital
18th July 2004, 12:16
Originally posted by Splashdriver
... I guess that's nice, but the goal was to do an anamorphic encoding. If it's your intention to start encoding using such low vertical pixel sizes (such as 272) it's not really advisable or necessary to generate anamorphic encodes, as the total pixel count does not warrant the exercise!


Cheers

Splashdriver
18th July 2004, 13:03
Naah, I did mention before that I'm aiming at 720x432 (Í thought we've discussed this earlier). I've already finished an anamorphic encode (720x432-->1046x432), but I'm going to redo it, this time using different Xvid settings. I've never said that I'm going to use such low vertical pixel sizes (such as 272). I'm just croppping the source picture to 720x432.

Greetings,
Splashdriver

manono
18th July 2004, 19:18
Hi-

I guess that's nice, but the goal was to do an anamorphic encoding.

Sure, encode anyway you want. But my point in having you go through that was to show that when you said earlier "aspect ratio is now 1046/432=2.421296", that it was correct, because LOTR (and many other movies) are wider than 2.35:1, and some few movies, such as the 1959 Panavision Ben-Hur, go up to about 2.75:1 .

SeeMoreDigital
18th July 2004, 19:37
Originally posted by manono
Sure, encode anyway you want. But my point in having you go through that was to show that when you said earlier "aspect ratio is now 1046/432=2.421296", that it was correct, because LOTR (and many other movies) are wider than 2.35:1, and some few movies, such as the 1959 Panavision Ben-Hur, go up to about 2.75:1 . Absolutely... and a point which cannot be said enough!

Splashdriver, I reckon you've got the gist of anamorphic encoding now and a better understanding of the subject!

I think just about everything that can be said has been said in this thread.


Cheers

Splashdriver
18th July 2004, 20:05
@SeeMoreDigital

I've learned so much more thanks to your information (and all the othera ofcourse who have contributed to this thread:cool: )

It's not so easy to get a thorough understanding on the subject, but I've found some useful links which I think might also come in handy for other people besides myself:

http://hkfanatic.com/widescreen/anamorphic/anamorphic.php

http://www.mir.com/DMG/aspect.html

http://gregl.net/videophile/anamorphic.htm

http://forum.doom9.org/showthread.php?threadid=72707&highlight=anamorphic+encoding

http://forum.doom9.org/showthread.php?s=&threadid=54677

Cheers

bond
18th July 2004, 21:06
coming back to the topic, someone recently told me that theora seems to be very smart on the psychovisual side. maybe one of the xvid devs want to have a look at it, as i think that AQ is a nice goodie and could be also useful on high bitrates

izx
21st July 2004, 23:42
On topic again, what's the consensus on enabling AQ for constant Q=2 (GMC, Trellis, MPEG matrix, otherwise default) encodes? (non-underwater, of course). Dealing specifically with old (relatively noise-free, but generally have some grain) B/W movies, I've found (with full encodes) that AQ usually gives a bitrate saving of 7-12%. Differences are noticeable using 2X zoom and subtract on still frames, but otherwise the encodes look good generally. FYI, the movies are enocded as 640x480, and with AQ the avg bitrate is usually between 1800-2500 kbps.

Does AQ affect moving edges, or restrict itself to relatively flat shaded areas?

SiXXGuNNZ
18th August 2004, 23:47
wow, the new Goodfellas disc, this is the very first time ever I have seen a 1.85:1 anamorphic that has no black bars at all. take a look, maybe you guys have ran into discs before like this, but I haven't, and I have encoded about 500-600.

http://home.comcast.net/~sixxy01/Goodfellas_Special_Edition_720x480.png

edit: wow, I actually understand this all now, the frame above 854/480=1.78, I read alot of articles before, but seemoredigital has done what none of the articles have been able to do, make me understand what it all means, thanks mate :D

SeeMoreDigital
19th August 2004, 09:02
Why thanks SiXXGuNNZ,

I guess there will be quite a few DVD's of TV series that were shot in 16:9, and will therefor fill a true 1.77777:1 anamorphic frame. Unlike many film to DVD releases which are 1.85:1.

You've sparked an interest for me now... I'll have to keep a look out for some...


Cheers