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 30th May 2012, 17:36   #1  |  Link
Lyris
Registered User
 
Join Date: Sep 2007
Location: Europe
Posts: 602
Avoid using VirtualDub to prevent format conversions?

Hey all,

Sometimes when I'm working on DVDs, I'll need to do things in stages. For example, taking a 4:4:4 TIFF image sequence, and using AVISynth scripts to produce a PAL or NTSC res downconvert of this.

Then I'll save this file in VirtualDub (as a Lagarith AVI file, usually in YV12 because that's all many of the AVIsynth filters operate in anyway). Downstream, I'll load this AVI file in another AVISynth script to do more processing.

The reason for the multiple steps is that combining everything into one big script is just too slow.

But, VirtualDub only processes in RGB, correct? So each time I do this, I'm adding a pixel format conversion. Just today I saw one case where the chroma resolution had been mangled by this process. Red text on a nearly black background had colour bleed everywhere.

So, my question is, how should I be doing this to preserve quality wherever possible?
Lyris is offline   Reply With Quote
Old 30th May 2012, 17:43   #2  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by Lyris View Post
But, VirtualDub only processes in RGB, correct?
This was correct in the past for its filtering system, but not anymore. "Fast recompress" mode was never affected.
sneaker_ger is offline   Reply With Quote
Old 30th May 2012, 17:45   #3  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
No- Vdub has different processing color spaces, not only RGB. You set it in Color Depth. You can stay in YV12 if you set it.
I use YUY2 and many Vdub filters works in it natively- no need to go through RGB.
kolak is offline   Reply With Quote
Old 30th May 2012, 18:41   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Fast recompress just enters negotiation with the compression codec, and if they can
agree on a common format they do not need to convert. However, in eg HuffYUV,
you have to set it to ConvertToYUV, otherwise it would actually send HUFFYUV RGB,
even if in Fast Recompress.
As far as I know all VD filters require conversion to RGB, and so cannot be used in eg
Fast Recompress or Direct Stream Copy. In my 1.9.11 when Fast Recompress is selected,
it disables Filters (tried it with a builtin filter).

Can you give the name any VD filter that accepts anything other than RGB ?
I'de kinda like to read it say that in docs as I find it extremely difficult to believe.

EDIT:
Quote:
You can stay in YV12 if you set it
set it where?
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 30th May 2012 at 18:46.
StainlessS is offline   Reply With Quote
Old 30th May 2012, 18:51   #5  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by StainlessS View Post
Can you give the name any VD filter that accepts anything other than RGB ?
I don't have the docs at hand, but the internal "resize" and "convert format" do for example. Check "Show image formats" on the bottom left in the filters window to verify.
sneaker_ger is offline   Reply With Quote
Old 30th May 2012, 18:58   #6  |  Link
Lyris
Registered User
 
Join Date: Sep 2007
Location: Europe
Posts: 602
Ah ha! Thanks for this, guys. This wasn't always here:



So basically once I've downconverted to YV12 in the AVISynth script, I can set these options to YV12 in VirtualDub, choose Fast Recompress, and I'm good for avoiding further degradation?

Edit: yep - seems like it - the colour bleed is gone. Now let's try to get it into Cinema Craft SP3 (YUY2) intact!

Last edited by Lyris; 30th May 2012 at 19:06.
Lyris is offline   Reply With Quote
Old 30th May 2012, 19:17   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
WOW!!!, Thanks man, that took me by surprise.
Never read the VDub docs for years, probably not since a big chunk of the old docs were abandoned.
Am now asking myself how easy it might be to incorporate the VDUBMod Avisynth Script editor in
current version of VD. Downloading SDK etc imminent.

Again, thanks very much.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 30th May 2012, 19:47   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by Lyris View Post
Ah ha! Thanks for this, guys. This wasn't always here:
Just checked, VD MPEG2 had a reduced version of colorspaces
in your image, me and you have been missing out for a long long time. VDMod,
(the one I almost exclusively use except where
rendering multipart AVS files [chopped in half]) does not
have anything more than 16/24/32 bit rgb.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 30th May 2012, 20:49   #9  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by StainlessS View Post
VDMod,
(the one I almost exclusively use except where
rendering multipart AVS files [chopped in half]) does not
have anything more than 16/24/32 bit rgb.
VDMod was obsolete years ago.
As the saying goes, wake up and smell the coffee...
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 30th May 2012, 21:09   #10  |  Link
TheSkiller
Registered User
 
Join Date: Dec 2007
Location: Germany
Posts: 632
Quote:
Originally Posted by Lyris View Post
Edit: yep - seems like it - the colour bleed is gone. Now let's try to get it into Cinema Craft SP3 (YUY2) intact!
I do that a lot with CCE SP3. I always feed it YUY2 (anything else is not a good idea) even though, as usual, my script result is YV12.
The important part is, if you examine CCE's "way of downconverting YUY2 to YV12 for MPEG2" you will notice that it is equivalent to AviSynth's ConvertToYV12(interlaced=true/false). Whether the interlaced or non-interlaced processing takes place depens on one setting: in the "Picture" settings at the bottom there you can choose between interlaced, progressive and auto (do not use auto).

Knowing that CCE works this way we can simply convert from YV12 to YUY2 by doubling the vertical chroma. CCE then downsamples this and in the end it's a NOP without additional chroma bleed.


I think it can be done using chromaresample=point and some shifting of the plane as AviSynth's pointresampling introduces a shift. I should investigate this but until now I always used a function called YV12toYUY2 for this which does a point resize that doesn't shift the plane. Do not confuse it with Gavino's YV12toYUY2.
For interlaced point YV12->YUY2 you need to wrap the YV12toYUY2 function in between something like separatefields() and weave() but I don't have access to my scripts on this computer.

Edit: This is what happens:
Code:
ColorBars(pixel_type="YV12")
Raw=last

YV12toYUY2()
ConvertToYV12(interlaced=false)

Subtract(last, raw) #it's a NOP, YV12 chroma stays untouched

Edit 2: If you use VD in "Fast Recompress" mode it does not matter what color spaces you set in the settings, it's only for filter processing within VD. That means this mode always keeps the incoming color space untouched.

Last edited by TheSkiller; 30th May 2012 at 21:22.
TheSkiller is offline   Reply With Quote
Old 30th May 2012, 21:29   #11  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
Am now asking myself how easy it might be to incorporate the VDUBMod Avisynth Script editor in
current version of VD.
You know about the F2 button right? To reload your edited+resaved script.
Wilbert is offline   Reply With Quote
Old 30th May 2012, 22:04   #12  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
Quote:
Originally Posted by Lyris View Post
Ah ha! Thanks for this, guys. This wasn't always here:



So basically once I've downconverted to YV12 in the AVISynth script, I can set these options to YV12 in VirtualDub, choose Fast Recompress, and I'm good for avoiding further degradation?

Edit: yep - seems like it - the colour bleed is gone. Now let's try to get it into Cinema Craft SP3 (YUY2) intact!
You can always set YV12 as input, use AutoYUY2 filter (to upsample to 4:2:2) and than YUY2 as output color depth and export file with some 4:2:2 codec, like UTVideo or Canopus Lossless- this work very well.
SP3 likes YUY2 as input.
kolak is offline   Reply With Quote
Old 31st May 2012, 03:08   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by Gavino View Post
VDMod was obsolete years ago.As the saying goes, wake up and smell the coffee...
Quote:
Originally Posted by Wilbert View Post
You know about the F2 button right? To reload your edited+resaved script.
Well the reason I live in the past is that I like Virtual Dub,
and am yet to find any other version of it that eg inserts the
current frame into the script, clip ranges, trimsets and the other
script editing functionality of the build in script editor.
Having an external editor just dont do it for me, I'm just not
that easily pleased.
Maybe AVSPmod does that sort of thing, shall really have to try it one day (for more than five minutes).

EDIT: having had a brief look a Vd 1.9/10 source, looks like I'll havta stick with VDubMod,
looks like too big a job to take on (still gonna explore it a little more though).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 31st May 2012 at 04:09.
StainlessS is offline   Reply With Quote
Reply

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 16:43.


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