View Full Version : Accurate MPEG-Resizing with FitCD
snowbeach
26th June 2003, 13:15
I am really clueless where to post this question, but hopefully I am right at this place here.
I want to encode a movie with CCE 2.67.00.10, but I want to encode only the film and not the black borders too. That is why I crop it first and add the borders afterwards. (My goal is DVD2DVD+R!)
To the source I have - using FitCD v1.1.2:
NTSC Anamorphic (16:9) 720x480
Film Pixel 712x348 - 4 left border, 66 top border (The Film pixel I got from GKnot, when resizing.)
Blocks TV-overscan = 1 -> resulting error: 0%
I think the rest of the values is self-explaining, when looking at the script.
The avs script suggested by FitCD looks as follows:
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
LanczosResize(704,352,12,66,696,348)
AddBorders(8,64,8,64)
ConvertToYUY2()
But I want to have the original cropped as it is and from my logic the avs script should look as follows:
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
LanczosResize(712,348,4,66,712,348)
AddBorders(4,66,4,66)
ConvertToYUY2()
I am really clueless, when should I use Block TV-Overscan? What would be the aspect error with my script? Which is better to use: My script or FitCD created script?
gerti67
26th June 2003, 15:23
Hi snowbeach,
uhh, how to start? You know, the whole resizing topic is not easy to explain or to understand it takes a little time. ;)
To your question(s):
1. If you only want to crop because you want to speed up the encoding step then your script is of course correct.
2. You can use the TV-overscan option in FitCD to blank those areas that are not visible when watching your DVDs on your TV with solid black to save some bitrate and to allocate it to the visible parts - every TV has this overscan area and it is usually 16 "Pixels" on all edges - but this can differ dependig on your TV set. Rule of thumb in this case: "Don't encode things (and waste bitrate on it) you will not see later on your TV."
You can see what is usually "hidden" in the TV overscan area when watching your DVDs on your PC with a software player - watch closely for details at the left and right edges for example. And now watch the same DVD on your TV - you will see the difference.
What makes FitCD's calculation sometimes appear wrong is the fact that FitCD tries to resize the motion area of the movie (you set this with the film pixel values) to make it fit right into the visible part of your TV according to your TV-overscan setting.
It is usually safe to use 2 blocks of TV overscan - each block means 16 "Pixels" width (according to macroblock dimensions) - FitCD is a bit unclear in this case it should better be called rows and columns instead of just blocks.
3. If you don't want any additional resizing then your script is the one to favour - as this minimal resizing in the case will do no good concerning the picture. And the aspect error of your script is also 0% - so no worries.
HTH,
Gerti
snowbeach
26th June 2003, 17:16
thanks for the fast answer.
i just want to encode the entire film and do not want to waste bitrate for the black borders. that is why i crop at this step. in fact i just want to leave the dvd as it is, without cropping the picture or at least resizing it to a smaller picture (although it is only minimal).
last question, because i am just a bit confused and i just want a confirmation - i never encoded with MPEG-2 before, AddBorders para means that just black borders will be added to the film, they are not encoded, the bitrate in CCE was only used for the film. Right?
gerti67
26th June 2003, 23:51
Hi snowbeach,
no, that's wrong. For sure the black borders are encoded but they don't need much bitrate and so the saved bitrate can be allocated to other parts - but this works only if a complete macroblock is solid black then the encoder will just encode something like a flag called "skip macroblock" into the bitstream - this really saves some bitrate. But again, this only works if a macroblock is completely black.
In MPEG encoding it is fundamental to only encode what is changing and for the motion estimation algo and other reason a picture is divided into macroblocks of 16x16 "pixel" - and so a 720x480 video picture contains 45x30=1350 macroblocks. And now you can see why you'll onla save some bitrate if you're cropping on macroblock boundaries. With your script you will not save any bitrate because to achieve this you have to crop a complete macroblock column left and right of 16 "pixels" width. And don't be afraid, you will not see this on your TV set because it is hidden in the TV overscan area - that's the trick it is all about.
So your sript should look like this:
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
LanczosResize(688,348,16,66,688,348)
AddBorders(16,66,16,66)
ConvertToYUY2()
This adds solid black borders on the left and right you will not see when watching on your TV - only on your PC monitor because it does not have a TV overscan area nor does it emulate one when displaying your movies.
And now a step further, if you slightly shift up the picture now and add 64 lines on the top and 68 lines at the bottom instead of 66 on each, you achieve that the top row of the motion area is also aligned to macroblock boundaries and you only have the bottom macroblock row now not completely filled with picture information - you know high contrast edges are very demanding concerning bitrate - so this will be slightly better.
Thus a fully optimized script reads like this:
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
LanczosResize(688,348,16,66,688,348)
AddBorders(16,64,16,68)
ConvertToYUY2()
In every case you have to encode a picture that is 720x480 to keep up the DVD standard. Or you can just crop 8 "pixels" from the left and right and encode your picture to 704x480 which is also fully DVD compliant and your script would look like this:
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
LanczosResize(704,348,8,66,704,348)
AddBorders(0,64,0,68)
ConvertToYUY2()
So you saved on complete column of macroblocks now. I would go for the second script I gave you in this thread.
Hope you're not totally confused now, as this topic is very hard for beginners to undestand.
Greetz,
Gerti
snowbeach
29th June 2003, 14:04
thanks. easy. :D got it. would i see any quality differences in the picture, if i encode with this script, using cropping and resizing
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
LanczosResize(720,368,0,48,720,368) #<- is this line correct, esp. 0,48?
AddBorders(0,48,0,64)
ConvertToYUY2()
or not using cropping and resizing (leave it as the original dvd)?
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
ConvertToYUY2()
but i am going to test both scripts.
[EDIT]I think I should get better results with the first script. it is important to me that i do not crop anything from the picture away and make a "real 1:1" copy of my dvd. but i was thinking to make a very good quality rip, so i decided to crop a bit.
if i encoded the movie with mpeg-4, i would crop 60 pixels from the top, 4 from the left and 66 from the bottom.
gerti67
1st July 2003, 17:05
Originally posted by snowbeach
...
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
LanczosResize(720,368,0,48,720,368) #<- is this line correct, esp. 0,48?
AddBorders(0,48,0,64)
ConvertToYUY2()
...
Huh, that's confusing. Are we still talking about the same movie with the same motion area? If the motion area is still 712x348 with a top and bottom border of 66 pixel - then your script is not totally correct.
It should read like this:
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
LanczosResize(720,348,0,66,720,348)
AddBorders(0,64,0,68)
ConvertToYUY2()
Though the resize is not really needed and in fact AviSynth will skip this I guess.
You can use:
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
Crop(0,66,720,348)
AddBorders(0,64,0,68)
ConvertToYUY2()
Has the same effect - only align motiona rea to macroblock boundaries.
HTH,
Gerti
snowbeach
2nd July 2003, 01:32
Ahh, ok. It is important to me that I do not crop anything from the picture away and make a "real 1:1" copy of my DVD. But I was thinking to make a very good quality rip, so I decided to crop a bit, without cropping anything from the picture away.
If I encoded the movie with MPEG-4, I would crop 60 pixels from the top, 4 from the left and 66 from the bottom.
Because I am going to do a MPEG-2 encode and I do not want to waste bitrates on the black areas. That is why I crop in macroblocks, as you suggested, if I understood it right, but not cropping anything away from the picture. Do you know what I mean?
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
crop(0,48,720,368)
LanczosResize(720,368)
AddBorders(0,48,0,64)
ConvertToYUY2()
or probably I should use this:
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec3.dll")
mpeg2source("E:\DVD\Projects\FOREST_GUMP.d2v")
Letterbox(48,64)
ConvertToYUY2()
digitalman
9th July 2003, 15:01
If you want to keep your DVDs for a long time, snowbeach, I would not do any cropping or adding black borders. In the future when you get an HDTV these borders would show up, so you would not be using your HDTV to it's full potential. It would look just as it does when you play it on your PC.
snowbeach
10th July 2003, 11:48
Hey digitalman. Are you a psychic? Could you read my mind? :D Yes, you are right, I want to keep my DVDs for a long time. Thank you very much for the info! I won't do any cropping then!
gerti67
10th July 2003, 13:29
@digitalman:
Do you know this for sure? Or is it just "popular belief" ;) - because according to google and a "HDTV overscan" search you'll find many sources stating that even HDTVs have a TV overscan border.
And regarding DVD compatiblilty this really makes sense. It just seems you can adjust the overscan settings a bit more with those HDTVs than with a regular TV set but all in all there shouldn't be any problems when using the "TV overscan blanking trick" with a HDTV set.
This question even got asked in here before just do a search for "HDTV overscan".
HTH,
Gerti
digitalman
10th July 2003, 18:35
http://home.comcast.net/~jack.lew/sd582.htm
Looks like you may be correct on the overscan issue on HDTV :), but it may only have to do with certain models, like the one being discussed, and seems to only affect the top and bottom in full widescreen mode. On this model, overscan is adjustable in service mode. To me, it stills seems like a good idea to forget the cropping, and leave everything alone if you plan on getting on HDTV, since there is no definitive answer on overscan with HDTV.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.