Log in

View Full Version : Expert PAL to NTSC conversion? (DVD)


Pages : 1 [2]

mantis2k
23rd July 2005, 23:23
You're showing your lack of knowledge again. The best players analyse the video to determine the appropriate mode of decombing to use. So they do "know about" the nature of the source video.
In that case, the deinterlacing software should also be able to analyse the source when converting to progressive. I shouldn't need to know anything specific about my DVD video.

Like me, he hasn't the time to repeat existing explanations for every newbie that arrives wanting to be spoonfed.
I'm not asking for a big explanation. He could atleast say which software each script/function uses, to put them into context. He's just being lazy, and I doubt English is his native language either.

Within the domain of this site and it's history, his comments are very well placed in context.
Not everyone who visits this site is a part of the board's history. Your comments are bordering on elitism.

loadplugin("dgdecode.dll")
loadplugin("leakkerneldeint.dll")
MPEG2Source("kungfu.d2v",upConv=true)
leakkerneldeint(order=1,threshold=0)
You're getting ahead of yourself again, like Mr. Brain. Correct me if I'm wrong, but I assume you're biased towards AviSynth, which in turn uses TMPGEnc? Well, TMPGEnc is not the best MPEG encoder on the market, and downgraded my video last time I tried it, making it appear too bright. Anyway, I'm willing to give your scripts a try, so can you please tell me how to use them? If it's too much trouble, just give me a link to a guide/tutorial...

@mantis: why are you capturing to lossy MPEG2?
I'm capturing to DVD, which in turn uses MPEG2 video streams.

the video is blocky and totally smoothed.
That's because it's from a rare VHS tape, which is not original or the best of quality to start with.

loadplugin("D:\x\dgdecode.dll")
loadplugin("D:\x\decomb.dll")

mpeg2source("man.d2v")

# crop away black borders
crop(0,72,0,-96)

# match fields
telecide(order=1,guide=2,post=0)

#shift chroma and remove chroma flicker
mergechroma(crop(0,4,0,0).addborders(0,0,0,4).blur(0,1))

# convert image size to NTSC
converttoyuy2()
last.lanczosresize(last.width,round(last.height/1.2))
addborders(0,ceil((480-last.height)/2),0,floor((480-last.height)/2))
Wow, I didn't realise you guys had the time of day to insert comments into your code! :p

Thanks for all your help so far! However, I don't wish to muck around with the boarders!? Surely, the picture would look the wrong aspect ratio when authored back to DVD?

Guest
24th July 2005, 01:33
He's just being lazy...

You're getting ahead of yourself again, like Mr. Brain.

Wow, I didn't realise you guys had the time of day to insert comments into your code! You've just crossed the line, mantis2k. We're trying to help you and you respond with insults. Please see forum rule 4. Thank you.
:readrule:

Guest
24th July 2005, 01:35
could you split this thread in a way, that our chroma-discussion is located in a new thread? I can't do it because I'm not a moderator on this forum. We can resume in the Avisynth development forum if you like.

mantis2k
24th July 2005, 01:52
You've just crossed the line, mantis2k. We're trying to help you and you respond with insults. Please see forum rule 4. Thank you.
:readrule:
No need to feel insulted! Noticed the smily I used after my comment, indicating that I was joking being sarcastic... If I've violated a rule then you've also violated the same rule several times, by some of your comments towards me.

mantis2k
24th July 2005, 02:08
scharfis_brain (copied and pasted),

Do you personally feel insulted that I referred to you as Mr. Brain because I couldn't remember the first part of your nickname?

communist
24th July 2005, 13:11
I'm not asking for a big explanation. He could atleast say which software each script/function uses, to put them into context. He's just being lazy, and I doubt English is his native language either.
AviSynth + mentioned external plugins which can be found here:
www.avisynth.org
Also his explanations make totally sense to me and my native language isnt English either :p

You're getting ahead of yourself again, like Mr. Brain. Correct me if I'm wrong, but I assume you're biased towards AviSynth, which in turn uses TMPGEnc? Well, TMPGEnc is not the best MPEG encoder on the market, and downgraded my video last time I tried it, making it appear too bright. Anyway, I'm willing to give your scripts a try, so can you please tell me how to use them? If it's too much trouble, just give me a link to a guide/tutorial...
Yes you're wrong - AviSynth has nothing to do with TMPGEnc. TMPGEnc is an MPEG Encoder, AviSynth is a frameserver using a scripting language that can be easily learned. For an overview / manual how to use AviSynth have a look at the abovementioned link.

I'm capturing to DVD, which in turn uses MPEG2 video streams.

That's because it's from a rare VHS tape, which is not original or the best of quality to start with.
Capturing lossless or *almost* lossless would have saved you from the blocks introduced by the real time encoder used in your DVD recorder and would allow for some cleanup and improved picture that you could have encoded to MPEG (for DVD).


Thanks for all your help so far! However, I don't wish to muck around with the boarders!? Surely, the picture would look the wrong aspect ratio when authored back to DVD?
Hence they added the AddBorders (http://www.avisynth.org/AddBorders) command to AviSynth ;)

mg262
24th July 2005, 17:02
Can I add to @communist's answer:

If you're working from VHS, please read the analogue capture guide; it tells you, among other things, that AVISynth is unrelated to any encoder, that capturing in MPEG is (to put it mildly) not the preferred method and, perhaps of more use to you at the moment, exactly how you should preserve the aspect ratio. I believe it also has an introduction to using AVISynth in it.

Out of curiosity, may I ask what you are capturing? (Preservation of old tapes -- mainly children's programmes! -- being my main interest.)

Grrr.. the speech recogniser posted this before I was finished again. I wanted to say one other thing, which is that in a limited medium like this, it can be very hard to read the tone of people's posts. So it is best to try and make sure that there is absolutely no way that your comments can be interpreted as being aggressive, sarcastic or critical unless that is really what you intend (and if that is really what you intend then you would be better off starting flame wars on USENET). Something to bear in mind is that, despite the fact that they have answered these questions literally hundreds of times, @scharfis_brain and @neuron2 still seem to take the time to keep answering them... so it is if nothing else more polite to say 'I'm sorry, I really didn't understand that, could you give me an idea of what terms to search for so I can' rather than that something 'makes no sense to the average person'.

scharfis_brain
26th July 2005, 15:24
@neuron2: Did you've got some time to check my claims?

Guest
26th July 2005, 16:34
@scharfis_brain

Sorry, not yet. Can you supply a clip that demonstrates your point of view, i.e., one that is encoded interlaced but looks better when upsampled progressively after deinterlacing?

scharfis_brain
26th July 2005, 17:19
have a look on your FTP.

There I've placed a m2v & a avs file demonstrating the difference between

dumb interlaced upsampling
dumb progressive upsampling
and
motion adaptive upsampling

Guest
26th July 2005, 19:42
have a look on your FTP. What is fc.avs and where do I get it?

Please state what the results are according to you for the three methods.

Paulcat
26th July 2005, 19:51
Mantis2K: Considering the pool of knowledge represented by a small group of people, it's easy to feel pretty dumb here. Of course, since they have had to answer the same questions over and over, they tend to get sarcastic themselves.

Considering your original question, what I would do is separate your audio and video (from the dvd) into separate streams (DVD Decrypter will do it quite efficiently). You can load your *.M2V file into tmpgenc and reprocess it, all you really have to do is re-size it, and leave the framerate at 25fps (assuming a PAL source). To check if the video is interlaced, look under SETTINGS, ADVANCED and double click on DEINTERLACE. You can turn off the filter and look at the image to see if there are interlace lines (will be obvious!), then you can choose odd field or even field and activate the filter.
(Make sure you encode as non-interlaced!!)
When you are done, you will have a 25fps progressive 720x480 *.m2v file. Run that through DGPulldown to change the 25fps to 29.976 and use your favourite dvd authoring tool to re-multiplex your original audio and your new video file, and, voila!

scharfis_brain
26th July 2005, 21:58
@neuron2: whoops. I forgot to delete those lines.


just knock out all this fc() stuff.
it is just a framecache.

then, when the script is running, you should clearly see, that

- progressive upsampling brings far more detailed static chroma but destroys interlacing
(similar, as if I would resize interlaced video without progressive treatment!)

- interlaced upsampling reduces detail of static areas (toally jaggy, do a zoom to get a 1st-time impression!) but leaves chroma-interlacing intact
(similar, like stupid interlaced resizing of progressive video)

- motionadaptive upsampling combines the advantages of both sampling type.
additional (thanks to TDeint) it does a ELA-interpolation of moving (interlaced) areas.
So it is like doing a motion adaptive interaled resizing like I earlierer recommended:

motionadaptivebob()
resize()
assume?ff().separatefields().selectevery(4,0,3).weave()

if you take a closer look at my function yv12toyuy2_laced() you will see, that it uses exactly the same method!
You may also try to replace tdeint with leakkerneldeint.

Guest
27th July 2005, 17:09
I've forgotten how unreliable the progressive_frame flag can be! Gosh, I've even posted many times about that. I must be getting senile.

So, your clip is downsampled progressively, but the progressive_frame flag is left at 0. Unfortunately, this is a common error, because the progressive_frame flag does not affect the decoding process in any way and is just there to guide the display process, so it can be wrong without affecting the decoding of the picture.

If the progressive_frame flag is unreliable, then we move into the realm of image heuristics, of which your solution is an example. If the flag is reliable, then upConv=true is satisfactory.

Interestingly, there is a patent describing an approach similar to yours:

http://www.freshpatents.com/Chroma-upsampling-method-and-apparatus-therefor-dt20050210ptan20050030422.php?type=description

I'm thinking of making a native conversion plugin that does this.

Interestingly, with your clip, if you compare upConv=true to ConvertToYUY2(interlaced=true), you would expect them to be the same, because the progressive_frame flag denotes interlaced. But the upConv=true way looks better, even though some artifacts are still visible. I'm curious about why. I'll look into it.

EDIT: I'm not sure of this anymore. As you say, interlaced upsampling preserves the interlacing, so that suggests that it really is downsampled as interlaced. I have to ponder some more. The content appears to be field-blended progressive from an NTSC->PAL conversion. I wonder how that affects things, because that's not traditional interlacing. Maybe the encoder had downsampled some frames progressively and some interlaced but without bothering to set the progressive_frame flag.

EDIT2: Negative on the speculation that the encoder had downsampled some frames progressively and some interlaced, because in a frame showing interlacing, if you upsample progressively you get rid of the CUE but mess up the interlacing, while if you upsample interlaced you keep the interlacing OK but have the CUE. Hmm. Very strange. I'm going to think how this mess could have arisen as a consequence of the field-blending format conversion. I do agree that the heuristic approach appears to be the right way to go -- for this video at least.

Guest
29th July 2005, 02:41
@scharfi,

I've convinced myself that the presence of areas that upsample better interlaced and areas that upsample better progressive in the same frame is an artifact of the field blending process *for the clip that you provided*.

I'd be very interested to hear if you have any examples where you see this phenomenon in a clip that is not field-blended; that is, dual areas within the same frame. Of course I also acknowledge that the progressive_frame flag can be outright wrong, but that would affect the whole frame.

I think another possible case would arise from applying the upsampling to a frame that has been progressively downsampled but then pulled down so that portions of it are interlaced. It was to avoid this case that I preferred upConv=true (because it upsamples the encoded pictures and not the pulled-down frames). Another reason is to avoid having to use image heuristics to determine per frame which upsampling to use, but that assumes that the flags are reliable.

You've certainly convinced me that there is (possibly a lot of) video that cries out for adaptive chroma upsampling. I'm wondering if we've been unnecessarily making lots of poor upconversions due to this phenomenon, and whether we should make a fast native adaptive upsampler for the Avisynth core.

I would appreciate hearing your views about this. Thanks for yet again stimulating some new arrangements in my neurons, especially neuron number two.