View Full Version : Need your help with first anamorphic encode
DigitalDivide
17th January 2006, 03:14
Hi,
I'm encoding my first movie using anamorphic resizing. Howver after reading everything on the forum, I think I'm more confused than ever. So I'm looking for someone to help me out to endode the following movie. I have Red Eye, it's 2:40 Anamorphic, NTSC. I'm using MeGUI, to mkv.
So step 1 go to Tools, AviSynth Script Creator, select my project file.
For Input DAR, I select Custom and do I enter in 2:35?
Check REtain anamorphic resolution and set SAR in Encoder.
AVS Profile just keep at Default?
Click Autocrop, which gives me 60 off the top and 66 off the bottom and 2 off the right.
Go to Output Resolution and select ?? 720?
Resize Filter, not sure what to select here but how about Bicubic Neatrual?
Leave Deinterlace and Noise Filter unchecked.
Mpeg2 Deblocking unchecked.
Do I need Colour Correction checked?
Is that it? I noticed that when I select the Edit tab, it says to "# Set SAR in encoder to 720 : 627"
So now I go to Video and select the AviSynth script, set the output file, set it to mkv.
For Codec set to AVC and here's where I select config and enter in 720:627 for SAR in the Advanced Tab? Is the 627 right?
FYI I usually encode all my movies to about 2GB for a full 2hr movie with the AC3 track.
So do I have this right?
berrinam
17th January 2006, 03:45
2:40 Anamorphic, NTSC.
...
For Input DAR, I select Custom and do I enter in 2:35?
Do you mean 1:2.35? You aren't allowed to enter : in the custom section.
Check REtain anamorphic resolution and set SAR in Encoder.
AVS Profile just keep at Default?
Click Autocrop, which gives me 60 off the top and 66 off the bottom and 2 off the right.
Go to Output Resolution and select ?? 720?
Resize Filter, not sure what to select here but how about Bicubic Neatrual?
Leave Deinterlace and Noise Filter unchecked.
Mpeg2 Deblocking unchecked.
Do I need Colour Correction checked?
A general rule which will get you through quite well: If you don't know whether you should use somethng, leave it at its default value. Anyway, your settings seem fine.
So now I go to Video and select the AviSynth script, set the output file, set it to mkv.
For Codec set to AVC and here's where I select config and enter in 720:627 for SAR in the Advanced Tab? Is the 627 right?Well, if you had checked 'On Save Close and Load to be encoded' in the AviSynth window, you shouldn't have needed to do this. But yes, your settings are right here, as well.
So do I have this right?Yes. But just to make sure, why don't you encode a small sample and see whether it is right. To encode just a little bit, add
trim(0,5000)
to the end of your AviSynth script. You can change the numbers to whatever you want, of course, but the first number is the starting frame number, and the second number is the finishing number.
DigitalDivide
17th January 2006, 04:02
Thanks good to know I have the process down. When I select custom, the 2:35 shows in the box automically. So I guess that's right.
Just curious can I trust the Edit page where it suggests to use
"# Set SAR in encoder to 720 : 627"? Is it usually right?
Also if my movie is 1:85:1 aspect ratio what do I select in the Input DAR, simply 16:9?
berrinam
17th January 2006, 04:15
Just curious can I trust the Edit page where it suggests to use
"# Set SAR in encoder to 720 : 627"? Is it usually right?Would it be in MeGUI if it wasn't usually right?:sly:
DigitalDivide
17th January 2006, 04:25
Would it be in MeGUI if it wasn't usually right?
lol just checking...the reason I ask is because I read so many posts about what to select which seemed kinda odd to me to worry about it if MeGUI already suggests the size.
Anyhow thanks for the input! Much appreciated.
berrinam
17th January 2006, 05:32
lol just checking...the reason I ask is because I read so many posts about what to select which seemed kinda odd to me to worry about it if MeGUI already suggests the size.Yes, it is odd.:D
Anyhow thanks for the input! Much appreciated.It's ok. Maybe you could even give something back by writing a guide based on your findings:sly:
DigitalDivide
17th January 2006, 05:40
Well I'm not there yet, I'm getting the following error when trying to encode
avis[error]: unsupported input format(DIB)
could not open input file d:\projects\Red Eye\Red Eye.avs.
I used the Avisynth Script Creator in MeGUI. It contains the following info.
LoadPlugin("C:\Program Files\GordianKnot\DGMPGDec\dgdecode.dll")
mpeg2source("D:\red.d2v")
ColorMatrix()
#deinterlace
crop(0,60,-2,-66)
LanczosResize(720,352)
Undot()
# Set SAR in encoder to 720 : 627
I usually use Gordian Knot to create my avisynth script then open it up with MeGUI. I've never had any problem. This is the first time I tried creating one using MeGUI. I checked the settings and the path is correct.
Edit: I get the following ouput using Gordia Knot. I noticed that the cropping and resizing are different.
# Created with Gordian Knot
#
# http://gknot.doom9.org
# PLUGINS
LoadPlugin("C:\Program Files\GordianKnot\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\Program Files\GordianKnot\AviSynthPlugins\UnDot.dll")
# SOURCE
mpeg2source("D:\Projects\Red Eye.d2v")
# TRIM
#trim(startframe,endframe)
# IVTC
#Telecide(order=1,guide=1).Decimate()
# or use
#IVTC(44,11,95)
#GreedyHMA(1,0,4,0,0,0,0,0)
# DEINTERLACING (1)
#FieldDeinterlace()
#FieldDeinterlace(blend=false)
#TomsMoComp(1,5,1)
# DEINTERLACING (2)
#KernelDeInt(order=1,sharp=true)
# or maybe
#DGBob(order=1,mode=0)
# DEINTERLACING (3) - special requests
#GreedyHMA(1,0,0,0,0,0,0,0)
#Telecide()
#SeparateFields()
# CROPPING
crop(8,64,704,348)
# SUBTITLES
#VobSub("FileName")
# RESIZING
LanczosResize(672,272)
# DENOISING: choose one combination (or none)
Undot()
berrinam
17th January 2006, 09:13
Well I'm not there yet, I'm getting the following error when trying to encode
avis[error]: unsupported input format(DIB)
could not open input file d:\projects\Red Eye\Red Eye.avs.
It sounds like you are missing Undot.dll in your AviSynth plugins directory. You should take Undot.dll (located in C:\program files\gordianknot\avisynthplugins\undot.dll) and put it in the avisynth plugins dir (normally c:\program files\avisynth\plugins\)
Edit: I get the following ouput using Gordia Knot. I noticed that the cropping and resizing are different.Cropping is surprising, but resizing is expected: firstly, you are going to a different resolution, and secondly, you are doing anamorphic encoding.
Daodan
17th January 2006, 11:48
DigitalDivide, try using the following script (based on the crop settings you got from megui):
# PLUGINS
LoadPlugin("C:\Program Files\GordianKnot\DGMPGDec\DGDecode.dll")
# SOURCE
mpeg2source("D:\Projects\Red Eye.d2v")
# CROPPING
crop(0,60,-2,-66)
Encode this in megui (of course you can add other filters for denoising or smoothing like undot if you want) and save as mkv or mp4. Than after the encoding is finished open the file with mkvmergeGUI, select the video stream and at display width/height put 850/354 and remux under a different name.
I usually use this method because I get confused with those settings in megui. In case you don't understand how I got that aspect ratio, I explain it here: you take the resolution after cropping (in your case 718/354 (2.028)), you take the DAR of 1.77 of the original and the AR (1.5) and make the following calculus:
718/354(2.028).........x
720/480(1.5).....1.7777
and you get x. You multiply x with the height resolution and get 850/354 wich keeps the DAR and doesn't lose res by resizing. I hope I was clear (when I read it it confuses me). The resize settings in megui have no importance since you don't resize, that's the point of anamorphic display.
And one last advice: after the autocrop in megui or gknot you should crop a bit yourself to make the resulting height/width both multiples of 16. It helps compression (but don't leave any black borders).
Benedikt
17th January 2006, 13:49
-> I think it's important to note that you can (and you should) deactivate any resizing filters, because they may affect quality and speed. With anamorphic rips resizing is generally not necessary.
-> Also important is a little bit of "playing" with MeGUIs crop and resizing sliders, because there's some kind of bug in MeGUI: MeGUI only calculates the correct SAR if you adjust the resizing values at least once. Sometimes gives me rather odd results, if I don't change the resizing or cropping values a bit.
DigitalDivide
17th January 2006, 20:54
Hey all, thanks for the help. I will give this another try when I get home from work tonight.
lenouch
17th January 2006, 21:41
A "simple" question :
What is the difference between "Sample Aspect Ratio" set in x264 encoding and "Aspect ratio" set in MKV ?
Instead of applying 2 successives resize (one at encode and one at decode), why not setting encoding SAR is 1:1, and calculate the AR for display (stored in MKV container) ?
Example :
1) for a PAL DVD, native resolution (anamorphic) is 720x576
2) I perform a crop to remove black border : reso is 720x560
In this case, how should I set SAR in x264 and AspectRatio in Matroska ?
SAR=1:1 ?
AR=16/9 ?
Help, I'm very confuse about this ...:confused:
Benedikt
18th January 2006, 00:08
A "simple" question :
What is the difference between "Sample Aspect Ratio" set in x264 encoding and "Aspect ratio" set in MKV ?
Instead of applying 2 successives resize (one at encode and one at decode), why not setting encoding SAR is 1:1, and calculate the AR for display (stored in MKV container) ?
Example :
1) for a PAL DVD, native resolution (anamorphic) is 720x576
2) I perform a crop to remove black border : reso is 720x560
In this case, how should I set SAR in x264 and AspectRatio in Matroska ?
SAR=1:1 ?
AR=16/9 ?
Help, I'm very confuse about this ...:confused:
The SAR would be, I think 2.28571429 (=DAR*height/width)
The relevant SAR parameters for x264* would be 8960:6480. Or, some nicer values to fill in: 112:81.
Put that in the corresponding input boxes and you're fine.
*calculation: 720*16:560*9=1,382716...
DigitalDivide
18th January 2006, 01:23
I explain it here: you take the resolution after cropping (in your case 718/354 (2.028)), you take the DAR of 1.77 of the original and the AR (1.5) and make the following calculus:
718/354(2.028).........x
720/480(1.5).....1.7777
and you get x. You multiply x with the height resolution and get 850/354 wich keeps the DAR and doesn't lose res by resizing.
Okay you lost me here. I can see 718/354 = 2.028 and 720/480 = 1.5. The 1.777 I understand but when you say I get X and I should mulitply it with the height resolution and get 850/354 you lost me. As far as I can see I don't know what X... and I don't know what I'm muliplying it with to get 850/354....I feel dumb but honestly I don't see it...
DigitalDivide
18th January 2006, 03:13
It sounds like you are missing Undot.dll in your AviSynth plugins directory. You should take Undot.dll (located in C:\program files\gordianknot\avisynthplugins\undot.dll) and put it in the avisynth plugins dir (normally c:\program files\avisynth\plugins\)
Tried that but it gave me the same error. The only way I was able to get it was to create an AVS file from Gordian Knot, then modify the file. That works.
However I noticed the following locations for the file.
C:\Program Files\X264
C:\program files\avisynth 2.5\plugins
C:\program files\gordianknot\avisynthplugins
c:\program files\godianknot\dgmpgdec
Not really sure which I should be using but I tried putting the settings to c:\program files\avisynth 2.5\plugins and it still didn't work.
berrinam
18th January 2006, 03:24
Ok, here's the standard thing you do when an avisynth script doesn't load: open it with VirtualDubMod. It will tell you what the error is (almost all of the time), and then you can go about remedying it. I was just making a guess, but it seems it didn't work.
DigitalDivide
18th January 2006, 04:26
Okay figured out the error. I had two project files and it was looking for the wrong one.
I fnished encoding a small test. To be honest I don't see any difference between it using the SAR and the same movie I encoded without the SAR. Should I be able to see a difference?
lenouch
18th January 2006, 09:18
The SAR would be, I think 2.28571429 (=DAR*height/width)
The relevant SAR parameters for x264* would be 8960:6480. Or, some nicer values to fill in: 112:81.
Put that in the corresponding input boxes and you're fine.
*calculation: 720*16:560*9=1,382716...
Ok. So, I have to enter SAR=8960:6480 in meGui.
1) From a technical point-of-view, is SAR just a flag in the encoded stream or is there an internal resize in x264 before encoding ?
2) In this case (SAR=8960:6480), what is the value I have to enter as DAR ? 16:9 again, or 1:1 because AR is "managed" in x264 stream ?
This is definitly confuse for me :(
Daodan
18th January 2006, 11:16
Okay you lost me here. I can see 718/354 = 2.028 and 720/480 = 1.5. The 1.777 I understand but when you say I get X and I should mulitply it with the height resolution and get 850/354 you lost me. As far as I can see I don't know what X... and I don't know what I'm muliplying it with to get 850/354....I feel dumb but honestly I don't see it...
That X is the display aspect ratio of your encoded movie (2.4 in your case). You should be able to see an increase in the image quality (if you use a high enough bitrate, otherwise that extra resolution will only lead to blocking). At least in PAL dvds the difference is very clear (but here the loss of height resolution is much bigger at resizing than in the case of NTSC). Of course this anamorphic thing was made mostly for widescreens but in the case of monitors the resolution is big enough to take advantege of this even if they aren't widescreen.
Ok. So, I have to enter SAR=8960:6480 in meGui.
1) From a technical point-of-view, is SAR just a flag in the encoded stream or is there an internal resize in x264 before encoding ?
2) In this case (SAR=8960:6480), what is the value I have to enter as DAR ? 16:9 again, or 1:1 because AR is "managed" in x264 stream ?
Yes, it's just a flag, otherwise this hole anamorphic thing would be almost pointless. Let's say you have a PAL dvd with no borders in 16:9. To keep the hole details you should resize to the enourmous size of 1020/576 wich would take a lot to encode and a lot to decode. In case of anamorphic the decoded resolution is 720/576.
For question number 2 I'm not sure what you mean, you use either SAR OR DAR because they are related (height/width=SAR/DAR). (As I said before, it's less confusing if you just enter the DAR in matroska muxer after making an encode without resizing).
lenouch
18th January 2006, 11:47
Thanks, it's more clear for me :)
In my case, anamorphic resolution is 720x576 => DAR is (576x16)/(720x9) = 9216/6480 = 64/45 = 1.422
Then, according to your last sentence, it's not necessary to modify SAR in x264 encoding (keep 1:1), but I have to set 64/45 (in mkvmerge. Fine ?
In this case, decoder will decode my movie as 720x576, but will stretch it to display as (720*1.422) x 576 = 1024 x 576. Is that right ?
Daodan
18th January 2006, 12:56
Hmm, it looks right but it's somehow wrong. Let's try and keep it simple, lets' forget about SAR and use only DAR.
So you don't have any cropping so in your case is simple, you know that your final image should be 16:9 (1.77). Just multiply this to the height res and you get 1020. So put 1024/576 in mkvmerge and that's it. If you put that 1.42 the image will be too vertically stretched. (1.42 is multiplied with the vertical resolution not the horizontal one).
lenouch
18th January 2006, 15:28
I made an attempt. That works:)
Your last explanation was clear and simple. Thanks
Benedikt
19th January 2006, 00:35
Hmm, it looks right but it's somehow wrong. Let's try and keep it simple, lets' forget about SAR and use only DAR.
So you don't have any cropping so in your case is simple, you know that your final image should be 16:9 (1.77). Just multiply this to the height res and you get 1020. So put 1024/576 in mkvmerge and that's it. If you put that 1.42 the image will be too vertically stretched. (1.42 is multiplied with the vertical resolution not the horizontal one).
What about just setting an aspect ratio of 16/9 in Matroska (mkvmerge)? At least that's what I'm doing and it works just fine! Isn't that easier?
Daodan
19th January 2006, 11:06
Well, now that you mention it, it is. I guess it's just a habit, since usually one has also to crop you have to recalculate the new resolution, so in that case it's easier to use the resolution.
DigitalDivide
21st January 2006, 23:28
I was able to encode Red Eye using the SAR of MeGUI and the suggested settings in MeGUI's Avisynth Script Creator and suggest SAR values. However when I used the same process to encode Reservoir Dogs the final output is ...not sure how to describe it...noisy/busy..very unwatchable. So I removed the SAR values from the config and tried again. This time it came out nice and clean. Not sure why?? Here's what I did.
Reservoir Dogs 2:35 anamorphic NTSC DVD.
- Input the d2v project
- Input DAR - Custom - 2:35
- Retain Anamorphic check box is ticked
- Auto Crop, which resulted in 56 off the top, 60 off the bottom, 2 both left and right.
- Output Resolution back to 720.
These are the values on the Edit tab
crop(2,56,-2,-60)
LanczosResize(720,368)
#denoise
# Set SAR in encoder to 720 : 599
I set the SAR in the AVC config to 720 and 599 and encoded the movie which as stated above came out horrible.
Any help would be appreciated as I have no idea why this didn't work.
DigitalDivide
22nd January 2006, 18:11
DigitalDivide, try using the following script (based on the crop settings you got from megui):
# PLUGINS
LoadPlugin("C:\Program Files\GordianKnot\DGMPGDec\DGDecode.dll")
# SOURCE
mpeg2source("D:\Projects\Red Eye.d2v")
# CROPPING
crop(0,60,-2,-66)
Encode this in megui (of course you can add other filters for denoising or smoothing like undot if you want) and save as mkv or mp4. Than after the encoding is finished open the file with mkvmergeGUI, select the video stream and at display width/height put 850/354 and remux under a different name.
I usually use this method because I get confused with those settings in megui. In case you don't understand how I got that aspect ratio, I explain it here: you take the resolution after cropping (in your case 718/354 (2.028)), you take the DAR of 1.77 of the original and the AR (1.5) and make the following calculus:
718/354(2.028).........x
720/480(1.5).....1.7777
and you get x. You multiply x with the height resolution and get 850/354 wich keeps the DAR and doesn't lose res by resizing. I hope I was clear (when I read it it confuses me). The resize settings in megui have no importance since you don't resize, that's the point of anamorphic display.
And one last advice: after the autocrop in megui or gknot you should crop a bit yourself to make the resulting height/width both multiples of 16. It helps compression (but don't leave any black borders).
__________________
I also tried the method above but obviously using different numbers for the new movie. Same problem I don't get a clear picture. So what am I doing wrong?
Daodan
23rd January 2006, 12:39
Hard to say what the problem is. Use ChopperXp to cut a little part of your vob and use the following script:
LoadPlugin("C:\Program Files\GordianKnot\DGMPGDec\dgdecode.dll")
LoadPlugin("C:\Program Files\GordianKnot\DGMPGDec\Undot.dll")mpeg2source("D:\something.d2v")
Undot()
# CROPPING
crop(8,64,-8,-64)
Without anything else (like resize). And than remux in mkvmerge using for video : 830/352. As I said before, it's best to have after cropping res that multiply by 16, but not that big. Anyway, try this and in case it turns bad also, upload somewhere the test vob and also the encoded results. (www.savefile.com lets you upload files smaller than 50 mb).
iceborne
24th January 2006, 23:49
Hard to say what the problem is. Use ChopperXp to cut a little part of your vob and use the following script:
LoadPlugin("C:\Program Files\GordianKnot\DGMPGDec\dgdecode.dll")
LoadPlugin("C:\Program Files\GordianKnot\DGMPGDec\Undot.dll")mpeg2source("D:\something.d2v")
Undot()
# CROPPING
crop(8,64,-8,-64)
Without anything else (like resize). And than remux in mkvmerge using for video : 830/352. As I said before, it's best to have after cropping res that multiply by 16, but not that big. Anyway, try this and in case it turns bad also, upload somewhere the test vob and also the encoded results. (www.savefile.com lets you upload files smaller than 50 mb).
so basically you're saying encode the video source in 1:1 dar then tell mkvmerge to output the file at 16:9?
DigitalDivide
25th January 2006, 05:36
I see it mentioned that resizing is not needed when doing anamorphic encodes, and yet when using MeGUI to create an avi script for anamorphic encodes, it does put in a LancosResize(x,y). Should this be removed or does MeGUI just ignore this?
I'm a little confused which DAR to select in MeGUI for the following
1.85 anamorphic - I'm assuming I should just select 16:9?
2:35 anamorphic - select custom and enter in 2:35
2:40 anamorphic - select custom and enter in 2:40
1.78 anamorphic - select custom and enter in 1:78
Fullscreen 4:3 movie ??
MetalPhreak
25th January 2006, 09:02
@DigitalDivide
I think you should remove the LanczosResize part and just crop to a mod16 resolution, although I don't think mod16 is a must - just better. Resizing might be prefferable if you cannot just crop without cropping away too much of the actual movie itself. (This is personal taste, you have to do it the way you prefer).
Now the SAR settings - you're making it too complicated. You don't have to worry about 1.85 vs 2:35 etc. (I think, don't trust me too much, wait for someone else to confirm before doing it). Just use the following and you should be set:
PAL 4:3 DAR = 16:15
PAL 16:9 DAR = 64:45
NTSC 4:3 DAR = 8:9
NTSC 16:9 DAR = 32:27
Note, I don't think these values are going to be accurate if you resize(difference should be negligible though)
(Just read that you're talking about DAR, but I assume since it's in MeGUI you meant SAR setting of x264?)
Daodan
25th January 2006, 11:30
so basically you're saying encode the video source in 1:1 dar then tell mkvmerge to output the file at 16:9?
Yes, that's almost what I'm saying, only in his case is not 16/9 anymore because he needed to crop the black borders, so 2.35.
DigitalDivide, the input DAR should be 16:9 in your case (so what the original dvd looks like, what dgindex tells you). So if you really don't want to use my method with mkvmerge but want to use SAR in x264, fine, this is what you should do: delete the resize from that avs, I'm not sure that megui afterwards will ignore it, I don't see any reason why, that resize will already give you the normal aspect ratio, so if you change also the SAR, it will look too flattened. So after you cut that line, load the avs, in x264 config put in sample aspect ratio 1.175:1. Now encode. Unfortunately I'm not able at the moment to test this (I never used this sar thing in x264, but always dar in mmg) but it should work.
DigitalDivide
25th January 2006, 15:31
Originally Posted by MetalPhreak
@DigitalDivide
I think you should remove the LanczosResize part and just crop to a mod16 resolution, although I don't think mod16 is a must - just better. Resizing might be prefferable if you cannot just crop without cropping away too much of the actual movie itself. (This is personal taste, you have to do it the way you prefer).
Now the SAR settings - you're making it too complicated. You don't have to worry about 1.85 vs 2:35 etc. (I think, don't trust me too much, wait for someone else to confirm before doing it). Just use the following and you should be set:
PAL 4:3 DAR = 16:15
PAL 16:9 DAR = 64:45
NTSC 4:3 DAR = 8:9
NTSC 16:9 DAR = 32:27
Note, I don't think these values are going to be accurate if you resize(difference should be negligible though)
(Just read that you're talking about DAR, but I assume since it's in MeGUI you meant SAR setting of x264?)
Actually I was referring to the DAR selection box in MeGUI which needs to be set when you use the avisynth script creator. You have to select an option from the drop down box. The choices in the box are 4:3, 16:9, 1:1, and Custom.
So when I have a DVD and use the avisynth script creator which DAR do I select for the following options?
1.85 anamorphic DVD- I'm assuming I should just select 16:9?
2:35 anamorphic DVD- select custom and enter in 2:35?
2:40 anamorphic DVD- select custom and enter in 2:40?
1.78 anamorphic DVD- select custom and enter in 1:78?
Daodan
25th January 2006, 16:08
If you read more carefully you should see right at the beginning:
"DigitalDivide, the input DAR should be 16:9 in your case (so what the original dvd looks like, what dgindex tells you when you preview the vob)"
DigitalDivide
25th January 2006, 17:01
If you read more carefully you should see right at the beginning:
"DigitalDivide, the input DAR should be 16:9 in your case (so what the original dvd looks like, what dgindex tells you when you preview the vob)"
So you are saying no matter what 1.85, 2.35, 2.40 if 16:9 then always select 16:9 DAR? Sorry if i need this spelled out but I just want to make sure.
Also the only reason I'm not really into using your method is really only because I want to configure this all in one shot, let it run overnight so when I come home it's all done. To be honest I'm still not exactly sure how to correctly work out the SAR. I've read a number of threads and still am totally confused. MeGUI makes it simple since it tells me what to input for SAR.
Daodan
25th January 2006, 17:46
First of all, yes, you put 16/9 no matter what (or 4/3 of course), I never saw an original DVD that wasn't either 16/9 or 4/3. (in case is not clear is about the DAR of INPUT so the original vob, before cropping, encoding or whatever)Second, I am unable to test the automatic creation of avs in the latest megui (the one using .net 2.0), because for some reason it crashes no matter what I do (when I try to make a d2v, when i try to load a d2v, etc). I have all the necessary things, and the megui using .net 1.1 works just fine, but that doesn't have the SAR settings and all.
DigitalDivide
25th January 2006, 20:05
Bond, can you confirm to me whether or not I need to include the resizelanzos(x,y) in the avisynth script when doing an anamorphic encode? It was mentioned that you don't need it however I noticed that the avisynth creator in MeGUI includes it when creating an anamorphic encode. So I'm not sure does MeGUI just ignore it, does it actually require it, or should I remove it?
Daodan
27th January 2006, 11:59
Ok, so i got it working finally. Here are my results: you were right about using 2.35 in that case, not 16/9 as I said. I think this part of megui still needs improvement, since this automatic sar stuff doesn't help much since you already have to calculate the dar yourself (what's one extra calculation?). The input dar should logically be 16/9, and based on the cropping you make it should calculate the SAR.
But it is not the case. So you still have to calculate the DAR you want for the final encode, put that in 'input dar', check 'retain anamorphic...', it SUGGESTS a resolution (usually something with horizontal res of 640), and after cropping and all that it sais in the avs what should you put in the SAR field in megui (the x264 config). You should note that somewhere, delete the resize line in the final avs, and use that resolution in the SAR field as said before (it doesn't matter if you changed the resolution, that SAR resolution it's an aspect ratio, not an actual resolution, so you can use it no matter if you resize or not). Now, you don't actually have to delete the resize, only if you WANT to, but usually the purpose of anamorphic is to keep the original resolution for maximum quality. If you use low bitrates it's still better to use nonanamorphic, resized. I hope it's now pretty clear.
As for the way that sar calculation is implemented I think I should write about it in the megui thread, it only confuses people and is not of real help either.
mgh
27th January 2006, 14:03
see
http://www.mir.com/DMG/aspect.html
DigitalDivide
27th January 2006, 19:27
Daodan,
I'm telling you this is getting more and more confusing. Here's what I did from the first page.
DVD 2.35 (maybe actually be 2.40 but not sure at the moment) NTSC
Went to Tools, AviSynth Script Creator, select my project file.
For Input DAR, I select Custom and entered in 2:35.
Checked "Retain anamorphic resolution and set SAR in Encoder."
AVS Profile kept at Default.
Click Autocrop, which gives me 60 off the top and 66 off the bottom and 2 off the right.
Then went to Output Resolution and bumped up the width back to 720 and it automatically sets the height to 354.
It then suggests to "# Set SAR in encoder to 720 : 627"
So my avisynth script I have
Lanzosresize(720,354)
And in the AVC config I set SAR to 720:627.
According to Berrinam, this was correct. I just want to confirm if this is correct? If not is there not a simple straight forward way to determine what the SAR should be if a movie is 2.35 or 1.85? I’m getting so confused I think I may forget about anamorphic encodes.
The other issue is if I have a movie that is 1:85 A/R, instead of selecting Custom 2.35 for DAR, do I instead select 16/9?
berrinam
28th January 2006, 02:16
DVD 2.35 (maybe actually be 2.40 but not sure at the moment) NTSC
Went to Tools, AviSynth Script Creator, select my project file.
For Input DAR, I select Custom and entered in 2:35.Ok, sorry that I might have given you incorrect instructions originally. I think Daodan may be right about this -- although your DVD plays as 2.35, the actual aspect ratio of it is 16:9, and it reaches 2.35:1 by adding black borders. So, in the AviSynth script creator, you should select 16:9, not custom.
Click Autocrop, which gives me 60 off the top and 66 off the bottom and 2 off the right.
Then went to Output Resolution and bumped up the width back to 720 and it automatically sets the height to 354.Doing the calculations by hand, this seems right:
Your video: 720x480
Cropping 60+66=126 from the height gives 480-126=354, which happens to already be mod16
Cropping 2 of the width gives 718, which is rounded to the nearest multiple of 16.
This is the bit which may have been affected by selecting the wrong input DAR:
It then suggests to "# Set SAR in encoder to 720 : 627"
Never worry, we can redo the calculations here, just so that everyone can see them and verify them:
Your video height is 354, so when you are displaying the video, you will want the width to be 2.35 times that (if you are convinced it is 2.40, do the same calculations just replacing 2.35 with 2.40)
So, display height = 354*2.35 = 831.9 = 832 (close enough)
So, when displaying it, we want to stretch the 720 pixels of width we currently have to fill the size of 832 pixels. This is where the SAR signalling comes in. Basically, you can look at SAR as the amount to stretch the pixels horizontally. So, the SAR should be 832 / 720, or 832 : 720
Disclaimer: this is just theory. Please check with a small sample before doing the whole encode, to see if I am right
So my avisynth script I have
Lanzosresize(720,354)So that's right
According to Berrinam, this was correct. I just want to confirm if this is correct?The best way to confirm is to make a short sample and see if it is.
If not is there not a simple straight forward way to determine what the SAR should be if a movie is 2.35 or 1.85? I’m getting so confused I think I may forget about anamorphic encodes.Yes, it is especially confusing because of all the different standards there are for signalling.
DigitalDivide
28th January 2006, 17:45
Your video height is 354, so when you are displaying the video, you will want the width to be 2.35 times that (if you are convinced it is 2.40, do the same calculations just replacing 2.35 with 2.40)
So, display height = 354*2.35 = 831.9 = 832 (close enough)
Shouldn't this read Display Width = 354*2.35 =832 not Display Height?
So, when displaying it, we want to stretch the 720 pixels of width we currently have to fill the size of 832 pixels. This is where the SAR signalling comes in. Basically, you can look at SAR as the amount to stretch the pixels horizontally. So, the SAR should be 832 / 720, or 832 : 720
Shouldn't this read 832:354? 720 was the original width not the height? Whenver I use MeGUI I've never had a SAR suggested where the width is greater than 720. When I Autocrop and then put the Width back to 720, MeGUI always has the SAR as 720:xx
Also I checked the log file and found the following in it.
Track 1 of 'D:\Projects\Red Eye\Red Eye.mkv': Extracted the aspect ratio information from the MPEG-4 layer 10 (AVC) video data and set the display dimensions to 844/352.
berrinam
29th January 2006, 00:35
Shouldn't this read Display Width = 354*2.35 =832 not Display Height?Yep, my bad.
Shouldn't this read 832:354?Nu-uh. Here's the simplest explanation as I see it, for SAR (which is DIFFERENT from DAR, PAR): SAR is really a fraction: SarX / SarY. The way the player treats this fraction is by multiplying it by the width (720) to get the display width. It leaves the height the same. If you think of it that way, you should see that my calculations are correct.
720 was the original width not the height? Whenver I use MeGUI I've never had a SAR suggested where the width is greater than 720. When I Autocrop and then put the Width back to 720, MeGUI always has the SAR as 720:xxYeah, I've started looking at MeGUI's AR handling again, and it seems to be quite wrong. It is perfect when there is no cropping, but it has some quite serious bugs when there is cropping, which messes it all up. I've rewritten its algorithm, and I am testing it at the moment. It seems to be giving the same results as my manual calculations, so I'm testing now to see whether they look right when they play back.
Also I checked the log file and found the following in it.
Track 1 of 'D:\Projects\Red Eye\Red Eye.mkv': Extracted the aspect ratio information from the MPEG-4 layer 10 (AVC) video data and set the display dimensions to 844/352.I'm not sure where that is a log from, but it seems correct, by the sound of it.
DigitalDivide
29th January 2006, 01:35
I'm not sure where that is a log from, but it seems correct, by the sound of it.
That was the MeGUI log file which resulted from my encode using the parameters on the first page. So even though I entered in the SAR on the first page as indicated, the log file indicates the Aspect Ratio as per above.
berrinam
29th January 2006, 09:37
That was the MeGUI log file which resulted from my encode using the parameters on the first page. So even though I entered in the SAR on the first page as indicated, the log file indicates the Aspect Ratio as per above.Of course, the important question is 'does it work'? But other than that, I'll just say -- wow, magic; it works when I didn't expect it to. Most bugs tend to be the other way round:D
iceborne
29th January 2006, 10:14
digitaldivide,
why is there a discrepancy between which display height you set. 354 or 352.
if its 352, then the sar given by megui (720/627) is the same ratio as 827*:720.
*calc -->352 height X 2.35 =827.
so i'm thinking there is nothing wrong with megui's sar suggestion. i've never ran into any ar bugs in all my encoding days
Daodan
30th January 2006, 11:37
As I already said, megui calculation of sar is (almost) useless since:
1.it confuses people with the input DAR (which should be 16/9 or 4/3 but instead it actually wants the output DAR (in DigitalDivide's case 2.35)), since rarely will be no cropping.
2.it doesn't actually help much since you already have to calculate DAR yourself so knowing the final resolution you have one extra calculation to make for the SAR (this is what actually megui does).
3.you're better off calculating the SAR or DAR yourself (SAR for input in the x264 config or DAR in mkvmerge).
Wilbert
30th January 2006, 13:07
I guess i need to install MeGui to see what it is doing, and tell doom9 to correct his gui. The reason is that the way you talk about DAR and SAR in this thread doesn't make any sense. For DAR you should have the choice between 1x1, 4x3 and 16x9. Other choices shouldn't exist. SAR or 'Sample Aspect Ratio' means PAR (at least when talking about AVC streams). Thus a selecting a SAR of 720xsomething when your final encoding should have a PAR of 1:1 doesn't make any sense.
Daodan
30th January 2006, 13:35
I guess i need to install MeGui to see what it is doing, and tell doom9 to correct his gui. The reason is that the way you talk about DAR and SAR in this thread doesn't make any sense. For DAR you should have the choice between 1x1, 4x3 and 16x9. Other choices shouldn't exist. SAR or 'Sample Aspect Ratio' means PAR (at least when talking about AVC streams). Thus a selecting a SAR of 720xsomething when your final encoding should have a PAR of 1:1 doesn't make any sense.
Fisrt of all I'm gonna ulpoad a bit of an anamorphic encode of mine that has a DAR of 1.88 (1.88:1) so different than 16/9, 4/3, 1:1 (to playback correctly you must have enabled overlay mixer in both ffdshow and your player (mpc recommended)). The link:http://www.savefile.com/files/5028954
I don't understand why you say only those are possible dars? (it's about output not input, in case of input you are perfectly right). And who said that final PAR has to be 1:1? That's the whole point, no, of anamorphic, that the PAR is not 1:1.
Doom9
30th January 2006, 13:56
Fisrt of all I'm gonna ulpoad a bit of an anamorphic encode of mine that has a DAR of 1.88 (1.88:1) so different than 16/9, 4/3, 1:1Uh.. that does make no sense. DVD, DVB, ATSC and ISDB all know 4 DARs, the 3 Wilbert listed and another one nobody uses. What you're refering to is the aspect ratio of the movie.. there's no standard for that. DAR gives the aspect ratio of the playback device.. not the aspect ratio of the actual video.
The ITU people created a real mess with all these terms though. Basically if we had a horizontal stretch factor and that's it, things would be so much simpler. Leave it up to telephony people to create a mess in an area they should've never touched..
Daodan
30th January 2006, 14:10
Yes, you are perfectly right, that's what I've been struggling to say here. There is input (the original dvd) and output (the encoded movie). So the problem in your megui is that for input aspect ratio it actually wants the output one, and from here all the trouble people have understanding how it works. In my opinion this is how megui should work: you put input dar (usually 16/9), you use autocrop (or manual crop), and from that cropping megui should calculate that sar thing. However, megui leaves the same thing for sar no matter what you crop (because basically it requires from the beginning the desired dar). Ouf, I hope I made myself understood this time.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.