Quantcast Best scripts for de-telecine - digitalFAQ Forum
  #1  
03-16-2018, 01:04 PM
ragu0012 ragu0012 is offline
Premium Member
 
Join Date: May 2017
Posts: 77
Thanked 5 Times in 4 Posts
My attachment is a sample from the captured, un-restored file.

I am working on a video that appears to be 3:2 pulldown. I want to make one square pixel mp4 6mb/s
and one interlaced Mpeg for archive at 15mb/s

Here is the script i came up with to lead to the mp4 file. I used light TemporalDegrain for noise reduction and LSFmod to sharpen slightly. (I could have captured with noise reduction to avoid that step but there was other non-pulldown material later on the tape that I didn't want to lose any detail on.)

Code:
Import("C:\Program Files (x86)\AviSynth+\plugins\TemporalDegrain.avs")

AviSource("H:\Lou VHS project\Raw tapes\Clem tape 07.avi") 
ConvertToYV12(interlaced=true) 
AssumeTFF() 

### --- Inverse telecine --- ### 
TFM(pp=0).TDecimate() 

ColorYUV(cont_y=50) 
TemporalDegrain(degrain=1, ov=2, hq=1) 
LSFmod() 

Crop(18,0,-8,-8).AddBorders(12,4,14,4) 
Spline36Resize(640,height) 

### ---- for VirtualDub filters ---- ### 
ConvertToRGB32(interlaced=false,matrix="Rec601") 
return last
Wondering your opinion on this script then what I should do different for my interlaced version. Does a simple SeparateFields().SelectEvery(4,0,3).Weave() at the end put it back together?

Thanks.


Attached Files
File Type: avi Clem tape 07.avi (86.13 MB, 11 downloads)
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
03-16-2018, 05:11 PM
themaster1 themaster1 is offline
Free Member
 
Join Date: Feb 2011
Posts: 223
Thanked 43 Times in 37 Posts
I'm not a specialist of telecine but this look like camcorder footage so it should be 29.97i.
in your script try to crop, addborders, upscale at the very end, so after the vdub filters step
Reply With Quote
  #3  
03-17-2018, 10:21 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,189 Times in 958 Posts
Thank you for the sample. Allow me to answer the last question first:

Quote:
Originally Posted by ragu0012 View Post
Wondering your opinion on this script then what I should do different for my interlaced version. Does a simple SeparateFields().SelectEvery(4,0,3).Weave() at the end put it back together?
No, that would be incorrect and tells me that you don't fully understand how that coded procedure works. Inverse telecine removes 3:2 pulldown fields and restores the video to its original progressive film rate of 23.976 fps. The usual re-weaving would create re-combined interlaced frames with duplicate fields in ech frame in a video that would run at 11.98 fps. I think I'm safe in assuming that this isn't what you want. The video looks a little reddish but I can't really tell with this damn Dell laptop screen.

What do you want to do with this video? It appears that you want web mounting or smart tv/external disc playback at 23.976 and a square-pixel format of 640x480. You can't use the results of your script for DVD or standard definition BluRay, both of which are 720x480 at 29.97 fps and either interlaced or telecined. You can run another script on your 640x480 result and resize it from 640x480 to 720x480 again (for a slight quality hit). To restore 29.97 playback for 720x480 you join your lossless segments into a single final-version video and simply tell your encoder to re-apply 3:2 pulldown for DVD or BluRay. Rather than re-create the original partially-interlaced telecined video that had 2 physically interlaced frames and 3 progressive frames for every 5 frames (we call it "hard elecine"), the new encoding would have progressive frames with software-imbedded 3:2 pulldown flags telling your players how to handle those two formerly interlaced frames. It's called "soft telecine". Soft telecine can't be used on websites. "Smart" players should be able to handle it, unless they're not very smart.

I also have some suggestions for your script, re-posted below in its original form:
Code:
Import("C:\Program Files (x86)\AviSynth+\plugins\TemporalDegrain.avs")

AviSource("H:\Lou VHS project\Raw tapes\Clem tape 07.avi")
ConvertToYV12(interlaced=true)
AssumeTFF()

### --- Inverse telecine --- ###
TFM(pp=0).TDecimate()

ColorYUV(cont_y=50)
TemporalDegrain(degrain=1, ov=2, hq=1)
LSFmod()

Crop(18,0,-8,-8).AddBorders(12,4,14,4)
Spline36Resize(640,height)

### ---- for VirtualDub filters ---- ###
ConvertToRGB32(interlaced=false,matrix="Rec601")
return last
ConvertToYV12(interlaced=true)
AssumeTFF()
### --- Inverse telecine --- ###
TFM(pp=0).TDecimate()

The TIVTC plugin can run in the original YUY2, which would make for a slightly cleaner deinterlace of the original telecined frames. I suggest that you generally do whatever you can in the original colorspace before converting to one needed for other filters. In any case, with this sample you have some problems that require purely progressive video for a few of the filters used. But you can inverse telecine with YUY2 if you want.

ColorYUV(cont_y=50)
Don't do this. Your sample already contains non-safe video levels. This contrast "enhancement" will crush more blacks and blow away more highlights especially in the first shot and the last two. You should quick-check original signal levels anyway with a YUV histogram when working with YUV color and levels. ColorYUV(cont_y=50) will exceed y=16-235, which means that the contrast range will be too wide for proper RGB display. Clipping will result in darks and brights. The YUV histogram in the image below (original borders removed) has yellow arrows indicating how the code throws the contrast range into unsafe areas at both edges of the histogram. You can try to correct that error in RGB later, but it won't work. Once data is clipped in RGB, it doesn't come back. FYI, the image also shows the smearing effects of over saturated reds:

frame with black borders removed and YUV histogram:


In the revised script posted later in this post, I used something different (and safer) to help tweak the images. As with many VHS captures, there are some drastic levels changes in this little sample. Usually people would split these scenes, correct some of them separately to suit their purpose, then rejoin them. Don't think that this is unusual practice for many poorly mastered tapes. It's actually very common.

TemporalDegrain(degrain=1, ov=2, hq=1)
This is pretty strong. Coupled with the player's denoising and too much grain removal with this filter, you'll have some bad posterizing and plasticky effects. I used milder settings in the script below, then used a gradient smoother to mask hard facial edges (Gradfun2DBmod) and restored some fine film-like grain (AddGrainC) to mask the over-filtering. Both filters named here are used by QTGMC and MCTemporalDenoise to mask over-filtering effects.

Problems that the original script doesn't address are chroma bleeding from over saturated reds, edge chroma shift, and some obvious right-edge sharpening halos. You can't subdue those halos entirely without turning the video to complete mush, but you can try softening them somewhat. Unfortunately the use of LSFmod to resharpen does re-accentuate some of those halos. Oh, well, we can't have everything. Also, a bright round spot pops up in the 2nd shot, but I forgot to fix it.

The script I used for the attached MPG is below. It needs some tweaks, but I'm using a Dell laptop right now (Dell has some of the world's worst laptop graphics) so it's difficult to judge the results precisely. I should rework this when I return home to a decent monitor that's calibrated. For the MPG, I made a revised script that retained the frame size at 720x480, and the encoding has 3:2 pulldown for 29.97 fps DVD. Sorry, no MPG audio -- the MPG was encoded with the free HCenc encoder and I don't have a/v re-muxing software on this laptop.

Code:
AviSource("H:\Lou VHS project\Raw tapes\Clem tape 07.avi") 

### ---- keep safe levels y=16-235 ---- ###
### ---- These filters work in YUY2 ---- ###  
Tweak(cont=1.1,dither=true,coring=false)
Levels(24,1.0,255,16,235,dither=true,coring=false)

### ---- Inverse telecine _ edges --- ### 
### ---- These filters work in YUY2 ---- ###
AssumeTFF()  
TFM(pp=0).TDecimate() 
FixVHSOversharp(20,16,12)
FixVHSOversharp(20,8,4)

ConvertToYV12(interlaced=false)
TemporalDegrain(SAD1=200, SAD2=150, Sigma=8)
FixChromaBleeding()
Chromashift(c=2)
DeHalo_Alpha(brightstr=2.0)
MergeChroma(aWarpSharp2(depth=20).aWarpSharp2(depth=10))
GradFun2DBmod(thr=1.8)
AddGrainC(1.5,1.5)
LSFmod() 
Spline36Resize(640,height)   ### <- omit this line for 720x480 DVD. <---###
Crop(14, 0,-6,-10).AddBorders(10,4,10,6)

### ---- for VirtualDub filters ---- ### 
ConvertToRGB32(interlaced=false,matrix="Rec601") 
return last
@themaster1:

Quote:
Originally Posted by themaster1 View Post
this look like camcorder footage so it should be 29.97i.
It's not camcorder footage. It's recorded off TV. It's hard telecined in VHS. Open the AVI in VirtualDub, play frame by frame and look for horizontal motion. You will see 3 progressive frames and 2 interlaced frames in every group of 5 frames. This is 3:2 pulldown, which is a form of telecine.

Quote:
Originally Posted by themaster1 View Post
upscale at the very end
Why upscale? Are you saying that your media players and Tv can't scale properly for playback?


Attached Images
File Type: png Too Much Contrast B YUV no borders.png (637.1 KB, 54 downloads)
Attached Files
File Type: mpg Clem_Pulldown_for_DVD.mpg (8.09 MB, 2 downloads)
Reply With Quote
  #4  
03-17-2018, 12:47 PM
ragu0012 ragu0012 is offline
Premium Member
 
Join Date: May 2017
Posts: 77
Thanked 5 Times in 4 Posts
Thank you so much Sanlyn for making this easier to understand.

Most of hte video looks great using the new script but there are a couple scenes where the noise reduction is still a little extreme. Here are a couple screenshots from it. If I were to dial down the NR, how would you go about it on your proposed script? I'm not going to do scene by scene work on this video so just hoping to split the difference a little.

Thanks much.

example 1.png


You must be logged in to view this content; either login or register for the forum. The attached screen shots, before/after images, photos and graphics are created/posted for the benefit of site members. And you are invited to join our digital media community.


Reply With Quote
  #5  
03-17-2018, 06:04 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,189 Times in 958 Posts
JVC noise reduction always looks extreme to me. Many advanced users suggest using EDIT mode, which disables most of it, and which is what I used when I had my old JVCs. There are better noise filters in Avisynth and Virtualdub.
Reply With Quote
  #6  
03-17-2018, 06:19 PM
lordsmurf's Avatar
lordsmurf lordsmurf is online now
Site Staff | Video
 
Join Date: Dec 2002
Posts: 9,814
Thanked 1,675 Times in 1,455 Posts
I use JVC filters most of the time, and I don't think that above overfiltering example has anything to do with the VCR. It's just aggressive Avisynth work. Settings probably needs to be reduced for these scenes.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
  #7  
03-17-2018, 06:37 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,189 Times in 958 Posts
That looks like a typical clay-face JVC capture to me, but maybe ragu012 should tell us what script he used to filter those scenes. Otherwise I have no idea what to suggest.
Reply With Quote
  #8  
03-17-2018, 07:59 PM
ragu0012 ragu0012 is offline
Premium Member
 
Join Date: May 2017
Posts: 77
Thanked 5 Times in 4 Posts
I believe I captured the video on edit setting - however the recording may have been either a second-gen dub or a television recording at LP or EP speed. So there is less than desirable detail and color smearing regardless. For the filtering, I used this script and like I mentioned, much of the video looks great. But a couple scenes in which there was some movement on screen looked over filtered.


Code:
AviSource("H:\Lou VHS project\Raw tapes\Clem tape 07.avi"
 ### ---- keep safe levels y=16-235 ---- ### 
### ---- These filters work in YUY2 ---- ### 
Tweak(cont=1.1,dither=true,coring=false) 
Levels(24,1.0,255,16,235,dither=true,coring=false) 

### ---- Inverse telecine _ edges --- ### ### ---- These filters work in YUY2 ---- ### AssumeTFF() TFM(pp=0).TDecimate() 
FixVHSOversharp(20,16,12) 
FixVHSOversharp(20,8,4) 
ConvertToYV12(interlaced=false) 
TemporalDegrain(SAD1=200, SAD2=150, Sigma=8) 
FixChromaBleeding() 
Chromashift(c=2) 
DeHalo_Alpha(brightstr=2.0) 
MergeChroma(aWarpSharp2(depth=20).aWarpSharp2(depth=10)) 
GradFun2DBmod(thr=1.8) 
AddGrainC(1.5,1.5) 
LSFmod() 
Spline36Resize(640,height) ### <- omit this line for 720x480 DVD.<---### 
Crop(14, 0,-6,-10).AddBorders(10,4,10,6) 

### ---- for VirtualDub filters ---- ### 
ConvertToRGB32(interlaced=false,matrix="Rec601")
 return last
Reply With Quote
  #9  
03-17-2018, 08:36 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,189 Times in 958 Posts
It doesn't look like multi-gen tape dub to me. However, it does look like low-bandwidth slow speed tape played on a JVC. It's likely that TemporalDegrain might not be the ideal denoiser, even though the settings used are for about 1/4 the default strength for that filter.

Would this happen to be a TYPO?
Quote:
### ---- Inverse telecine _ edges --- ### ### ---- These filters work in YUY2 ---- ### AssumeTFF() TFM(pp=0).TDecimate()
Because the above statement starts with "#", the entire line is a comment. None of the code in that line will be executed and telecined fields won't be removed.

A good rule to follow is that not every video can use the same script or the same filter settings. TemporalDegrain even at full strength is a strong filter that nevertheless maintains considerably more detail than some other denoisers. The posted images indicate that the video concerned, or maybe just certain shots, don't have any detail to begin with. In that case TemporalDegrain (aka TDG) wouldn't be a good choice, because asa they say with with analog video, "grain = detail". Also, there's a certain visible softening associated with dehalo filters like FixVHSOversharp and DeHalo_Alpha, so if you don't have strong sharpening halos you don't need those plugins.

BTW, the top image looks as if it has illegal chroma levels in the greens and whites.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Video restoration newbie: Avisynth scripts? latreche34 Restore, Filter, Improve Quality 34 09-14-2019 10:25 PM
Found more VHS tapes, best Avisynth scripts to restore? ragu0012 Restore, Filter, Improve Quality 20 02-06-2018 11:31 AM
Form-to-mail scripts for website? Mr. Rey Web Design + Site Planning 11 07-24-2013 09:51 AM
Various AVISynth scripts to clean noise and convert PAL to NTSC metaleonid Restore, Filter, Improve Quality 12 01-09-2012 07:49 PM

Thread Tools



 
All times are GMT -5. The time now is 02:30 PM