Go Back    Forum > Digital Video > Video Project Help > Capture, Record, Transfer

Reply
 
LinkBack Thread Tools
  #21  
08-24-2018, 07:09 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Having to produce a 50fps deinterlaced version and a spec-compliant 25fps interlaced DVD does involve some extra steps. That's especially true if your h.264 playback system isn't smart enough to work with interlaced video and can't read more universally playable formats like DvD or Bluray containers. Rather than edit and apply special effects twice in Adobe, and tolerate that Adobe really doesn't re-interlace well, I'd suggest applying effects to your progressive version and saving it as lossless progressive Lagarith YV12. You can then use Avisynth to re-interlace your progressive version, and thus end up with both versions ready for encoding.

That's the way I've been handling family videos that need one version for DVD and another for Facebook and other web postings. My external playback setups simply play the MPEG encodings then same way any DVD player plays MPEG. I don't need a progressive version for external playback.

Below, I'm breaking down the earlier script to answer some questions about it:

vidpath="E:\forum\faq\discmeister\"
AviSource(vidpath + "1000 Lakes snippet 2 for DigitalFAQ.avi")

"vidpath" is something I invented by simply stating it and following it with an equal sign and a text value. There is no such thing in Avisynth as a vidpath, it's a word of my own conjecture. The statement creates a place in memory called "vidpath" and assigns to it a character string with a value of "E:\forum\faq\discmeister\". In the next line, the "+" character is a concatenate operation that joins two character entries, one of which is the character string that was assigned to "vidpath" and the second part of which is another character string that I specified as "1000 Lakes snippet 2 for DigitalFAQ.avi". Put the two strings together, and what the AviSource decoding function sees is, effectively, this:

Code:
AviSource("E:\forum\faq\discmeister\1000 Lakes snippet 2 for DigitalFAQ.avi")
The little memory thingie I invented called "vidpath" is a leftover from potboiler text I keep in some text files, from which I copy and paste into new scripts. Let's say I had multiple files in the same folder that I'd want to join or had a different audio file for that video. I would have to type the full path portion multiple times. Instead, I type the path section once, assigning it to vidpath, and then join vidpath to multiple individual files. Here is an example:

Code:
vidpath="E:\projects\summer2018\sister\homevids\"
Vid1=Avisource(vidpath + "video1p.avi")
Vid2=Avisource(vidpath + "video2p.avi")
Vid3=Avisource(vidpath + "video3p.avi")
Vid4=Avisource(vidpath + "editedp.avi")
reint = vid1 + vid2 + vid3 + vid4
AssumeTFF()
reint = reint.SeparateFields().SelectEvery(4,0,3).Weave()

#--- output a concatenated and reinterlaced version from 4 progressive videos.
return reint
In the above code, "reint" is another invention of mine. You can name things whatever you want as long as the monicker isn't the same as an official function or name of a filter.

### --- Remove and configure new borders ----#
Crop(16,2,-14,-6).AddBorders(16,4,14,4)

### --- contrast, gamma, hue, saturation issues ----#
ColorYUV(cont_y=-20,off_y=-8)
Levels(20, 1.2, 255, 16, 250, dither=true, coring=false)
Tweak(Sat=0.90, starthue=165, endhue=180, dither=true, coring=false)
ConvertToYV24(interlaced=true)
SmoothTweak(hue1=5)


Crop(),AddBorders(), ColorYUV(), Levels(), and Tweak(0 are all built-in functions that work in several colorspaces, one of which is the video's original YUY2. SmoothTweak(), however, is a function in the external SmoothAdjust plugin. Why its designer decided that it wouldn't work in YUY2 but would work in YV24 and others is a mystery to most people except the geeks who look inside these things. The two colorspaces aren't quite the same, however, especially in the way their chroma pixels are arranged. Rather than get into a discussion that will keep us here until late 2019, take Avisynth's word for it that YV24 is a "planar" configuration and YUY2 isn't, and YV24 has higher color resolution. If you're going to use SmoothTweak to adjust hue and move some colors around, making sure along the way that you do some ordered dithering to close gaps that occur in the spectrum when color is re-interpolated by stretching or shrinking or whatever, so that SmoothTweak will have smoother results working in YV24 than in colorspaces with lower chroma resolution.

in the final analysis, frankly, you wouldn't notice a vast difference between lower or higher color resolution in such a filter, unless you were really picky about cleaning up color in so-so sources such as VHS. It's not so much "better" as it is "less damaged". In any case, SmoothTweak doesn't work in YUY2.

Now we come to something that I think I just noticed, although it doesn't matter a great deal:

ConvertToYV12(interlaced=true)
AssumeTFF()
QTGMC(preset="medium",EZDenoise=8,denoiser="dfttes t",ChromaMotion=true,border=true,\
ChromaNoise=true,DenoiseMC=true,GrainRestore=0.3,S tabilizeNoise=true)
### --- smooth excessive combing ----#
Vinverse2()

The posted version of QTGMC that most people find for download and are accustomed to with its big original support files package is version 3.32 (https://forum.doom9.org/showpost.php...59&postcount=1). This version and its support files work in YV12 only. Yes, there are newer versions that work with other color spaces and get fancier, but they seem to get updated every 15 minutes. And the newer ones are slower.

After QTGMC comes the Vinverse filter to help reduce excessive combing when re-interlacing. Vinverse used to be YV12 also, but vinverse2 (I suddenly remember) also works in YUY2. The filters that follow Vinverse2 in the script work in YUY2 as well, which has higher color resolution than YV12. So, what I could have done was convert to YUY2 before using Vinverse2 and then just keep things that way. No harm done, just one of those things that didn't occur to me at the moment.

###---To RGB for VirtualDub filters ---###
ConvertToRGB32(interlaced=false,matrix="Rec601")

The RGB conversion is for snippet #2 and the Virtualdub color filters. Snippet #1 didn't use VirtualDub color correction, so the conversion wasn't necessary for snippet #1. But note that color conversion functions want to know whether the source is interlaced (yes, indeed, it does matter!). Here's a caution: because you're doing mod work in Adobe later, your videos will be converted to RGB by Adobe anyway. Advice: let Avisynth make that conversion. Adobe doesn't make nice with color conversions the way Avisynth does (and in some cases, Virtualdub can get a little sloppy sometimes as well, mostly with YV12 -> RGB).

Yes, there are a few tricks to this stuff. That's why I browse every forum thread I come across, even if I have nothing to do with what's going on in them. You pick up a ton of information that way.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #22  
08-28-2018, 04:58 AM
discmeister discmeister is offline
Free Member
 
Join Date: Apr 2018
Posts: 67
Thanked 4 Times in 3 Posts
Hi there,

So I spent most of yesterday playing around with AviSynth and something called AVSEdit Plus, which I found a couple of good demo videos for on YouTube.

I've managed to get the right plugins etc installed to be able to cut and paste your commands for my sample videos and get AVISynth/VirtualDub to replicate them with files on my own machine. Simple adaptation has been possible too - so I can crop/border/resize as required. I'm frankly keeping most of your levels settings unchanged because, so far, they appear to be working. The end result takes a fair while - I'm seeing about 8fps on processing - and the files are huge (I guess that's because they're 50fps - would that be right?). But the results are considerably cleaner than what I've seen before. So I'm going to stick with that as a workflow.

Outputting to H264 from Premiere Pro gives me an 800Mb-odd file for 26 minutes of content, in quality that I'm really pleased with (I adjust white balance and use some of the analysis graphs to help level out RGB in Adobe).

Just have to sort out how I output from Adobe to MPEG2 now. I have to avoid Premiere Pro's built-in MPEG2-DVD setting because it is locked to 720x576 (despite the fact that Adobe's own Encore will accept 704x576 as a valid size, allegedly). So I'm looking at MPEG2 in 704x576, not muxed so I get an audio file and a video file. The question, I suppose, is whether I keep it progressive or make it TFF/LFF? Any suggestions?

Kind regards, and thanks again for all your help with this.

Discy
Reply With Quote
  #23  
08-29-2018, 08:41 AM
discmeister discmeister is offline
Free Member
 
Join Date: Apr 2018
Posts: 67
Thanked 4 Times in 3 Posts
Bit of an update - I have discovered is that Adobe Encore will not accept a 704x576 file as DVD-compliant. It insists on transcoding it.

I'm going to explore the Spline36Resize taking the file to 720x576. It's not ideal, I know, but I'd rather do it with the 'least-worst' option of AviSynth doing the job instead of handing it over to Premiere Pro or worse still, Encore...

Last edited by discmeister; 08-29-2018 at 09:37 AM.
Reply With Quote
  #24  
09-09-2018, 02:50 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Quote:
Originally Posted by discmeister View Post
Bit of an update - I have discovered is that Adobe Encore will not accept a 704x576 file as DVD-compliant. It insists on transcoding it.

I'm going to explore the Spline36Resize taking the file to 720x576. It's not ideal, I know, but I'd rather do it with the 'least-worst' option of AviSynth doing the job instead of handing it over to Premiere Pro or worse still, Encore...
I must have missed these last two posts when I was out of town for 10 days without a PC. Had an android phone, but they don't work on many websites.

I see some Adobe apps have changed in some respects since I last tried them in 2006. I have no problem with 704-width in NTSC or PAL with other apps, including my trusty old AfterEffects CS2 (but I'm working with lossless in-&-out in CS2, not encoding with it). I also note that the free HCenc MPEG2 encoder doesn't like 704 widths either. Can't tell you how many 704's I have on retail DVD's, though, must be dozens of them. But that's just the way it is.

I guess you've found by now that you can just change Spline36Resize(704,576) to Spline36Resize(720x576). It still works in 4:3 display because the encoder uses a slightly different pixel size ratio to get the same 4:3 display.

Nice work on getting the plugins together, and good luck.
Reply With Quote
  #25  
09-09-2018, 02:53 PM
discmeister discmeister is offline
Free Member
 
Join Date: Apr 2018
Posts: 67
Thanked 4 Times in 3 Posts
Thanks for getting back to me, and for all your help with this. I already have a bunch of H264 files ready to copy across onto my home server, and a load of envelopes with DVDs on them to send out to the original VHS tape providers.

I'm now investigating whether or not I should invest in a (cheap) secondhand PC to do the donkey work of video capture and AVISynth retouching. But that's another thread...
Reply With Quote
  #26  
09-14-2018, 05:57 AM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 13,633
Thanked 2,458 Times in 2,090 Posts
Quote:
Originally Posted by discmeister View Post
Okay, so I've decided to be realistic about this. I have to offset the desire for perfection with a) the likelihood of it being achieved and b) the amount of time it would take to even try. So I'm going to go for the following...
Very wise.

Quote:
AVI Lagarith files captured in VirtualDub via ATI USB 600.
Check for contrast, gamma, saturation and hues - fix as required, in AviSynth
Crop to remove black bars at either side of AVI file, and head-switching noise, in AviSynth
Resize that to 704x576, in AviSynth.
Output back to an AVI Lagarith file.
Why 704 and not 720?

Quote:
What I'm not sure on is whether I output an interlaced file or not. I have to deinterlace it at the start for AviSynth to do its magic, right?
Technically, the AVI isn't interlaced, just the content.
But that means you must be careful not to mess it up. So any vertical cropping needs to be 2-pixel increments.
Avisynth works for both interlaced and progressive, but it depends on the filter. What you propose here, just colors and cropping, is fine as interlaced.

Quote:
I'm confused, though, on why you keep changing color modes
Needs of the filter.

Quote:
Also, do you think the final output file that I should aim for should be interlaced or not? If it's been deinterlaced properly by AviSynth
Always leave archives interlaced tom match source. Only encode deinterlaced copies if needed (web streaming, etc). Even the best proper deinterlace is lossy.

Quote:
export to H264 - which is, after all, the file that I'll be watching myself.
Make a second copy, running Avisynth to deinterlace only, for streaming watching.

Quote:
The MPEG2 DVD file could then be TFF via Adobe Media Encoder (MPEG2 DVD has to be interlaced, right?)?
MPEG doesn't have to be interlaced, but should be if the source content was.

- Did my advice help you? Then become a Premium Member and support this site.
- For sale in the marketplace: TBCs, workflows, capture cards, VCRs
Reply With Quote
  #27  
09-14-2018, 06:31 AM
discmeister discmeister is offline
Free Member
 
Join Date: Apr 2018
Posts: 67
Thanked 4 Times in 3 Posts
Thanks for all that. I believe the original recommendation here was to aim for 704 because it would result in less distortion from the cropped source. But as it turns out, the latest (and presumably last) version of Adobe Encore doesn't accept 704x576 files, so I have subsequently adjusted that bit of the AVISynth scripts to be 720x576. Works nicely. And there are built-in 'protectors' in the filters, it would seem, which force the two-pixel increments, so that gives me some protection on that front.

The workflow seems to work to my satisfaction, and to the satisfaction of those who provided the original source VHS tapes. So I'm going to push ahead with it now (well, I will as soon as my video slave PC is up and running, hopefully by this time next week).

Thanks again to everyone who offered advice here. Genuinely couldn't have reached this stage without your help.

Kind regards,

Discy
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Help correcting de-interlacing problems, please. TerryJW Restore, Filter, Improve Quality 1 06-21-2016 04:25 PM
XviD and Interlacing Tytanic Capture, Record, Transfer 12 05-10-2016 04:03 PM
Virtualdub and chroma interlacing unclescoob Restore, Filter, Improve Quality 6 10-25-2011 11:12 AM
Interlacing on HD progressive displays? admin Capture, Record, Transfer 2 12-02-2009 12:42 PM
Interlacing display Question admin Videography: Cameras, TVs and Players 0 01-22-2009 07:47 PM




 
All times are GMT -5. The time now is 09:07 AM