Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th December 2009, 07:13   #1  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 583
DVD function, automaticaly add borders and resize

Hi, I don't know if a function like that already exists but I wrote a small one which automaticaly adds borders and resizes to matche with dvd resolutions to feed your mpeg2 encoder or dvd rebuilder. I also added an option ('care' Correct Aspect Ratio Estimation) if the input has not the correct aspect ratio, just set it to have only one resizing in the script.

LAST UPDATE (v0.3a) : http://forum.doom9.org/attachment.ph...1&d=1261000196

Last edited by MatLz; 27th November 2011 at 23:10.
MatLz is offline   Reply With Quote
Old 9th December 2009, 13:09   #2  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 583
Already 35 downloads and no bug report? Nice!

Update:
*Change lanczos4resize to spline16resize to limit halos artifacts
*Add 'hq' mode using nnedi2 upscaling. Particulary usefull for low resolution sources, specialy on animes:
[img=http://img187.imageshack.us/img187/893/00000j.th.jpg]

Here it is:
Attached Files
File Type: txt DVD_0.2.avsi.txt (1.0 KB, 100 views)

Last edited by MatLz; 11th December 2009 at 10:32.
MatLz is offline   Reply With Quote
Old 9th December 2009, 13:13   #3  |  Link
buzzqw
HDConvertToX author
 
Join Date: Nov 2003
Location: Cesena,Italy
Posts: 6,552
since script is very small post it as with CODE tag

BHH
__________________
HDConvertToX: your tool for BD backup
MultiX264: The quick gui for x264
AutoMen: The Mencoder GUI
AutoWebM: supporting WebM/VP8
buzzqw is offline   Reply With Quote
Old 9th December 2009, 13:20   #4  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 583
Quote:
Originally Posted by buzzqw View Post
since script is very small post it as with CODE tag

BHH
I can't write more 500 or 502 bytes in posts, I'm on a crappy phone!

Edit: After PMing myself, it appears my limit is 515 bytes. Good to know.

Last edited by MatLz; 9th December 2009 at 14:56. Reason: Now, I know
MatLz is offline   Reply With Quote
Old 9th December 2009, 16:23   #5  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,522
A very handy little function, but it (first version anyway) doesn't incorporate overscan (edit: sorry, not overscan; nominal analogue blanking). It should scale up to a target of 702x576 (PAL) or 704x480 (NTSC) [these dimensions define the 4:3/16:9 box], then addborders to 720 (or 704, which is also legal for DVD).

David

Last edited by wonkey_monkey; 9th December 2009 at 16:37.
wonkey_monkey is offline   Reply With Quote
Old 9th December 2009, 19:38   #6  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 583
Urrrh
99% of dvd I've see hadn't these lateral borders...
If someone else ask for, I will include that as an option.
But that maybe means too much difficulties to code for my tiny brain!
Thx for the info.
MatLz is offline   Reply With Quote
Old 9th December 2009, 21:44   #7  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 583
Here it is maybe with 'nominal analogue blanking'...I repeat: maybe...
Attached Files
File Type: txt DVD_0.2.1a.avsi.txt (1.1 KB, 72 views)

Last edited by MatLz; 16th December 2009 at 22:59. Reason: Previous post deleted
MatLz is offline   Reply With Quote
Old 11th December 2009, 13:00   #8  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 583
As I said, and as expected, my previous code seems to be wrong...
I'm a little lost.

And in some cases, it's a real nonsense to use nominal analogue blanking:
*letterboxing when input aspect ratio is less (there is a proportionnality to calculate) than the output aspect ratio, because we lost height's pixels for nothing...
Examples: 1.2 in 4/3, 1.6 in 16/9....

New attempt:
Attached Files
File Type: txt DVD_0.2.2a.avsi.txt (1.1 KB, 74 views)
MatLz is offline   Reply With Quote
Old 11th December 2009, 14:26   #9  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,522
Quote:
*letterboxing when input aspect ratio is less (there is a proportionnality to calculate) than the output aspect ratio, because we lost height's pixels for nothing...
The pixels in the blanking area don't have to be blank, it's just that the aspect ratios you were targetting for the 720x[480/576] image were slightly wrong.

Just think of the 720x576 box as having an aspect ratio of either ~16.4:9 or ~4.1r:3 rather than 16:9 or 4:3. The result would be the same as if you'd applied your original script, then scaled down to 704 width (or 702 for PAL) and added borders back to 720. The image's height would be the same.

Of course this all assumes that the video was scaled down correctly in the first place, which may not be the case...

David
wonkey_monkey is offline   Reply With Quote
Old 11th December 2009, 20:50   #10  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 583
Well...I don't understand a lot...english is not my native language and it's too much technical...
And you can't see the new code...the attachments aren't approved...it's long very long...
See you later.
MatLz is offline   Reply With Quote
Old 12th December 2009, 10:55   #11  |  Link
Alex_ander
Registered User
 
Alex_ander's Avatar
 
Join Date: Apr 2008
Location: St. Petersburg, Russia
Posts: 337
In other words, if you use the final horizontal size 720 (rather than 704), the planned (for DVD) height of a 4:3 or 16:9 image must be first adjusted in 720/704 proportion, then in case of anamorphic - cropped to 480 or 576, in case of letterboxed - rounded to a multiple of 16/8/4 (with addition of horizontal borders).
That is because the standard DV/DVD AR's are defined for the limited area of 704x576(480) within 720x576(480).
Alex_ander is offline   Reply With Quote
Old 16th December 2009, 22:52   #12  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 583
Thanks, really big thanks for all the explanations guys...but...

dvd 0.3a
Total reversion of the process order so new calculations of the ratios:

*Depending of the input and the output AR, there is a huge speedup compared to other versions (50% with 2.5:1 in 16/9, 100% in 4/3 !!!)
*Better quality near the added borders (this "kindofsubsamplingartifact" isn't present anymore)
*Maybe Nominal Analogue Blanking at least right coded??
Attached Files
File Type: txt DVD_0.3a.avsi.txt (1.5 KB, 319 views)
MatLz is offline   Reply With Quote
Old 18th February 2010, 01:45   #13  |  Link
dannybz
Registered User
 
Join Date: Jul 2009
Posts: 9
MatLz, how exactly do I use your script? Open with notepad?
dannybz is offline   Reply With Quote
Old 18th February 2010, 14:38   #14  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 583
Just put the avsi in the Avisynth plugins directory and call the function in your script.
You can simply use:
dvd() for outputing pal 16/9.
If you need other standard, format, quality or the nominal analogue blanking, just write your settings in the ().
MatLz is offline   Reply With Quote
Old 19th February 2010, 02:33   #15  |  Link
dannybz
Registered User
 
Join Date: Jul 2009
Posts: 9
MatLz, thanks, but I am new in scripting and I am only used to the most common scripts of AVIsynth. How do I call your script?
The way I encode is that I create a simple AVIsynth script and open with CCE and start encoding. How do I work with this? Can you help me?
dannybz is offline   Reply With Quote
Old 19th February 2010, 03:03   #16  |  Link
MatLz
I often say "maybe"...
 
MatLz's Avatar
 
Join Date: Jul 2009
Location: France
Posts: 583
Ok....download the attachement dvd_0.3a.avsi.txt. Rename this txt file in .avsi and put it in the Avisynth plugin directory.
And post your script and tell me the specs you want : if you want pal or ntsc, 16/9 or 4/3, if you need the nominal analogue blanking
Like that I will give you the last line of your script.
MatLz is offline   Reply With Quote
Old 20th February 2010, 15:46   #17  |  Link
dannybz
Registered User
 
Join Date: Jul 2009
Posts: 9
This is the script I have, its an NTSC 23.976fps clip. Im looking for a 4:3. I don't need the black borders on the left or right (nab).

AVISource("H:\FUN\NEWYEARS2010\BASH.avi",FALSE)
LanczosResize(720,360,0,0,640,352)
AddBorders(0,56,0,64)
ConvertToYUY2()
dannybz is offline   Reply With Quote
Old 20th February 2010, 16:32   #18  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,522
What's the width and height of original clip, and for what reason are you (it seems) cropping it?

David
wonkey_monkey is offline   Reply With Quote
Old 20th February 2010, 20:43   #19  |  Link
dannybz
Registered User
 
Join Date: Jul 2009
Posts: 9
The clip is 640x352. Im using FitCD to get that script. Sorry for my ignorance about scripting, but I don't want to crop it.
dannybz is offline   Reply With Quote
Old 20th February 2010, 20:55   #20  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,522
Quote:
The clip is 640x352. Im using FitCD to get that script. Sorry for my ignorance about scripting, but I don't want to crop it.
The four parameters after the target size on the lanzcosresize line would crop the video, but obviously with those numbers it'll just keep the same size. The script as posted will give you the correct aspect ratio for 4:3 NTSC DVD, though for some reason it won't quite be centred in the letterbox. I'd change the addborders to:

Code:
addborders(0,60,0,60)
David
wonkey_monkey is offline   Reply With Quote
Reply

Tags
dar, dvd, ntsc, pal, par

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:33.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.