Log in

View Full Version : Merging 2 NTSC and 1 converted PAL clip together


Metal-HTPC
2nd August 2020, 16:05
hello guys,
I wonder if it is possible to load 3 sources (2 ntsc and 1 pal) in avisynth and merge them together.
My project is supposed to be encoded as a NTSC commercial DVD.
The 2 NTSC sources are side A and B of a Laserdisc so as far as I see they are interlaced ntsc film 29,970 including the 3:2 pulldown but have 59.940 fields. The colorimetry is SMPTE 170M.
The PAL source is 25fps but also interlaced with a colorimetry of
BT.470-2 B, G.

So my idea would be to use this on the 2 NTSC sources to make them 23,976.:
TFM()
TDecimate()
AssumeFPS(24000,1001)

The PAL source would have to be resized
Spline36Resize(720,480) or hellohellos cropresize tool
CropResize(720,480, Borders=true)
and the framerate converted
FrameRateConverter(24000,1001)

As for the color matrix I really don't see any difference. I'm not shure but the command for converting bt470bg to smpte170m
could be ColorMatrix(mode="Rec.601->Rec.709", clamp=0)

I don't know if I should deinterlace them all with QTGMC() or if I should just leave them interlaced.

And after all is done I should have a 23,976 file, apply a pulldown with DGPulldown to have the commercial 29,970 DVD and that's it.

Anyways. It doesn't seem to be possible to merge all that together in avisynth or maybe I made a mistake ?
My script:

v1=DGDecode_MPEG2Source("P:\MOVIE\Underground - an urban nightmare\LDS1.d2v").TFM().TDecimate().AssumeFPS(24000,1001)
v2= DGDecode_MPEG2Source("P:\MOVIE\Underground - an urban nightmare\PAL-finger.d2v").FrameRateConverter(24000,1001).CropResize(720,480, Borders=true).ColorMatrix(mode="Rec.601->Rec.709", clamp=0)
v3=DGDecode_MPEG2Source("P:\MOVIE\Underground - an urban nightmare\LDS2.d2v").TFM().TDecimate().AssumeFPS(24000,1001)
v1 + v2 + v3

and here are the samples:
https://workupload.com/file/nuS3yPJesMN

I would really appreciate it if someone could check if I did everything right and maybe has an idea why it isn't possible to merge all clips together. Thanks in advance for your help
regards

johnmeyer
2nd August 2020, 17:56
If these are film sources on laserdisc, then they are NOT interlaced but instead are telecined. Interlace and telecine are two different things. You should not use QTGMC on telecined film.

If the original material was film, then converting both the PAL and NTSC to a common 24 fps (23.976) format makes a lot of sense. All you need for the NTSC material is TFM/TDecimate to convert the 29.97 to 23.976. If the PAL material has simply been sped up from 24 to 25 fps, then all you need to do is make the appropriate slow down. If the PAL material was also film, then it is not interlaced (despite what encoding flags may tell you).

Remember that interlaced material has a temporal difference between fields (i.e., they come from a different moment in time). You can always check if your material actually is interlaced by viewing the output of a one line script that has nothing more than a

separatefields()

line. You will then see each field as a separate frame, and if the material is not interlaced, you will see each pair of fields simply bob up and down, but not have any horizontal motion.

hello_hello
2nd August 2020, 23:05
What's the Avisynth error message when combining the samples with your script?

The PAL video appears to be progressive with the fields out of phase, although there's not much movement in your sample. If it is, you can simply field match with TFM for a progressive 25fps. I'd slow the PAL source down, assuming it's film sped up to 25fps, rather than use FrameRateConverter, but you'll have to re-encode the PAL audio to slow it down too.

ColorMatrix(mode="Rec.601->Rec.709", clamp=0) converts from standard definition colorimetry to high definition colorimetry, so you don't want to use that if the desired output is standard definition. NTSC and PAL both use the Rec.601 matrix for conversion to RGB, but they have slightly different color primaries. I wouldn't worry about it though and just leave the colorimetry as it is. You might be able to convert the PAL color primaries to NTSC color primaries with something like HDRTools, but as I said I wouldn't bother. The difference is fairly minor and it's not as though the PAL source is great quality anyway.

The following works for me to combine your samples. I also cropped the black/crud before re-adding borders to clean the edges and centre the picture.

Vid1 = DGDecode_mpeg2source("D:\clip1-and-clip2-NTSC.d2v")
Vid1 = Vid1.TFM().TDecimate()
Vid1 = Vid1.CropResize(720,480, 20,2,-4,-2, InDAR=15.0/11.0, OutDAR=15.0/11.0, Borders=true)

Vid2 = DGDecode_mpeg2source("D:\clip2-PAL.d2v")
Vid2 = Vid2.TFM()
Vid2 = Vid2.CropResize(720,480, 24,6,-24,-6, InDAR=15.0/11.0, OutDAR=15.0/11.0, Borders=true)
Vid2 = Vid2.AssumeFPS(24000,1001)

Vid1 + Vid2

Metal-HTPC
3rd August 2020, 16:49
@johnmeyer I tried the separatefields() but really don't see anything there.
@hello_hello thanks a lot for the ultimate edition. The combining works now. It was a bug from AVSpmod. When I restarted it it didn't have the error anymore.
Never converted PAL to NTSC before, nice to know that all you have to do is .TFM(), AssumeFPS and resisze to convert a progressive PAL to ntsc compilant film.

So when it comes to detecting what is what I always seem to be missleaded by the wrong tags of the files themselves. So even if mpc-hc, DGIndex and Gspot all say that my source is interlaced it still can be that it isn't. I thought it was a bit strange since most PAL sources which are converted from NTSC are not interlaced. But it makes it all hard for me to detect what I actually have. Isn't there a programm around which tells your exactley which video is interlaced, progressive, or telecined ?

videoh
3rd August 2020, 17:16
You can have progressive video content that is encoded as interlaced. See here for a method to tell what the content actually is:

http://rationalqm.us/faq.html

johnmeyer
3rd August 2020, 18:29
You can have progressive video content that is encoded as interlaced. See here for a method to tell what the content actually is:

http://rationalqm.us/faq.htmlYes, that is what I was trying to tell the OP, but I don't think he understood what I was saying.

Richard1485
3rd August 2020, 19:22
Never converted PAL to NTSC before, nice to know that all you have to do is .TFM(), AssumeFPS and resisze to convert a progressive PAL to ntsc compilant film.


Take care not to overextrapolate from the advice that you've been given. The call to TFM() is useful in cases where the fields are mismatched: it's not necessary in all cases of PAL-to-NTSC conversion (though it probably wouldn't hurt if called unnecessarily). And not all conversions of progressive PAL are as straightforward, although that's normally "all you have to do" for most movies.

And unfortunately there's no magic program that tells us whether a video is truly interlaced or progressive. That's why it's necessary to separate the fields and examine the video.

hello_hello
3rd August 2020, 22:22
So when it comes to detecting what is what I always seem to be missleaded by the wrong tags of the files themselves. So even if mpc-hc, DGIndex and Gspot all say that my source is interlaced it still can be that it isn't. I thought it was a bit strange since most PAL sources which are converted from NTSC are not interlaced. But it makes it all hard for me to detect what I actually have. Isn't there a programm around which tells your exactley which video is interlaced, progressive, or telecined ?

PAL DVDs tend to be encoded as interlaced even if the source is progressive. Sometimes, for whatever reason, they can be encoded with the fields "out of phase". Something like this:

A B C D E F - Top Field
B C D E F G - Bottom Field

It looks combed and appears to be interlaced, but all that's required is TFM to match the fields.

One way to tell if it's interlaced is to bob deinterlace to 50 fps with Yadif(mode=1) or QTGMC(). If you step through the frames where there's movement and each new frame is repeated, then it's progressive and you can just field match. If each new frame is unique, it's interlaced.

If you don't see any combing there's no need to field match or deinterlace, but of course PAL DVDs can be combinations of progressive (film) and interlaced (video).

They can also be created using pulldown rather than simply speeding the video up to 25fps, but it's not all that common. It creates a pattern of combed and clean frames similar to NTSC's 3:2 pulldown. I think Euro pulldown results in a pattern of 13 clean frames and 12 combed frames (or the other way around).
https://en.wikipedia.org/wiki/Telecine#Telecine_judder

Metal-HTPC
5th August 2020, 18:47
thanks a lot guys. I will read through the rationalqm, try to understand it all and play a bit with a few ntsc and pal sources to see if I get it.