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 13th August 2019, 00:51   #1  |  Link
jrodefeld
Registered User
 
Join Date: Sep 2014
Posts: 32
Proper method of converting interlaced PAL to progressive NTSC?

So I've been working on a fan project to restore an old film to the best possible quality.

The idea is to upscale the DVD to 1080p, then work on dirt removal and color correction.

The best version of this film happens to be a PAL DVD from Sweden.

This is the script I'm using at the moment:

QTGMC(Preset="Slow", TR2=3, Sharpness=0.8)
SelectOdd()
sRestore(frate=23.976)


Is sRestore the proper method after deinterlacing to achieve a 23.976 progressive result?

Thanks for the help.
jrodefeld is offline   Reply With Quote
Old 13th August 2019, 01:01   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
upscale the DVD to 1080p, then work on dirt removal and color correction
I aint no expert (nor hardly a newbie), but would suggest get rid of crap before upscale, upscale first would make it a much tougher project, methinks.
EDIT: Also, dont know if your SelectOdd/Even is a bit premature in the processing chain. [assuming req best possible result for the work expended]
__________________
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; 13th August 2019 at 01:08.
StainlessS is offline   Reply With Quote
Old 13th August 2019, 01:08   #3  |  Link
kuchikirukia
Registered User
 
Join Date: Oct 2014
Posts: 476
If it was field blended to 25 and that's why you're using a deinterlacer on it, remove the selectodd() and let srestore do its job.

If it's not interlaced you shouldn't be deinterlacing it.
kuchikirukia is offline   Reply With Quote
Old 13th August 2019, 09:26   #4  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by jrodefeld View Post
Is sRestore the proper method after deinterlacing to achieve a 23.976 progressive result?
The proper method depends very much on your source. Upload a sample of your source so someone can take a look.

What do you expect from upscaling b.t.w.?

Last edited by Sharc; 13th August 2019 at 10:04.
Sharc is offline   Reply With Quote
Old 13th August 2019, 10:29   #5  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
1) Upload a sample like Sharc say.

2) If you have a true interlaced DVD PAL you have a source of 720x288 semiframes at 50 fps.
Do you think than convert it to 1920x1080 23.976 progressive is the best possible quality?
You lose 26 frames each 50 but invent (1920x1080) pixels from (720x288).
10 final pixels from 1 source pixel!
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 14th August 2019, 05:30   #6  |  Link
jrodefeld
Registered User
 
Join Date: Sep 2014
Posts: 32
Okay, here's a clip from the video I have:

https://www.dropbox.com/s/rvlbhvbjds...video.avi?dl=0

It's only a 90 second clip or so but the file size is still several hundred megabytes because it's a lossless AVI using the Lagarith codec.

As you can probably tell, I'm not a real expert on AviSynth scripts. Especially the whole deal with true interlace, hard interlace, top field first, bottom field first, inverse telecine, PAL to NTSC conversion and vice versa I find rather confusing.

I'm usually working with 1080p HD footage, so I'm a bit out of my depth on this issue. Hoping someone here can help.
jrodefeld is offline   Reply With Quote
Old 14th August 2019, 06:45   #7  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
It's progressive, and supposed to be 25 FPS , as expected for this type of Hong Kong DVD production

If you "must" convert it to 23.976 for some reason, the "ideal" way is to slow it down . Every film frame is kept, no
blending , drops, or weirdness . Slow down the audio in an audio editor +/- pitch adjustment

AssumeFPS(24000,1001)


Note there are a few frames "combed" in the source. That is because of the field warping - but you'd still call this progressive. I'd fix those manually along with the spots and imperfections on some frames

If you have to upscale, do that last. Otherwise you upscale artifacts, dirt, etc... and it's more difficult to fix


(You should have uploaded a unprocessed segment cut from the DVD. It would have been much smaller in size. Also, other conversions might have occurred that you don't know about. For example, this has been chroma upsampled to 4:2:2 . The DVD should be 4:2:0 . It makes you wonder if you did something else too ? With the unprocessed DVD sample, there are no types of those questions .)
poisondeathray is offline   Reply With Quote
Old 14th August 2019, 07:45   #8  |  Link
jrodefeld
Registered User
 
Join Date: Sep 2014
Posts: 32
Quote:
Originally Posted by poisondeathray View Post
It's progressive, and supposed to be 25 FPS , as expected for this type of Hong Kong DVD production

If you "must" convert it to 23.976 for some reason, the "ideal" way is to slow it down . Every film frame is kept, no
blending , drops, or weirdness . Slow down the audio in an audio editor +/- pitch adjustment

AssumeFPS(24000,1001)


Note there are a few frames "combed" in the source. That is because of the field warping - but you'd still call this progressive. I'd fix those manually along with the spots and imperfections on some frames

If you have to upscale, do that last. Otherwise you upscale artifacts, dirt, etc... and it's more difficult to fix


(You should have uploaded a unprocessed segment cut from the DVD. It would have been much smaller in size. Also, other conversions might have occurred that you don't know about. For example, this has been chroma upsampled to 4:2:2 . The DVD should be 4:2:0 . It makes you wonder if you did something else too ? With the unprocessed DVD sample, there are no types of those questions .)
Thanks for the advice.

I just loaded the original VOB file into VirtualDub using this simple script:

LoadPlugin("C:\ProgramFiles(x86)\AviSynth+\plugins64\DGDecode.dll")

Mpeg2Source("D:\TheKiller_Scanbox.d2v")

So it shouldn't have done too much to the source.

Would you mind explaining how I could fix the combed frames?

Once I get a good 23.976 progressive image with all the frames fixed, I should have no problems at that point.

I'll definitely take your advice to do all dirt removal and other filtering first and save the upscaling for last.
jrodefeld is offline   Reply With Quote
Old 14th August 2019, 09:21   #9  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by jrodefeld View Post
I just loaded the original VOB file into VirtualDub using this simple script:

LoadPlugin("C:\ProgramFiles(x86)\AviSynth+\plugins64\DGDecode.dll")

Mpeg2Source("D:\TheKiller_Scanbox.d2v")

So it shouldn't have done too much to the source.
Well, it ballooned the size to 445MB, wasted your time in creating and uploading it and pdr's in downloading it. You could have easily cut an M2V from the DVD using DGIndex.
manono is offline   Reply With Quote
Old 14th August 2019, 13:47   #10  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by jrodefeld View Post
Would you mind explaining how I could fix the combed frames?
Once you have a working QTGMC you could try
Code:
converttoYV12(interlaced=false) #for your .avi
AssumeFPS(24000,1001)  #if you really want 23.976 fps
QTGMC(InputType=3) #clean up the progressive video and remove the residual combing; tune if noise/details removal should be too aggressive

Last edited by Sharc; 14th August 2019 at 14:00.
Sharc is offline   Reply With Quote
Old 14th August 2019, 14:29   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Posted by Manono
Quote:
You could have easily cut an M2V from the DVD using DGIndex.
jrodefeld,
You can cut a section using DGIndex by setting start frame clicking the '[' icon, and the end frame using the ']' icon,
then Menu/File "Save Project & Demux Video". Then post the *.m2v file only (usually dont bother with audio nor d2v) files.

posted by PDR
Quote:
For example, this has been chroma upsampled to 4:2:2 . The DVD should be 4:2:0 . It makes you wonder if you did something else too ?
Maybe he used the MPeg2Source(UpConv=1) option, which decodes to YUY2 [I sometimes do that with Progressive encoded as Interlaced, to let MPeg2Source() unscramble
the chroma correctly].
__________________
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 14th August 2019, 16:47   #12  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Did you have lagarith set to YUY2 ? I'm wondering how it got upsampled. The way lagarith works is if you leave it to RGB(default) it will actually use the input pixel format if supported. That includes YV12 (4:2:0). Or you could explicitly set it to YV12




Quote:
Originally Posted by jrodefeld View Post

Would you mind explaining how I could fix the combed frames?

Once I get a good 23.976 progressive image with all the frames fixed, I should have no problems at that point.

I'll definitely take your advice to do all dirt removal and other filtering first and save the upscaling for last.

If you really meant " restore an old film to the best possible quality" , it involves manual work - painting, masking , compositing

For a "quicky" comb repair - you can use QTGMC in progressive mode as Sharc suggested, but I would only apply it to those affected frames. Otherwise you will unnecessarily degrade "good" frames. The finer details will get blurred out, things like hair strands, texture details,etc.. - which is entirely counterproductive if the goal was to upscale it to some HD resolution . You could use apply the filters through trim or remapframes if there are many to fix in the entire movie (essentially swapping between 2 versions).

I'd be careful with "dirt removal" and "other filtering" for the same reason - it can be counterproductive for upscaling . Dirt removal scripts , even at low settings, will remove fine details . They are not selective enough when used alone for a detailed repair. It's like a bomb blast, when you need a fine laser scalpel. You can still use them, but you need to increase the accuracy through more selective masks (usually by painting)

For the combing - first identify where they are - for example there are frame pairs in the scene changes when they enter the room when the cat jumps, lamp falls etc... Another when he's looking at the picture, etc... QTGMC or avisynth filters can fix the combing, but you'd still be left with the frame warping. You decide how far you want to take it.

For the picture scene with 1 comb framed, warping, and frame alignment issues (1213 to 1219 in your source), you can interpolate over the "bad" frames because you have adjacent "good" frames bracketing the "bad" section, and the motion is slow (interpolation works better) . The scene changes didn't have an adjacent good "start" frame so you can't use this method there

Code:
.
.
.
ConvertToYV12()  #don't need this for actual source
RX(1213,7)


function RX(clip Source, int N, int X)
{
# N is number of the 1st frame in Source that needs replacing.
# X is total number of frames to replace
#e.g. RX(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for mflowfps interpolation

start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point
end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point

start+end
AssumeFPS(1) #temporarily FPS=1 to use mflowfps

super = MSuper()
backward_vec = MAnalyse(super, isb = true)
forward_vec = MAnalyse(super, isb = false)
MFlowFps(super, backward_vec, forward_vec, blend=false, num=X+1, den=1) #num=X+1
AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining
Trim(1, framecount-1) #trim ends, leaving replacement frames

Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0)
}

For the combing manual repairs, I would mask out the moving parts, and replace the BG with patches out from good frames . The decombed FG elements are composited back in . Essentially you're replacing the room static elements, but that repairs the warping . It's a bit tricky in some scenes with lighting changes, but you use feathered masks to blend it . You can still use avisynth for parts of the repair, but it can't be done alone with avisynth entirely. It's just one of the tools in the tool belt

For the other manual repairs , you need other tools such as compositing tools like after effects, photoshop . Some of the other splotches are easily cloned out, or composited with motion tracked repairs from other frames

Last edited by poisondeathray; 14th August 2019 at 17:05.
poisondeathray 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 02:16.


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