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 2nd November 2008, 14:23   #1  |  Link
stooky
Registered User
 
Join Date: Dec 2007
Posts: 8
Converting HDV footage to DVD

Hi!
I am the owner of a HV30 HDV-Camcorder!
Because i don't own a Bluray burner yet, I want to convert the footage to DVD with the best quality possible.
Therefore I have written a Avisynth script, which I load into HC Encoder. Source is the frame-served *.m2t footage (used DebugMode frameserver).

This is the script i use until now:
AVISource("C:\...\frameserve.avi",audio=false)
ConvertToYV12()
FieldDeinterlace()
BicubicResize(720,576,0,0.5)

Up to now, I'm not very satisfied with the result, as the motion scenes don't look very good... I think there could be an improvement by changing the deinterlace filter? The result also could be a bit sharper...
What do you think about the script?

Here is the link to the original footage:
http://rapidshare.com/files/15992731...51_39.m2t.html

Thanks in advance for your help!
stooky is offline   Reply With Quote
Old 2nd November 2008, 18:03   #2  |  Link
thetoof
Sleepy overworked fellow
 
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
You can give TempGaussMC_beta1 a try. http://forum.doom9.org/showthread.ph...00#post1158000
If you have trouble finding the plugins, they are all in the requirements.7z archive of animeivtc.
However, since you're converting to DVD, you shouldn't double your framerate. So either add selecteven() (progressive output) or weave() (interlaced output) at the end of your script.

To sharpen, limitedsharpenfaster is something worth trying.
__________________
AnimeIVTC() - v2.00
-http://boinc.berkeley.edu/-
Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p)
thetoof is offline   Reply With Quote
Old 2nd November 2008, 18:58   #3  |  Link
mikeytown2
Resize Abuser
 
mikeytown2's Avatar
 
Join Date: Apr 2005
Location: Seattle, WA
Posts: 623
Give this a shot
Code:
#load source
MPEG2Source("cam.d2v")
#bob deinterlace
TDeint(1)
#Resize
BicubicResize(720,576,0,0.5)
#interlace
Separatefields()
Selectevery(4,0,3)
Weave()
Make sure to set the 16:9 bit when encoding. Also try BlackmanResize()
mikeytown2 is offline   Reply With Quote
Old 2nd November 2008, 22:26   #4  |  Link
stooky
Registered User
 
Join Date: Dec 2007
Posts: 8
Thank you very much for your answers!
I'll give them a try tomorrow!
stooky is offline   Reply With Quote
Old 2nd November 2008, 22:54   #5  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: UK
Posts: 1,673
Quote:
Originally Posted by thetoof View Post
You can give TempGaussMC_beta1 a try.
18 hours for 2.5 minutes of HDV on my (admittedly low spec 2GHz) machine. Pointless, timewasting overkill for interlaced HD > interlaced SD conversion.

Lots of people here seem convinced that the way to do this conversion is to deinterlace as carefully as possible. However, in the thread where it was really tested, it was found that even dumb bob of HD interlaced is too sharp for SD interlaced and needs to be softened! So why waste time with smart bobbing?

This is one interlaced resize method...
http://forum.doom9.org/showthread.ph...24#post1161524

This is another...
Code:
bob()
spline36resize(704,576)
limitedsharpenfaster().Blur(0.0,1.0).Sharpen(0.0,0.5)

assumetff()
separatefields().SelectEvery(4,0,3).Weave()
Hope this helps.

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 2nd November 2008, 23:02   #6  |  Link
stooky
Registered User
 
Join Date: Dec 2007
Posts: 8
Thanks for your answer!
But I'm a bit confused now...
I thought that I have to use selecteven() for progressive output.
You use weave() in your scripts. Does this mean that you generate interlaced SD-Material?
Til' know I thought that progressive output is better for downsizing...
stooky is offline   Reply With Quote
Old 2nd November 2008, 23:44   #7  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
The content becomes progressive after bobbing (with bob() or tdeint(1)). Then the scaling happens, then you re-interlace with separatefields.selectevery(4,0,3).weave.

You want to burn it on a DVD, right? Then your only good option is to keep it interlaced, since the NTSC DVD standard calls for 480i60, and doing anything else means losing motion fluidity.

~MiSfit
__________________
These are all my personal statements, not those of my employer :)
Blue_MiSfit is offline   Reply With Quote
Old 3rd November 2008, 00:04   #8  |  Link
Alex_ander
Registered User
 
Alex_ander's Avatar
 
Join Date: Apr 2008
Location: St. Petersburg, Russia
Posts: 334
Quote:
Originally Posted by 2Bdecided View Post
it was found that even dumb bob of HD interlaced is too sharp for SD interlaced and needs to be softened! So why waste time with smart bobbing?
Dumb bob is 'too sharp' because the initial image is too sharp for dropping half of lines at turning a field into frame - the image cannot be represented properly (sample frequency too low) or restored after this. I agree that those slow sophisticated scripts are waste of time here, but with what I tested for comparison, conventional smart bobbers like LeakKernel or TDeint work more correctly (since they use all the lines for stationary parts of image) and are fast enough. To avoid extreme sharpness before final re-interlacing, different resizing methods can be used for vertical / horizontal operations and this is well-combined with horizontal resizing (it can be sharper) before bob, which reduces job for it, and vertical resizing (less sharp, even filtering if necessary) afterwards.
Alex_ander is offline   Reply With Quote
Old 3rd November 2008, 00:43   #9  |  Link
stooky
Registered User
 
Join Date: Dec 2007
Posts: 8
Hi!
I've tested some of your scripts!
Generally I've to say that diagonal lines look very noisy...
I have packed 3 different version with the scripts in the following rar file:
I would be interested what you experts think about the results!
I think the version with LeakKernel looks best...
Judge on your own:
http://rapidshare.com/files/160098378/files.rar.html
stooky is offline   Reply With Quote
Old 3rd November 2008, 04:23   #10  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Try this (you'll need ColorMatrix, Yadifmod and TomsMoComp)

Code:
#########################
# INPUT
#########################

AviSource("signpost.avi")

AssumeTFF()
(isRGB()) ? ConvertToYUY2() : ColorMatrix(mode="Rec.709->Rec.601", clamp=false)

#########################
# DEINTERLACING (Bobbing)
#########################

# padding for mod16 width and height
w16 = ceil(float(width()) / 16.0) * 16
h16 = ceil(float(height()) / 16.0) * 16
bL = (w16 - width()) / 2
bR = (bL % 2 != 0) ? bL - 1 : bL
bL = (bL % 2 != 0) ? bL + 1 : bL
bT = (h16 - height()) / 2
bB = (bT % 2 != 0) ? bT - 1 : bT
bT = (bT % 2 != 0) ? bT + 1 : bT

(bL > 0 || bR > 0 || bT > 0 || bB > 0) ? AddBorders(bL, bT, bR, bB) : last

yadifmod(mode=1, edeint=Interleave(TomsMoComp(-1, 0, 0), DoubleWeave().SelectOdd().TomsMoComp(-1, 0, 0)))

(bL > 0 || bR > 0 || bT > 0 || bB > 0) ? Crop(bL, bT, bR * -1, bB * -1) : last

#########################
# CROP / RESIZE
#########################

# crop a little from the top and bottom to allow fullscreen with accurate PAR (assuming 1080i source)
Crop(0,14,0,-14)

Spline36Resize(720, 576)

######################
# OUTPUT OPTIONS
######################

# Uncomment only one of the lines below below

# This produces interlaced YV12 output
AssumeTFF().SeparateFields().SelectEvery(4,0,3).Weave().AssumeTFF().ConvertToYV12(interlaced=true)

# This produces progressive YV12 output, with blending
# Merge(SelectEven(), SelectOdd(), weight=0.5).ConvertToYV12(interlaced=false)

# This produces progressive YV12 output, without blending
# SelectEven().ConvertToYV12(interlaced=false)

Limiter(16, 235, 16, 240)

Last edited by vampiredom; 3rd November 2008 at 05:47.
vampiredom is offline   Reply With Quote
Old 3rd November 2008, 05:21   #11  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
nice script!!!

~MiSfit
__________________
These are all my personal statements, not those of my employer :)
Blue_MiSfit is offline   Reply With Quote
Old 3rd November 2008, 05:58   #12  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Thanks... I'm very impressed with the Yadifmod + "TomsBob" method here: It not perfect for 1:1 stuff, but it is ideal (and extremely fast) for scaled-down stuff like HDV->DVD. I have never able to get close to its quality with Tdeint, Leak, etc.

Ther seems to be some issue on older CPUs with TomsMoComp: Things get funky when the dimensions are not mod16, so that's why I add the temporary borders and then crop them off. It's the "safe way" to do it

Only EEDI2 seems to do a "better" job (most of the time?) than TomsMoComp in this situation, but the rendering is way too slow on HD sources (unless you're running MT and the MT version of EEDI2 on a killer machine, of course).

In which case, you can replace the DEINTERLACING section above with:

Code:
WhichField = (GetParity()) ? 3 : 2
Yadifmod(mode=1, edeint=v.SeparateFields().EEDI2(Field = WhichField, maxd = 12))
@stooky:

What program are you frameserving from with DebugMode?

Last edited by vampiredom; 3rd November 2008 at 06:05.
vampiredom is offline   Reply With Quote
Old 3rd November 2008, 15:12   #13  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: UK
Posts: 1,673
Quote:
Originally Posted by Alex_ander View Post
Dumb bob is 'too sharp' because the initial image is too sharp for dropping half of lines at turning a field into frame - the image cannot be represented properly (sample frequency too low) or restored after this.
I didn't mean that though. The aliasing in any_HD_content.bob() is irrelevant when the target is SD.

Quote:
I agree that those slow sophisticated scripts are waste of time here, but with what I tested for comparison, conventional smart bobbers like LeakKernel or TDeint work more correctly (since they use all the lines for stationary parts of image) and are fast enough. To avoid extreme sharpness before final re-interlacing, different resizing methods can be used for vertical / horizontal operations and this is well-combined with horizontal resizing (it can be sharper) before bob, which reduces job for it, and vertical resizing (less sharp, even filtering if necessary) afterwards.
In the thread I linked to, the "necessary filtering" was so strong that any advantage to using a better bobber at the HD stage was completely wiped out. You're left with less than 300 lines of effective vertical resolution - it doesn't matter whether you start with 540 (from bob), 1080ish (from TGMC), or something in between (from another) - it all looks the same afterwards.

(Of course I agree that the separate H and V resizing before and after any_smart_bob is very useful, when a smart bob is required.)

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 3rd November 2008, 22:53   #14  |  Link
NerdWithNoLife
Registered User
 
NerdWithNoLife's Avatar
 
Join Date: Jul 2007
Posts: 157
What is your original framerate? That camera shoots 30p/30i/24p, I believe. You may want to try 24p frames, and have the encoder apply soft pulldown, like in most commercial DVD's. The framerate is a different issue from the resizing method (though you should deinterlace before resizing). Progressive frames tend to compress well, at the expense of smoothness of motion.
__________________
f=33
NerdWithNoLife is offline   Reply With Quote
Old 4th November 2008, 07:04   #15  |  Link
KR
Tester
 
Join Date: Jul 2004
Posts: 39
stooky: I would try not to deinterlace. Only downsize. I know it sounds weird, but at least try it. (The easy way to see the effect is with VirtualDub's Resize function, with preview.)
I'd recommend Lanczos3 resize. (some other modes will introduce weird artifacts). Do not activate interlace mode.

Such downsizing will blend the fields.
You will save processing time, and there won't be deinterlacing artifacts.

(make sure any prior processing respects the interlace nature of the video or you will get artifacts. Separate fields if necessary. Another possibility would be to downsize before processing for more speed)

P.S.:
Why do you frameserve the m2v and then convert it to YUV2 ??? Is the frameserve RGB-only ? If so, you lose quality in YUV-->RGB-->YUV conversion. Personnally I convert m2v to mpeg (lossless muxing) then convert mpeg to avi with Fast recompress in VdubMod, encoding in Huffyuv. That way I have easy to edit, YUV avi files without any loss in quality.
__________________
May your future be filled with happiness.
KR is offline   Reply With Quote
Old 4th November 2008, 07:34   #16  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
That's a terrible idea! You can't properly resize interlaced content without deinterlacing!

~MiSfit
__________________
These are all my personal statements, not those of my employer :)
Blue_MiSfit is offline   Reply With Quote
Old 4th November 2008, 08:48   #17  |  Link
KR
Tester
 
Join Date: Jul 2004
Posts: 39
I knew others would disapprove, lol.

Blue_Misfit: Try it also, you'll see it isn't so bad. In fact the result is very good.

Let's say we have 960 lines (interlaced). If we were to resize it with a bilinear transform, to 480 lines, without prior deinterlacing, we would obtain the exact same result as having done a simple deinterlace (blend fields) followed by the resize. That's because the resize ratio is a perfect 2:1.

In his case, the ratio is not so perfect. That's why I recommend using a different resizer (Lanzcos3). The end result looks like mid-way between deinterlace-blend and deinterlace-interpolate.

I did it myself for resizing 1080i to 720p and the result is still very good while processing is much faster.

Of course if he doesn't like the look of blended fields he will have to deinterlace before resizing.

In any case, before criticising, try it. Or try thinking outside the box... There are no golden rules, only the end result's quality matters.
__________________
May your future be filled with happiness.

Last edited by KR; 4th November 2008 at 09:01.
KR is offline   Reply With Quote
Old 4th November 2008, 09:43   #18  |  Link
Leak
ffdshow/AviSynth wrangler
 
Leak's Avatar
 
Join Date: Feb 2003
Location: Austria
Posts: 2,441
Quote:
Originally Posted by KR View Post
Let's say we have 960 lines (interlaced). If we were to resize it with a bilinear transform, to 480 lines, without prior deinterlacing, we would obtain the exact same result as having done a simple deinterlace (blend fields) followed by the resize. That's because the resize ratio is a perfect 2:1.

In his case, the ratio is not so perfect. That's why I recommend using a different resizer (Lanzcos3). The end result looks like mid-way between deinterlace-blend and deinterlace-interpolate.
If you're going to do it this way, at least do a bilinear resize from 1080 to 540 vertically and *then* use lanczos to get down to the final size - directly resizing from 1080 to 480 will give you windowblinds-like artifacts everywhere there's movement because it blends more than 2 lines (with combs) together...
__________________
now playing: [artist] - [track] ([album])
Leak is offline   Reply With Quote
Old 4th November 2008, 11:09   #19  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: UK
Posts: 1,673
Why blend the fields together when the output is DVD?!

Quote:
Originally Posted by KR View Post
I did it myself for resizing 1080i to 720p and the result is still very good while processing is much faster.
The result is an abomination! As for "much faster" - bob() isn't exactly slow, neither is re-interlacing.

You might as well save time by only processing the first half of the video - "much faster"!

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 4th November 2008, 20:39   #20  |  Link
KR
Tester
 
Join Date: Jul 2004
Posts: 39
Quote:
Originally Posted by Leak View Post
If you're going to do it this way, at least do a bilinear resize from 1080 to 540 vertically and *then* use lanczos to get down to the final size - directly resizing from 1080 to 480 will give you windowblinds-like artifacts everywhere there's movement because it blends more than 2 lines (with combs) together...
I thought about it too, but didn't do it this way because in VDubMod, I only get the windowblinds with Nearest Neighbor, Bilinear and Bicubic resize. There are no artifacts with Precise bilinear, Precise bicubic and Lanczos.

Nearest neighbor, no prior deinterlace


Deinterlace - Blend before Lanczos3


Lanczos3, no prior deinterlace


Quote:
Originally Posted by 2Bdecided
Why blend the fields together when the output is DVD?!
True, retaining 60i is better in this case.

Quote:
Originally Posted by 2Bdecided
You might as well save time by only processing the first half of the video - "much faster"!
lol
__________________
May your future be filled with happiness.

Last edited by KR; 4th November 2008 at 20:56.
KR is offline   Reply With Quote
Reply

Tags
avisynth, deinterlace, dvd, frameserver, hdv

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 07:53.


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